ReactNative: Xcode 15 build "@bugsnag/react-native": "7.21.0" failed.
VegaChen-BadtzMaru opened this issue · 9 comments
Import of C++ module 'Darwin.POSIX.sys.types' appears within extern "C" language linkage specification
This issue stems from the use of import statements inside of C files or extern "C" language linkage specifications.
As far as we can tell this is not originating from within the cocoa package. Can you please verify whether you have any import within either of these contexts. It may be worth checking if any header files that you have imported has an extern "C" section that contains any imports like this.
I’d also like to note that we recommend using an #include over an #import in an objc context.
Reference to Apples module Issues documentation: Identifying and addressing framework module issues | Apple Developer Documentation
If you can verify that imports from your side are not causing this issue then please reach out to us again providing some additional context to this error.
The problem is from this line:
Move it to on top of #ifdef __cplusplus, then can pass build.
Looks like on Xcode 15, <sys/types.h> already has #ifdef __cplusplus extern "C" {, so duplication causes issue.
Not sure if it's Xcode 15's bug, because if I check the source code of <sys/types.h>, I can't see extern "C".
I checked the source code of <sys/types.h>
But I can't find extern "C", weird. Maybe what's used in build is not exact the same as the source code.
Btw, I do find another <sys/types.h> has extern "C", see this: http://www.sde.cs.titech.ac.jp/~gondow/dwarf2-xml/HTML-rxref/app/gcc-3.3.2/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/include/sys/types.h.html.
Thanks for that additional information.
It does seem that moving the #include
statements outside the extern "C"
scope would resolve this issue. As such, we have added an item to our backlog to fix this.
We will make sure to update this thread once a fix has been released.
bump. Is there an update on this?
Hi @samueljim
No update just yet. Once we do have more information we will update this thread
Do you have a timetable yet for this fix? It breaks our build as well?
Do you have a timetable yet for this fix? It breaks our build as well?
The fix already has a PR over here bugsnag/bugsnag-cocoa#1603
Hi 👋
A new version of the Bugsnag-js notifier has been released which bumps the version of the cocoa notifier used by the JS notifier. This update to the cocoa notifier involves removes include directives from inside of extern "C" sections.
Once upgraded, if you are see any issues please let us know and we can investigate further.