nanoem icon indicating copy to clipboard operation
nanoem copied to clipboard

Failed to build Sentry Native SDK

Open CharlotteFallices opened this issue 2 years ago • 2 comments

Just clone and build with cmake -P scripts/build.cmake:

ninja: error: loading 'build.ninja': No such file or directory
CMake Error at scripts/build.cmake:41 (message):
  Building failed with 1:
  ./dependencies/sentry-native/out/darwin/clang/ub/debug
Call Stack (most recent call first):
  scripts/build.cmake:345 (execute_build)
  scripts/build.cmake:575 (compile_sentry_native)
  scripts/build.cmake:700 (compile_all_repositories)

*There will be no problems if manually build the Sentry Native SDK:

cd dependencies/sentry-native
cmake -B xcodebuild -GXcode -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3
xcodebuild build -project xcodebuild/Sentry-Native.xcodeproj

CharlotteFallices avatar Jun 21 '22 04:06 CharlotteFallices

I checked the log ./dependencies/sentry-native/out/darwin/clang/ub/debug/CMakeFiles/CMakeError.log and got:

  1 Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
  2 Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c    c
  3 Build flags:
  4 Id flags:
  5 
  6 The output was:
  7 1
  8 ld: library not found for -lSystem
  9 clang: error: linker command failed with exit code 1 (use -v to see invocation)
 10 
 11 
 12 Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
 13 Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c    ++
 14 Build flags: -std=c++14
 15 Id flags:
 16 
 17 The output was:
 18 1
 19 ld: library not found for -lc++
 20 clang: error: linker command failed with exit code 1 (use -v to see invocation)

-lx This option tells the linker to search for libx.dylib or libx.a in the library search path. If string x is of the form y.o, then that file is searched for in the same places, but without prepending lib or appending .a or .dylib to the filename. -Ldir Add dir to the list of directories in which to search for libraries. Directories specified with -L are searched in the order they appear on the command line and before the default search path. In Xcode4 and later, there can be a space between the -L and directory.

As for the manpage, -lSystem means a lib called libSystem and I found it in /Library/Developer/CommandLineTools/SDKs/MACOSX.sdk/usr/lib, so it should be:

ld -lSystem -L "/Library/Developer/CommandLineTools/SDKs/MACOSX.sdk/usr/lib"

But I don't know anything about cmake file so that I can't change how it work :(

CharlotteFallices avatar Jun 21 '22 08:06 CharlotteFallices

Did you run following command on top directory?

git submodule update --init --recursive

Because sentry-native requires recursive submodule checkout, building sentry-native may fail without recursive submodule checkout.

On the other hand, sentry-native is only needed for crash reports and can be disabled by setting the following environment variable. If this does not work, please try that.

export NANOEM_DISABLE_BUILD_SENTRY_NATIVE=1

hkrn avatar Jun 22 '22 15:06 hkrn

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Aug 30 '22 23:08 stale[bot]