Opened 4 years ago
Last modified 4 years ago
#61775 closed defect
mame: 0.226 build fails on 10.8; libc++ issue? — at Version 6
Reported by: | mascguy (Christopher Nielsen) | Owned by: | mascguy (Christopher Nielsen) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | Cc: | ||
Port: | mame |
Description (last modified by mascguy (Christopher Nielsen))
Mame 0.226 fails to build on 10.8, due to compilation errors in file 'src/osd/modules/files/posixfile.cpp'.
Here's one example:
In file included from ../../../../../src/osd/modules/file/posixfile.cpp:41: In file included from ../../../../../src/osd/modules/file/posixfile.h:12: In file included from ../../../../../src/osd/osdcore.h:17: In file included from ../../../../../src/lib/util/strformat.h:174: In file included from ../../../../../src/lib/util/vecstream.h:25: In file included from /opt/local/libexec/llvm-9.0/bin/../include/c++/v1/istream:163: In file included from /opt/local/libexec/llvm-9.0/bin/../include/c++/v1/ostream:140: /opt/local/libexec/llvm-9.0/bin/../include/c++/v1/locale:1455:16: error: use of undeclared identifier 'snprintf_l'; did you mean 'vswprintf_l'? int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); ^
The issue appears to relate to the libc++ headers: When '_XOPEN_SOURCE' is defined, certain items aren't declared unless '_DARWIN_C_SOURCE' is also defined. So far, this bug seems to be isolated to MacOS 10.8.x.
Note that the Mame port is presently using MacPorts Clang 9. However, the same failures also occur with MacPorts Clang 10.
Potential solution: Patch source file 'posixfile.cpp', adding the following at the appropriate place:
// MacPorts: Fix for libc++ compilation errors on MacOS 10.8 #if defined(__APPLE__) #define _DARWIN_C_SOURCE #endif
While we could certainly define '_DARWIN_C_SOURCE' globally, that seems more risky. Particularly given that the issue only affects one Mame source file.
I've confirmed that the proposed fix allows Mame to build successfully, on MacOS 10.8.
Change History (6)
comment:1 Changed 4 years ago by mascguy (Christopher Nielsen)
comment:2 follow-up: 4 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)
MacPorts uses libc++ by default on 10.6 and later. Are you sure that mame is using libstdc++? If it is, that is a bug that should be fixed; it should use the C++ stdlib that MacPorts tells it to.
comment:3 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)
Priority: | High → Normal |
---|
comment:4 Changed 4 years ago by mascguy (Christopher Nielsen)
Replying to ryandesign:
MacPorts uses libc++ by default on 10.6 and later. Are you sure that mame is using libstdc++? If it is, that is a bug that should be fixed; it should use the C++ stdlib that MacPorts tells it to.
No, you're right... Mame is using libc++, rather than libstdc++.
However, more digging revealed this to be a C header file issue... completely unrelated to the C++ standard library.
comment:5 Changed 4 years ago by mascguy (Christopher Nielsen)
Description: | modified (diff) |
---|---|
Summary: | mame: 0.226 build fails on 10.8, due to host libstdc++ bug (_DARWIN_C_SOURCE needs to be defined) → mame: 0.226 build fails on 10.8; libc++ issue? |
comment:6 Changed 4 years ago by mascguy (Christopher Nielsen)
Description: | modified (diff) |
---|
<After additional investigation, this comment no longer relevant.>