-
-
Notifications
You must be signed in to change notification settings - Fork 170
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
c3c compilation fails on Fedora 38 #779
Comments
This looks like you don't have the lld libraries, can you get those as well? |
@lerno I have the following libraries installed: $ dnf list installed | grep ^lld
lld.x86_64 16.0.5-1.fc38 @updates
lld-devel.x86_64 16.0.5-1.fc38 @updates
lld-libs.x86_64 16.0.5-1.fc38 @updates
lldb.x86_64 16.0.5-1.fc38 @updates
lldb-devel.x86_64 16.0.5-1.fc38 @updates
lldpad.x86_64 1.1.0-7.git85e5583.fc38 @fedora
lldpad-devel.x86_64 1.1.0-7.git85e5583.fc38 @fedora $ dnf list installed | grep ^zlib
zlib.i686 1.2.13-3.fc38 @fedora
zlib.x86_64 1.2.13-3.fc38 @fedora
zlib-devel.x86_64 1.2.13-3.fc38 @fedora $ dnf list installed | grep ^llvm
llvm.x86_64 16.0.5-1.fc38 @updates
llvm-bolt.x86_64 16.0.5-1.fc38 @updates
llvm-devel.x86_64 16.0.5-1.fc38 @updates
llvm-libs.x86_64 16.0.5-1.fc38 @updates
llvm-libunwind.x86_64 16.0.5-1.fc38 @updates
llvm-libunwind-devel.x86_64 16.0.5-1.fc38 @updates
llvm-libunwind-static.x86_64 16.0.5-1.fc38 @updates
llvm-static.x86_64 16.0.5-1.fc38 @updates
llvm-test.x86_64 16.0.5-1.fc38 @updates |
Can you try changing this part of CMakeLists.txt:
To
To see if LLD can be found. |
Still the same issue (although the logs have changed slightly) @lerno $ cmake ..
-- The C compiler identification is GNU 13.1.1
-- The CXX compiler identification is GNU 13.1.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/lib64/ccache/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/lib64/ccache/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
C3C version: 0.4.527
-- Found CURL: /usr/lib64/libcurl.so (found version "8.0.1")
-- Performing Test HAVE_FFI_CALL
-- Performing Test HAVE_FFI_CALL - Success
-- Found FFI: /usr/lib64/libffi.so
-- Performing Test Terminfo_LINKABLE
-- Performing Test Terminfo_LINKABLE - Success
-- Found Terminfo: /usr/lib64/libtinfo.so
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.13")
-- Found LLVM 16.0.5
-- Using LLVMConfig.cmake in: /usr/lib64/cmake/llvm
-- Libraries located in: /usr/lib64
-- using find_library
-- linking to llvm libs LLD_COFF-NOTFOUND;LLD_COMMON-NOTFOUND;LLD_WASM-NOTFOUND;LLD_MINGW-NOTFOUND;LLD_ELF-NOTFOUND;LLD_MACHO-NOTFOUND
-- Found lld libs LLD_COFF-NOTFOUND;LLD_COMMON-NOTFOUND;LLD_WASM-NOTFOUND;LLD_MINGW-NOTFOUND;LLD_ELF-NOTFOUND;LLD_MACHO-NOTFOUND
-- using gcc/clang warning switches
-- The following OPTIONAL packages have been found:
* CURL
* FFI
* Terminfo
* ZLIB
-- The following REQUIRED packages have been found:
* LLVM (required version == 16.0.5)
* LLD
-- Configuring done (0.8s)
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
LLD_COFF
linked by target "c3c" in directory /home/<user>/Projects/c3c
linked by target "c3c_wrappers" in directory /home/<user>/Projects/c3c
LLD_COMMON
linked by target "c3c" in directory /home/<user>/Projects/c3c
linked by target "c3c_wrappers" in directory /home/<user>/Projects/c3c
LLD_ELF
linked by target "c3c" in directory /home/<user>/Projects/c3c
linked by target "c3c_wrappers" in directory /home/<user>/Projects/c3c
LLD_MACHO
linked by target "c3c" in directory /home/<user>/Projects/c3c
linked by target "c3c_wrappers" in directory /home/<user>/Projects/c3c
LLD_MINGW
linked by target "c3c" in directory /home/<user>/Projects/c3c
linked by target "c3c_wrappers" in directory /home/<user>/Projects/c3c
LLD_WASM
linked by target "c3c" in directory /home/<user>/Projects/c3c
linked by target "c3c_wrappers" in directory /home/<user>/Projects/c3c
-- Generating done (0.0s)
CMake Generate step failed. Build files cannot be regenerated correctly.
|
Ok I figured it out. The lld libraries are all .so. While there is llvm-static, no one bothered making a corresponding package for lld apparently? Since c3c links lld statically that's a big problem and it won't compile unless you either compile lld libraries by hand or if you find some package that does it for you. |
Eventually I expect to build LLVM libraries using CI on all platforms – it's just too much pain waiting for various packages to get fixed. |
Here's what I found about static libraries in Fedora - https://docs.fedoraproject.org/en-US/packaging-guidelines/#packaging-static-libraries - looks like the maintainers are told to avoid it's usage as much as they can. Is there any cons to using shared library, as opposed to static library? |
Well the consequences are the c3 compiler can't be passed around as a stand alone binary and it becomes dependent on the right version of the packages being available. They clearly see the problem with LLVM, which is why the LLVM package provides a static version, but the LLD library doesn't. |
You could try this. In the CMakeLists.txt, there are the following lines:
Here, you can try to append the dynamic names for all, so for example:
You should be able to look at the LLD package and see what the library names are. Do it for all of the LLD libraries. It might compile after that. If so, then we could update the CMake script with that. |
Here's what I've added:
Perhaps adding
However, on execution, I get this:
|
"RISCVTargetParserTableGen.dir" is definitely wrong. I don't know why it's there. But adding to the headache what probably happens here is that LLVM is linked statically than LLD is linked dynamically and they share data. :( I think the best way here would probably to build LLVM and LLD statically in CI for Fedora using docker rather than adding more support for using LLVM as a dynamic library. If you're good at CMake you can probably find some way for the LLVM to get included dynamically, but as I am not running on Fedora in the first place, and I'm trying to interact with LLVMs CMake files as little as possible, I unfortunately can't be more helpful. |
Hey there, I'm on Fedora 38 as well and having (had) the same problem. In addition to adding the from
to
No core dump or duplicate symbols, seems to run hello world successfully:
I'm no expert in cmake or LLVM, but I hope that helps! |
Still on this, would it be useful to provide a cmake option to make it link dynamically instead of statically? |
It would be awesome @Wiguwbe |
Hey @Ashvith10 , try to run cmake with |
@Wiguwbe thank you for the ping. Around July, I've moved over to NixOS. I'll try making a expression and see if it works. But what I'm worried about is that I'm not aware of any ways to bootstrap a compiler in Nix. Might have to ask a senior package maintainer. |
@Ashvith10 , you can try my PR here, which brings release 0.5.0 to nixos: There are two things happening:
What I do is set an option in CMakeLists for the LLD_LIB_PATHS, and then use that alongside LLVM_LIB_PATH when doing find_library for the lld libs. |
@SMFloris so if I want to add something to this project, do I have to point the source locally? As in: {, , ,}:
{
src=./c3c
} while also simultaneously taking care of the patch? I'd assume that a flakes-based approach would be better for dev shell, right? |
You can use fetchFromGit instead of fetchFromGithub and use a local path with branch. Then you would rebuild like so:
A flake based approach would work almost in the same exact manner, minus the overhead of having the whole nixpkgs repo; the goal for me is to have c3c for everyone using nixos in the most "native" way possible so nixpkgs is the way to do it. |
By the way, fedora has the |
Quick note if someone is still having trouble with compiling in fedora with dynamic linking, the argument |
Here's the log:
The text was updated successfully, but these errors were encountered: