Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS issue building with cmake (ld: library not found for -ld_classic) #2520

Open
yusefmian opened this issue Dec 7, 2024 · 2 comments
Open

Comments

@yusefmian
Copy link

yusefmian commented Dec 7, 2024

Hi, I've installed all dependencies properly and configured paths properly. I'm building from source, not with brew. Started running into an error on my machine


[ 65%] Linking CXX executable souffle
ld: library not found for -ld_classic
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [src/CMakeFiles/souffle.dir/build.make:105: src/souffle] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1750: src/CMakeFiles/souffle.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

in more detail with the -v flag, this expanded out to

cd ~/souffle/build/src && /opt/homebrew/bin/cmake -E cmake_link_script CMakeFiles/souffle.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/c++ -O3  -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Wl,-ld_classic -ld_classic CMakeFiles/souffle.dir/souffle.cpp.o -o souffle  libsouffle.a /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/lib/libffi.tbd /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/lib/libncurses.tbd /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/lib/libz.tbd /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/lib/libsqlite3.tbd
ld: library not found for -ld_classic

looks like the -ld_classic flag is the cause of the error, found the following code in src/CMakeLists.txt at

  if ("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64")
    # work around a known issue with xcode15 linker
    # c++ exceptions handling is broken otherwise
    set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,-ld_classic")
    target_link_options(libsouffle PUBLIC "-ld_classic")
    target_link_options(compiled PUBLIC "-ld_classic")
    target_link_options(souffleprof PUBLIC "-ld_classic")
  endif()

commenting out all of these lines in this file worked for me and I'm successfully compiling souffle, just wanted to throw this solution there in case anyone else encounters this problem. Caveat is that I'm not on xcode15, so it should be safe to get rid of these lines according to the comment above

@quentin
Copy link
Member

quentin commented Dec 7, 2024

Hi, thanks for reporting this solution, that might be useful to other users. Can you be more specific about the version of OSX and Xcode that you use?

We have very limited resources to test xcode/osx versions, and we can only guarantee a successful build in the conditions of the github runners.

@yusefmian
Copy link
Author

yusefmian commented Dec 9, 2024

Hi, thanks for reporting this solution, that might be useful to other users. Can you be more specific about the version of OSX and Xcode that you use?

We have very limited resources to test xcode/osx versions, and we can only guarantee a successful build in the conditions of the github runners.

Sure thing, hope it can help someone. I'm on an apple-silicon equipped Mac running Big Sur 11.5.2 with CommandLineTools (xcode) 12.5.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants