sentry-native
sentry-native copied to clipboard
Compile error on Mac OS 10.14 for 0.4.9
Description
Compile error on Mac OS 10.14. It apparears SDKROOT returns empty string (FYI).
When does the problem happen
- [ x] During build
- [ ] During run-time
- [ ] When capturing a hard crash
Environment
- OS: Mac OS 10.4 (Mojave), Xcode 11.4 (AppleClang 11.0.3.11030032)
Steps To Reproduce
compile on Mojave
Log output
...clang: warning: no such sysroot directory: '/Users/builder/builds/F7Ri9TW5/0/xxx/yyy/build/other/sentry/sentry-native/crashpad_build/util/DKROOT' [-Wmissing-sysroot] ....crashpad/util/mach/child_port.defs:15:10: fatal error: 'mach/mach_types.defs' file not found #include <mach/mach_types.defs>
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
That is mentioned in the readme. Otherwise you need to correctly activate the xcode build tools, that is always a bit confusing.
There is an issue with this solution. SDKROOT
is an environment variable and injected to the cmake_add_custom_command
. On some versions of CMake, this might not work properly, because they internally use make
to execute commands (for example cmake 3.18) which requires escaping of $
with additional $
.
The more portable solution would be, at least, to expand this env variable in CMake file using $ENV{SDKROOT}
and pass the actual value.
Update of CMake to the latest version (3.20 for example) also fixes this issue, because it is no longer uses make
, but it does not solve backward compatibility with other CMake versions.