Opened 5 years ago
Closed 2 years ago
#60325 closed defect (fixed)
icu 65.1: platform.h has macro clash with cpprestsdk (and possibly other libraries)
Reported by: | Lord-Kamina (Gregorio Litenstein) | Owned by: | catap (Kirill A. Korinsky) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.6.2 |
Keywords: | Cc: | ||
Port: | icu |
Description
I'll soon make a PR for this because it appears to be a simple fix; nonetheless, I figured it would be a good idea to make a ticket here also so we can track when it gets fixed upstream (I've already reported it at https://unicode-org.atlassian.net/browse/ICU-21064
In short, in ICU65.1, they introduced macros around Clang's __has_attribute
features. In a few places they use those calls with dllexport
and dllimport
as parameters, which clashes with macro definitions in CppRestSdk. In my case, I noticed this compiling an app that uses both CppRestSdk and ICU, which failed with the following error:
In file included from /Users/Koji/performous/game/unicode.hh:6: In file included from /opt/local/include/libxml2/unicode/tblcoll.h:65: In file included from /opt/local/include/libxml2/unicode/utypes.h:38: In file included from /opt/local/include/libxml2/unicode/umachine.h:46: In file included from /opt/local/include/libxml2/unicode/ptypes.h:52: /opt/local/include/libxml2/unicode/platform.h:818:29: error: too few arguments provided to function-like macro invocation UPRV_HAS_DECLSPEC_ATTRIBUTE(dllimport)) ^ /opt/local/include/libxml2/unicode/platform.h:438:69: note: expanded from macro 'UPRV_HAS_DECLSPEC_ATTRIBUTE' # define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) __has_declspec_attribute(x) ^ /opt/local/include/libxml2/unicode/platform.h:843:29: error: too few arguments provided to function-like macro invocation UPRV_HAS_DECLSPEC_ATTRIBUTE(dllimport)) ^ /opt/local/include/libxml2/unicode/platform.h:438:69: note: expanded from macro 'UPRV_HAS_DECLSPEC_ATTRIBUTE' # define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) __has_declspec_attribute(x)
I'm not entirely sure whose at fault here, ICU or CppRestSdk, but as per https://clang.llvm.org/docs/LanguageExtensions.html#has-declspec-attribute, enclosing the attributes in double underscores will prevent the clash (I tested it, and the error went away, at least)
Change History (6)
comment:1 Changed 5 years ago by mf2k (Frank Schima)
Keywords: | declspec clang dllimport dllexport cpprestsdk removed |
---|
comment:2 Changed 5 years ago by Lord-Kamina (Gregorio Litenstein)
comment:4 Changed 4 years ago by kencu (Ken)
Owner: | set to kencu |
---|---|
Status: | new → accepted |
comment:5 Changed 3 years ago by kencu (Ken)
Owner: | kencu deleted |
---|---|
Status: | accepted → assigned |
comment:6 Changed 2 years ago by catap (Kirill A. Korinsky)
Owner: | set to catap |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
In 65ebd8e5ecad21339db4efe23db76022362c023c/macports-ports (master):