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

Building babble from source fails linking because of libfmt #17

Open
virtualritz opened this issue Dec 19, 2024 · 6 comments
Open

Building babble from source fails linking because of libfmt #17

virtualritz opened this issue Dec 19, 2024 · 6 comments

Comments

@virtualritz
Copy link
Contributor

This is on Pop!_OS 22.04 LTS (Ubuntu-based).

I am building babble against llvm-17, build fails at the linking stage:

[ 42%] Linking CXX executable bbl-genbind
/usr/bin/ld: CMakeFiles/bbl-genbind.dir/src/bbl-genbind.cpp.o: in function `create_method_from_cmd(clang::CXXMethodDecl const*, bool, clang::CXXRecordDecl const*, clang::PrintingPolicy const&)':
bbl-genbind.cpp:(.text+0xd93): undefined reference to `fmt::v8::vformat[abi:cxx11](fmt::v8::basic_string_view<char>, fmt::v8::basic_format_args<fmt::v8::basic_format_context<fmt::v8::appender, char> >)'
/usr/bin/ld: CMakeFiles/bbl-genbind.dir/src/bbl-genbind.cpp.o: in function `create_constructor_from_ccd(clang::CXXConstructorDecl const*, clang::CXXRecordDecl const*, clang::PrintingPolicy const&)':
bbl-genbind.cpp:(.text+0x1048): undefined reference to `fmt::v8::vformat[abi:cxx11](fmt::v8::basic_string_view<char>, fmt::v8::basic_format_args<fmt::v8::basic_format_context<fmt::v8::appender, char> >)'
[...]

libfmt-dev (8.1.1) is installed as a dependency of the required libspdlog-dev.
Also tried building & installing libfmt manually but no luck.

@virtualritz virtualritz changed the title Buildin babbale from source fails linking because of libfmt Buildin babble from source fails linking because of libfmt Dec 19, 2024
@virtualritz virtualritz changed the title Buildin babble from source fails linking because of libfmt Building babble from source fails linking because of libfmt Dec 20, 2024
@anderslanglands
Copy link
Owner

Ugh this is one of those "I think I've seen this before but I can't remember what it was" ones...

Are you compilling with GLIBC_USE_CXX11_ABI=0 by any chance?

@virtualritz
Copy link
Contributor Author

Not that I know. This is just doing exactly what is written in the README but I omitted the -DCMAKE_PREFIX_PATH=<llvm_install_path> as I didn't need this on my own laptop on Ubuntu (24.10).

Maybe that is the culprit? I will retry on Monday when I have access to the Pop!OS machine again.

@anderslanglands
Copy link
Owner

Actually doing a bit of googling this might be because of how I'm building and using spdlog to get around cmake's insistence on installing all dependencies.

@anderslanglands
Copy link
Owner

OK I've just puhsed a potential fix. This does bump the minimum cmake version to 3.24 though so you'll likely need to install cmake manually or from the kitware ppa instead of relying on the os-provided version

@virtualritz
Copy link
Contributor Author

virtualritz commented Jan 8, 2025

After updating cmake to 3.25 I have another error on the Pop!OS machine now:

❯ cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE_FFI_CALL
-- Performing Test HAVE_FFI_CALL - Success
-- Found FFI: /usr/lib/x86_64-linux-gnu/libffi.so  
-- Could NOT find LibEdit (missing: LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES) 
-- Performing Test Terminfo_LINKABLE
-- Performing Test Terminfo_LINKABLE - Success
-- Found Terminfo: /usr/lib/x86_64-linux-gnu/libtinfo.so  
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Could NOT find zstd (missing: zstd_LIBRARY zstd_INCLUDE_DIR) 
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.13") 
-- Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR) 
-- Found LLVM 17.0.6: /usr/lib/llvm-17
-- Build spdlog: 1.12.0
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Build type: Release
-- Configuring done
CMake Error at bbl/CMakeLists.txt:55 (add_executable):
  Impossible to link target 'bbl-translate' because the link item 'spdlog',
  specified with the feature 'WHOLE_ARCHIVE', has already occurred without
  any feature or 'DEFAULT' feature, which is not allowed.


-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

@anderslanglands
Copy link
Owner

Hmm I'm stumped by this tbh. I just got github actions set up and everything builds and tests on ubuntu-22.04. Can you just use the generated build artifact from there? https://github.com/anderslanglands/babble/actions/runs/12847548725

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

No branches or pull requests

2 participants