juha-h / libbaresip-android

libbaresip for Android
Other
40 stars 30 forks source link

Problem when building on mac m1 #39

Closed datpt11 closed 10 months ago

datpt11 commented 10 months ago

When I go to the ZRTPCPP folder and run the command: mkdir build cd build cmake .. it's completely normal but when I run the make install-all command I get an error like this

gcc --version
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin23.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
-- The C compiler identification is Clang 17.0.2
-- The CXX compiler identification is Clang 17.0.2
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Users/datphung/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi23-clang
-- Check for working C compiler: /Users/datphung/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi23-clang - broken
CMake Error at /opt/homebrew/Cellar/cmake/3.28.1/share/cmake/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/Users/datphung/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi23-clang"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/Users/datphung/workspace/baresip-studio/libbaresip-android/ZRTPCPP/build/CMakeFiles/CMakeScratch/TryCompile-ZPsRw4'

    Run Build Command(s): /opt/homebrew/Cellar/cmake/3.28.1/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_e49de/fast
    /Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/cmTC_e49de.dir/build.make CMakeFiles/cmTC_e49de.dir/build
    Building C object CMakeFiles/cmTC_e49de.dir/testCCompiler.c.o
    /Users/datphung/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi23-clang   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -MD -MT CMakeFiles/cmTC_e49de.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_e49de.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_e49de.dir/testCCompiler.c.o -c /Users/datphung/workspace/baresip-studio/libbaresip-android/ZRTPCPP/build/CMakeFiles/CMakeScratch/TryCompile-ZPsRw4/testCCompiler.c
    Linking C executable cmTC_e49de
    /opt/homebrew/Cellar/cmake/3.28.1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_e49de.dir/link.txt --verbose=1
    /Users/datphung/Library/Android/sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi23-clang  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_e49de.dir/testCCompiler.c.o -o cmTC_e49de
    ld.lld: error: unknown argument '-search_paths_first'
    clang-17: error: linker command failed with exit code 1 (use -v to see invocation)
    make[3]: *** [cmTC_e49de] Error 1
    make[2]: *** [cmTC_e49de/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:18 (PROJECT)

-- Configuring incomplete, errors occurred!
make[1]: *** [gzrtp] Error 1
juha-h commented 10 months ago

Sorry, but I don't know anything about Mac M1 Darwin or any other commercial OS. Only only build environment that I try to support is Debian 12 as is written in README.md.