Skip to content

Commit 57676e8

Browse files
authored
[cpprestsdk] fix bad define in header for clang (#38659)
- **[cpprestsdk] fix clang build on new zlib** - **./vcpkg x-add-version --all** Defining `dllimport` is *bad* and breaks clang, and since this is in maintaince mode they aren't going to fix it. This had the ability to blow up projects before, but newer zlib versions use `__has_declspec_attribute`, so that makes it impossible to even _build_ cpprestsdk on systems like these (I'm on Fedora 40). Refs: microsoft/cpprestsdk#1710 llvm/llvm-project#53269 - [x] Changes comply with the [maintainer guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md). - [x] SHA512s are updated for each updated download. - [x] The "supports" clause reflects platforms that may be fixed by this new version. - [x] Any fixed [CI baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt) entries are removed from that file. - [x] Any patches that are no longer applied are deleted from the port's directory. - [x] The version database is fixed by rerunning `./vcpkg x-add-version --all` and committing the result. - [x] Only one version is added to each modified port's versions file.
1 parent 77daaf0 commit 57676e8

File tree

5 files changed

+60
-1
lines changed

5 files changed

+60
-1
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
diff --git a/Release/include/cpprest/details/cpprest_compat.h b/Release/include/cpprest/details/cpprest_compat.h
2+
index bf107479..00581371 100644
3+
--- a/Release/include/cpprest/details/cpprest_compat.h
4+
+++ b/Release/include/cpprest/details/cpprest_compat.h
5+
@@ -29,7 +29,6 @@
6+
#else // ^^^ _WIN32 ^^^ // vvv !_WIN32 vvv
7+
8+
#define __declspec(x) __attribute__((x))
9+
-#define dllimport
10+
#define novtable /* no novtable equivalent */
11+
#define __assume(x) \
12+
do \
13+
@@ -74,9 +73,17 @@
14+
#define _ASYNCRTIMP_TYPEINFO
15+
#else // ^^^ _NO_ASYNCRTIMP ^^^ // vvv !_NO_ASYNCRTIMP vvv
16+
#ifdef _ASYNCRT_EXPORT
17+
+#ifdef _WIN32
18+
#define _ASYNCRTIMP __declspec(dllexport)
19+
+#else
20+
+#define _ASYNCRTIMP __attribute__((visibility("default")))
21+
+#endif
22+
#else // ^^^ _ASYNCRT_EXPORT ^^^ // vvv !_ASYNCRT_EXPORT vvv
23+
+#ifdef _WIN32
24+
#define _ASYNCRTIMP __declspec(dllimport)
25+
+#else
26+
+#define _ASYNCRTIMP
27+
+#endif
28+
#endif // _ASYNCRT_EXPORT
29+
30+
#if defined(_WIN32)
31+
diff --git a/Release/include/pplx/pplx.h b/Release/include/pplx/pplx.h
32+
index d9ba9c61..8d36252c 100644
33+
--- a/Release/include/pplx/pplx.h
34+
+++ b/Release/include/pplx/pplx.h
35+
@@ -30,9 +30,17 @@
36+
#define _PPLXIMP
37+
#else
38+
#ifdef _PPLX_EXPORT
39+
+#ifdef _WIN32
40+
#define _PPLXIMP __declspec(dllexport)
41+
#else
42+
+#define _PPLXIMP __attribute__((visibility("default")))
43+
+#endif
44+
+#else
45+
+#ifdef _WIN32
46+
#define _PPLXIMP __declspec(dllimport)
47+
+#else
48+
+#define _PPLXIMP
49+
+#endif
50+
#endif
51+
#endif
52+

ports/cpprestsdk/portfile.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ vcpkg_from_github(
88
fix-find-openssl.patch
99
fix_narrowing.patch
1010
fix-uwp.patch
11+
fix-clang-dllimport.patch # workaround for https://github.com/microsoft/cpprestsdk/issues/1710
1112
)
1213

1314
set(OPTIONS)

ports/cpprestsdk/vcpkg.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "cpprestsdk",
33
"version": "2.10.19",
4+
"port-version": 1,
45
"description": [
56
"C++11 JSON, REST, and OAuth library",
67
"The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services."

versions/baseline.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1942,7 +1942,7 @@
19421942
},
19431943
"cpprestsdk": {
19441944
"baseline": "2.10.19",
1945-
"port-version": 0
1945+
"port-version": 1
19461946
},
19471947
"cppslippi": {
19481948
"baseline": "1.4.3.16",

versions/c-/cpprestsdk.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"versions": [
3+
{
4+
"git-tree": "a10a640d968ca2ac8f1d0df0836e3d23a7fb2199",
5+
"version": "2.10.19",
6+
"port-version": 1
7+
},
38
{
49
"git-tree": "110c2c2a08e520877aa3fa9231ab69e0a76f388d",
510
"version": "2.10.19",

0 commit comments

Comments
 (0)