epoupon / lms

Lightweight Music Server. Access your self-hosted music using a web interface.
http://lms-demo.poupon.dev
GNU General Public License v3.0
1.14k stars 62 forks source link

macOS 13 build failure: `Undefined symbols for architecture x86_64: "std::exception_ptr::__from_native_exception_pointer(void*)"` #526

Open barracuda156 opened 2 months ago

barracuda156 commented 2 months ago

This fails specifically on macOS 13:

  [  9%] Linking CXX shared library liblmscore.dylib
  cd /opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_audio_lms/lms/work/build/src/libs/core && /opt/local/bin/cmake -E cmake_link_script CMakeFiles/lmscore.dir/link.txt --verbose=ON
  /opt/local/bin/clang++-mp-18 -pipe -I/opt/local/libexec/boost/1.81/include -Os -DNDEBUG -I/opt/local/libexec/boost/1.81/include -I/opt/local/include -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -mmacosx-version-min=13.0 -dynamiclib -Wl,-headerpad_max_install_names -L/opt/local/libexec/boost/1.81/lib -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -o liblmscore.dylib -install_name @rpath/liblmscore.dylib CMakeFiles/lmscore.dir/impl/http/Client.cpp.o CMakeFiles/lmscore.dir/impl/http/SendQueue.cpp.o CMakeFiles/lmscore.dir/impl/ArchiveZipper.cpp.o CMakeFiles/lmscore.dir/impl/ChildProcess.cpp.o CMakeFiles/lmscore.dir/impl/ChildProcessManager.cpp.o CMakeFiles/lmscore.dir/impl/Config.cpp.o CMakeFiles/lmscore.dir/impl/FileResourceHandler.cpp.o CMakeFiles/lmscore.dir/impl/IOContextRunner.cpp.o CMakeFiles/lmscore.dir/impl/Logger.cpp.o CMakeFiles/lmscore.dir/impl/NetAddress.cpp.o CMakeFiles/lmscore.dir/impl/Path.cpp.o CMakeFiles/lmscore.dir/impl/Random.cpp.o CMakeFiles/lmscore.dir/impl/RecursiveSharedMutex.cpp.o CMakeFiles/lmscore.dir/impl/StreamLogger.cpp.o CMakeFiles/lmscore.dir/impl/String.cpp.o CMakeFiles/lmscore.dir/impl/TraceLogger.cpp.o CMakeFiles/lmscore.dir/impl/UUID.cpp.o CMakeFiles/lmscore.dir/impl/WtLogger.cpp.o  -Wl,-rpath,/opt/local/lib /opt/local/libexec/boost/1.81/lib/libboost_system-mt.dylib /opt/local/lib/libwt.4.10.4.dylib /opt/local/lib/libconfig++.dylib /opt/local/lib/libarchive.dylib /opt/local/libexec/boost/1.81/lib/libboost_thread-mt.dylib /opt/local/libexec/boost/1.81/lib/libboost_chrono-mt.dylib /opt/local/libexec/boost/1.81/lib/libboost_atomic-mt.dylib /opt/local/libexec/boost/1.81/lib/libboost_filesystem-mt.dylib
  Undefined symbols for architecture x86_64:
    "std::exception_ptr::__from_native_exception_pointer(void*)", referenced from:
        std::exception_ptr std::make_exception_ptr[abi:ne180100]<boost::asio::multiple_exceptions>(boost::asio::multiple_exceptions) in SendQueue.cpp.o
        std::exception_ptr std::make_exception_ptr[abi:ne180100]<boost::asio::multiple_exceptions>(boost::asio::multiple_exceptions) in ChildProcess.cpp.o
    "___cxa_init_primary_exception", referenced from:
        std::exception_ptr std::make_exception_ptr[abi:ne180100]<boost::asio::multiple_exceptions>(boost::asio::multiple_exceptions) in SendQueue.cpp.o
        std::exception_ptr std::make_exception_ptr[abi:ne180100]<boost::asio::multiple_exceptions>(boost::asio::multiple_exceptions) in ChildProcess.cpp.o
  ld: symbol(s) not found for architecture x86_64
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  make[2]: *** [src/libs/core/liblmscore.dylib] Error 1

Both macOS 14 and macOS 12 CI pass normally.

Build log: https://github.com/macports/macports-ports/actions/runs/10869345322/job/30160418556

epoupon commented 2 months ago

Hmm looks like a header/linked lib mismatch for libc++ macOS 13 is using clang18? What about macOS 12/14?

barracuda156 commented 2 months ago

Hmm looks like a header/linked lib mismatch for libc++ macOS 13 is using clang18? What about macOS 12/14?

Ok, macOS 12 uses Clang 17.0.6 and macOS 14 uses AppleClang 15.0.0.15000309. For now, I can just disable using Clang 18, then it should fall back to Clang 17, and hopefully the build works.

But that is really a suboptimal solution.