-
Notifications
You must be signed in to change notification settings - Fork 20
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
Possible Wrong Search Path for C Runtime objects #32
Comments
I have a version about this behaviour. LLVM has some specific code for GNU/Linux-Unix targets, and this specific code has conditional code that selects GCC pathes for Libc *crt[1in].o. This code (it is just my guess) should be in $LLVMSRC/tools/ld directory. But this part of code is very big. Maybe somehow, you can set the easiest way for this pathes - by modifying the code or setting options for cmake - anyway, you should find info about making of cross-compiler from clang/llvm (Something like how to make cross-compiler for your new unix-like OS from osdev.org for gcc, but for clang/llvm). |
Looks like patching For example, I patched the clang source to change the linux loader path from
I'll see if this is still valid for stage2 clang, the compiler for the final system |
@andzai1995, thanks to your comment, I actually ran a
I looked at all the cmake options with |
@dslm4515, Well, source need to be patched means source need to be patched. What about chroot/grub? |
I haven't forgotten. The change from LLVM-12 to LLVM-15.x.x was huge. I couldn't build llvmtools with LLVM 13/14. I decided to take a break. LLVM takes hours to compile on a i5 3750 with 4 CPU cores. It really pissed me off to wait for hours, only to realize the build failed or something broke. Then a month ago I returned to working on CMLFS. Decided to use LLVM 15. Its only now I got llvmtools fixed with a known working stage1 clang. I am right now building the final system, so I will eventually get to GRUB and test out your build recipe! |
I'm building on a new machine with a Ryzen 5 5600x. LLVM source now builds take ~ 20 minutes. So now the failures don't hurt as much as on the i5 |
I had successfully built CMLFS with LLVM 14, to do this was necessary to disable ORC subsystem. |
Wow! Perhaps, share and I can add your work on the LLVM-14.x.x branch.
I ended up looking up the build targets so I can see which one fails and build it first. For example, I had LLVM fail at building LLD. So I can sometimes skip the LLVM runtimes and LLVM libraries to build LLD sooner with But the patching for changing the dynamic loader fixed a lot of issues like building CMake required a compiler with C++11 support or when building the stage1 clang, compiler needed atomics. Hence, the extra tests I added to avoid using a broken compiler. Or forcing stage1 to find the libc++ headers in /llvmtools/include/c++/v1 My next hurdle at the moment is building LLVM for the final system. |
When Clang(llvm) is built under chroot and tested, LLD searches for the C Runtime objects in this directory:
Which resolves to
/usr/lib/*crt[1in].o
Once GCC is built under chroot after or before LLVM, LLD now searches for C runtime objects in:
Which resolves to
/usr/lib/*crt[1in].o
Why does the search path change (even though both paths point to the same directory)?
And, can it be set to just
/usr/lib
?The text was updated successfully, but these errors were encountered: