Open commitcompanion opened 1 month ago
Hello!
Did you build and source the cross compilation toolchain? https://github.com/maestro-os/blimp/blob/master/cross/README.md It should provide you with i686-elf-ld
Also I realize the README is a bit out of date. I will update it
Hello!
Is it cross compilation if the build system is amd64 based and the target i686?
So far, with the compiled libraries and build tools and every (hopefully every) environment variable set, it compiles further. There is still a problem:
problem.txt
it seems that there is a last forgotten thing, or it is an error.
Here is a short printout of all relevant build variables used:
CC=clang LD=ld.lld CFLAGS=-target i686-unknown-linux-musl --sysroot /home/dev/workbench/blimp/cross/toolchain --ld-path=ld.lld --rtlib=compiler-rt -Wno-unused-command-line-argument -static LDFLAGS=-target i686-unknown-linux-musl --sysroot /home/dev/workbench/blimp/cross/toolchain --ld-path=ld.lld --rtlib=compiler-rt -Wno-unused-command-line-argument -static RUSTFLAGS=-L/home/dev/workbench/blimp/cross/toolchain/usr/lib -L/home/dev/workbench/blimp/cross/toolchain/lib -Clinker=ld.lld LOCAL_REPO=local_repo/ TARGET=i686-unknown-linux-musl
How to build further?
Many Thanks!
Is it cross compilation if the build system is amd64 based and the target i686?
Yes it is. That's because the system currently supports only 32 bits executables, compiled with the musl C library (maybe other C libraries work but they have not been tested. glibc definitely doesn't work yet)
The cross compilation toolchain will compile for musl
So far, with the compiled libraries and build tools and every (hopefully every) environment variable set, it compiles further. There is still a problem
Okay so there seem to be an issue with the script that creates the cross compilation environment. The kernel cannot be built with ld.lld
(yet)
Maybe you can try to remove --ld-path=ld.lld
(and maybe --rtlib=compiler-rt
) from the environment just to compile maestro-build
, then put them back for the remaining packages.
edit: or even more simple, just remove all the environment variables, but make sure i686-elf-ld
is in the PATH
. You can then put back the environment for the next packages
Okay.
i686-elf-ld is the linker and ld.ldd is a script. Correct?
If there is no environment variable with the path of lld.ld it can't be used from i686-elf-ld?
For some reason, there is no i686-elf-ld in the entire build folder. There is at least a .cast file, but it looks like this is a script too.
with only the path where the i686-elf-ld should be it does not compile:
ls toolchain/usr/bin ✔ i686-unknown-linux-musl-addr2line i686-unknown-linux-musl-gp-archive i686-unknown-linux-musl-gprof i686-unknown-linux-musl-objcopy i686-unknown-linux-musl-strings i686-unknown-linux-musl-ar i686-unknown-linux-musl-gp-collect-app i686-unknown-linux-musl-gprofng i686-unknown-linux-musl-objdump i686-unknown-linux-musl-strip i686-unknown-linux-musl-as i686-unknown-linux-musl-gp-display-html i686-unknown-linux-musl-ld i686-unknown-linux-musl-ranlib ld.musl-clang i686-unknown-linux-musl-c++filt i686-unknown-linux-musl-gp-display-src i686-unknown-linux-musl-ld.bfd i686-unknown-linux-musl-readelf musl-clang i686-unknown-linux-musl-elfedit i686-unknown-linux-musl-gp-display-text i686-unknown-linux-musl-nm i686-unknown-linux-musl-size
ls bin ✔ amdgpu-arch clang-linker-wrapper intercept-build llvm-cat llvm-diff llvm-lib llvm-objcopy llvm-reduce llvm-undname analyze-build clang-offload-bundler ld64.lld llvm-cfi-verify llvm-dis llvm-libtool-darwin llvm-objdump llvm-remarkutil llvm-windres bugpoint clang-offload-packager ld.lld llvm-config llvm-dlltool llvm-link llvm-opt-report llvm-rtdyld llvm-xray c-index-test clang-refactor llc llvm-cov llvm-dwarfdump llvm-lipo llvm-otool llvm-sim nvptx-arch clang clang-rename lld llvm-c-test llvm-dwarfutil llvm-lto llvm-pdbutil llvm-size opt clang++ clang-repl lld-link llvm-cvtres llvm-dwp llvm-lto2 llvm-profdata llvm-split sancov clang-18 clang-scan-deps lli llvm-cxxdump llvm-exegesis llvm-mc llvm-profgen llvm-stress sanstats clang-check clang-tblgen llvm-addr2line llvm-cxxfilt llvm-extract llvm-mca llvm-ranlib llvm-strings scan-build clang-cl diagtool llvm-ar llvm-cxxmap llvm-gsymutil llvm-ml llvm-rc llvm-strip scan-build-py clang-cpp dsymutil llvm-as llvm-debuginfo-analyzer llvm-ifs llvm-modextract llvm-readelf llvm-symbolizer scan-view clang-extdef-mapping git-clang-format llvm-bcanalyzer llvm-debuginfod llvm-install-name-tool llvm-mt llvm-readobj llvm-tblgen verify-uselistorder clang-format hmaptool llvm-bitcode-strip llvm-debuginfod-find llvm-jitlink llvm-nm llvm-readtapi llvm-tli-checker wasm-ld
https://stackoverflow.com/questions/23961916/how-to-setup-i686-elf-cross-compiler-on-linux
Many Thanks!
i686-elf-ld is the linker and ld.ldd is a script. Correct?
i686-elf-ld
is indeed the linker (the one from GNU). However ld.lld
is also a linker (the one from LLVM). Currently, the kernel can only be linked with the one from GNU
For some reason, there is no i686-elf-ld in the entire build folder.
I just re-checked and indeed, it is not present. Maybe you'll need to build it yourself, or install it if the package manager of your Linux distribution provides it.
If you want to build it you may just download binutils
and use the following commands:
./configure \
--prefix=/usr \
--target="i686-elf" \
--disable-werror \
--disable-doc \
--enable-64-bit-bfd
make
The project is a bit of a mess right now, I apologize for the inconvenience.
Is it cross compilation if the build system is amd64 based and the target i686?
Yes it is. That's because the system currently supports only 32 bits executables, compiled with the musl C library (maybe other C libraries work but they have not been tested. glibc definitely doesn't work yet)
The cross compilation toolchain will compile for musl
So far, with the compiled libraries and build tools and every (hopefully every) environment variable set, it compiles further. There is still a problem
Okay so there seem to be an issue with the script that creates the cross compilation environment. The kernel cannot be built with
ld.lld
(yet)Maybe you can try to remove
--ld-path=ld.lld
(and maybe--rtlib=compiler-rt
) from the environment just to compilemaestro-build
, then put them back for the remaining packages.edit: or even more simple, just remove all the environment variables, but make sure
i686-elf-ld
is in thePATH
. You can then put back the environment for the next packages
Hi, I met a similar problem here: when I run the build.sh
in blimp/cross/build.sh
to build musl
, it shows the following error:
clang: error: invalid linker name in argument '--ld-path=ld.lld'
make: *** [Makefile:162: lib/libc.so] Error 1
make: *** Waiting for unfinished jobs....
i686-unknown-linux-musl-ranlib lib/libc.a
blimp-builder: error: Package build failed!
How to remove --ld-path=ld.lld
here?
I have i686-elf-ld
in my docker container:
$ whereis i686-elf-ld
i686-elf-ld: /root/maestro/i686/bin/i686-elf-ld
Thank you for any reply!
Besides, the original script fails with ./build.sh: 21: source: not found
, and I change #!/bin/sh
to #!/bin/bash
I tried to change export LD="ld.lld"
to export LD="i686-elf-ld"
in env.sh
and get the following error:
/root/maestro/i686/bin/i686-elf-ld: cannot find -lgcc: No such file or directory
/root/maestro/i686/bin/i686-elf-ld: cannot find -lgcc_eh: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:162: lib/libc.so] Error 1
make: *** Waiting for unfinished jobs....
i686-unknown-linux-musl-ranlib lib/libc.a
blimp-builder: error: Package build failed!
Hello @Marsman1996,
The --ld-path=ld.lld
argument comes from env.sh
.
You should use env.sh
only after running build.sh
, which builds the programs needed for env.sh
Hi @llenotre,
Thank you for your quick reply here.
But I'm kinda confused, I will open a new issue in blimp
repo.
Hello! After installing the build tools (blimp), (consider adding blimp-build and blimp-server to install.sh) and exporting the env variable and during the network off, there was a not found liker:
Compiling alloc v0.0.0 (/home/dev/.rustup/toolchains/nightly-2024-09-18-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc) Compiling utils v0.1.0 (/home/dev/workbench/work/qgqL8CmvGKObR2aJ/utils) error: linker
i686-elf-ld
not found | = note: No such file or directory (os error 2)error: could not compile
maestro
(lib) due to 1 previous error blimp-builder: error: Package build failed!How to fix it?