-
Notifications
You must be signed in to change notification settings - Fork 183
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
ld.bfd ld.gold missing and build_binutils problem #249
Comments
What is your invocation of Your |
thanks for your prompt reply no error but i didn't look at the log file first i built it with no luck, so i tried to use -p option
but still no bfd or gold files |
Oh, I misunderstood your issue from the original post. The reason you don't have https://git.kernel.org/linus/75959d44f9dc8e44410667009724e4e238515502 If you want/need it for other reasons, add |
ok. now i know where to make the changes. thanks i edited tc_build/binutils.py and addded --enable-gold as below then i executed it again with but this time i got segmentation fault note: it uses ubuntu system cc & ld. does it matter? or do i have to remove -s optiom and re-download the files? `== Checking CC and LD ==CC: /usr/lib/llvm-17/bin/clang ` |
What is your end goal here? Again, The segmentation fault could be an upstream problem or due to a lack of memory since you are using ThinLTO. |
i want to build a clang coz all existing pre-builts didnt work for me, but i need bfd and gold so, perhaps i misread your reply or you were talking about fixing the binutils problem? |
Okay so you'll need to run both scripts in that case. For what it's worth, LTO does very little for runtime performance and you pay a relatively significant build time cost for it (I am in the process of collecting benchmarks right now that I'll publish later). You'd be better off switching it out for Alternatively, I host prebuilt LLVM toolchains (built using
Yes, that was the (potential) solution to
and this
was the solution to
from your original post. Hope all that helps! |
ok. so what about the --enable-gold option? where should it put it? |
diff --git a/tc_build/binutils.py b/tc_build/binutils.py
index 09eb98c..d28013f 100644
--- a/tc_build/binutils.py
+++ b/tc_build/binutils.py
@@ -21,6 +21,7 @@ class BinutilsBuilder(Builder):
'--disable-nls',
'--disable-werror',
'--enable-deterministic-archives',
+ '--enable-gold',
'--enable-new-dtags',
'--enable-plugins',
'--enable-threads', |
ok thanks a lot. i will try again and your prebuilt |
oh sorry, 1 more thing |
I am not sure I fully understand the question. The prebuilt is only LLVM/ Perhaps showing your kernel build command would be helpful, along with your kernel source, so I know how to alter it for this toolchain. |
hmm, i think it's due to my misunderstanding. usually those prebuilts like google or NeutronClang, under the bin dir i can find the followings (sorry for posting screen capture but it's a long listing) https://tmpfiles.org/dl/3120119/screenshot_20231109_020032_termius.jpg and the dir structue looks like this so it's not your problem but mine. i want to build one with clang and llvm (or what it should called) with those files under bin looks like the image above. i have googled but i still not very clear about them and thus i call it clang in general like others do and for the kernel build command, i managed to compile the kernel with third party prebuilts (but didnt boot up) so it's fine. except the google android one, even i provided the env CLANG_TRIPLE it will prompt an error that CLANG_TRIPLE is not needed, but if i remove this env, it asks me for the triple with the below .... ` export PATH=$CLANG_HOME/bin:$PATH make API=30 CC=clang CROSS_COMPILE=aarch64-linux-android$API- CROSS_COMPILE_ARM32=armv7a-linux-androideabi$API- CROSS_COMPILE_COMPAT=armv7a-linux-androideabi$API- LLVM=1 CLANG_TRIPLE1=aarch64-linux-android$API- ARCH=arm64 AR=llvm-ar NM=llvm-nm OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump STRIP=llvm-strip CLANG_FLAGS="--target=aarch64" LLVM_IAS=1 |
Okay, yeah, that's the disconnect :) The The prebuilts on kernel.org only provide LLVM, as our project is focused on using LLVM exclusively to build the kernel. On some older kernel releases, such as some that Android uses, you have to mix and match the two sets of tools (due to various bugs and incompatibilities that we fixed along the way), hence why those other prebuilts choose to package both in one tarball/repo. So you can extract the LLVM prebuilt from kernel.org (let's say you extracted it to Hope that helps clear some things up! |
absolutely let me try again thanks a lot man |
hi just wanna tell you, as what i expected and what you said, the built is succeed finally and seems i can see all the files i wanted. big thanks and if you have any info about the google clang problem i mentioned pls let me know, coz those who have built the kernel successfully were using google's i will keep this issue as open for 1 or 2 days as to try to build my kernel. if everything is fine, i will close it thanks for your time and help once again |
What version of AOSP LLVM were you using and what was the exact error that you got? You may need to scroll back in your build logs depending on when the error occurs. |
sorry for late reply since i have to try your clang (it works but the kernel still wont boot) and prepare previous env for the errors i had problems when compiling vdso with some pre-built clangs as well as google's. there are 2 different errors which i believe it's the linker problem or something is missing problem 1: error: problem 2 (ignore the llvm17 path for now): the above error occured with ubuntu repo's clang as well as certain pre-builts i couldn't fix neither of them so i switched to other builds and found some of them worked, including the one built with your script in case it could be time consuming then just leave it coz i don wanna waste your time thanks |
This command is not correct because you are passing
A few notes/questions about that command:
|
that's the default command on github, with some changes like LLVM=1 for changes in Makefiles by the developer oh, yeah, i was wrong to place API there, it's my fault. for the CLANG_TRIPLE, i was wondering why it asked me for the triple if i didnt supply it with error however, when i followed your command and tried to build it again with google's, the same error occured so, may be just leave it for now edit |
alright. it's the build script problem that led to unbootable kernel. so it should be fine with your tc-build scripts. thanks again for your explanations, time etc. you may close this of you dont have any comments or suggestions thanks a lot |
No problem, glad you were able to get it sorted out! |
hi
i tried to build clanv last nite. i followed your building instrutions to build it but i couldn't find the ld.gold nor ld.bfd files. i built without the -p option which i believed bfd and gold files would be created. did i miss something?
in this post #231 you mentioned --enable-gold option. where should i put this option?
also i tried to run build_binutils.py but it returned errors as below. do i need to run it separately after building llvm?
/build-binutils.py -i /tmp/binutils -m ARCH -t arm aarch64
configure: error: in
/tmp/tc-build/build/binutils/aarch64':configure: error: C compiler cannot create executables
See
config.log' for more details Traceback (most recent call last): File "./build-binutils.py", line 125, in <module> builder.build() File "/tmp/tc-build/tc_build/binutils.py", line 63, in build self.run_cmd(configure_cmd, cwd=self.folders.build) File "/tmp/tc-build/tc_build/builder.py", line 39, in run_cmd return subprocess.run(cmd, capture_output=capture_output, check=True, cwd=cwd) File "/usr/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '[PosixPath('/tmp/tc-build/src/binutils-2.41/configure'), '--disable-compressed-debug-sections', '--disable-gdb', '--disable-nls', '--disable-werror', '--enable-deterministic-archives', '--enable-new-dtags', '--enable-plugins', '--enable-threads', '--quiet', '--with-system-zlib', '--disable-multilib', '--with-gnu-as', '--with-gnu-ld', '--prefix=/cache/binutils', '--program-prefix=aarch64-linux-gnu-', '--target=aarch64-linux-gnu', 'CC=gcc', 'CXX=g++', 'CFLAGS=-O2 -march=ARCH -mtune=ARCH', 'CXXFLAGS=-O2 -march=ARCH -mtune=ARCH']' returned non-zero exit status 77.
i am on ubuntu 20.04
thanks
The text was updated successfully, but these errors were encountered: