lowrisc-toolchains icon indicating copy to clipboard operation
lowrisc-toolchains copied to clipboard

Build static GNU toolchain

Open luismarques opened this issue 2 years ago • 3 comments

luismarques avatar Jan 11 '24 11:01 luismarques

I coincidentally just tried the same thing locally!

I think the binaries still dynamically link to libc:

[jw bin]$ ldd riscv32-unknown-elf-gcc
	linux-vdso.so.1 (0x00007fff99ac0000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f75a8e00000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f75a91b7000)

jwnrt avatar Jan 11 '24 11:01 jwnrt

I think the binaries still dynamically link to libc:

[jw bin]$ ldd riscv32-unknown-elf-gcc
	linux-vdso.so.1 (0x00007fff99ac0000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f75a8e00000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f75a91b7000)

Are you sure you tried for the right archive? I do see static executables.

(I downloaded the rv32imcb-toolchains.zip with a sha256 of 3a4ce3967dbdb3758fa02b0934298ec98fe92af729ebeefe8c0caccf63e5c5a7).

luismarques avatar Jan 11 '24 13:01 luismarques

Ok, perhaps I'm wrong. This is the diff I used:

--- a/lowrisc-toolchain-gcc-rv32imcb.config
+++ b/lowrisc-toolchain-gcc-rv32imcb.config
@@ -34,6 +34,8 @@ CT_TOOLCHAIN_BUGURL="[email protected]"
 CT_DOWNLOAD_AGENT_CURL=y
 
 CT_CC_GCC_STATIC_LIBSTDCXX=y
+CT_STATIC_TOOLCHAIN=y
+CT_GDB_CROSS_STATIC=y
 # CT_CC_GCC_LDBL_128 is not set
 CT_CC_LANG_CXX=y
 CT_GCC_V_9=y

And the executable I checked was at gcc/.build/riscv32-unknown-elf/buildtools/bin/riscv32-unknown-elf-gcc.

jwnrt avatar Jan 11 '24 14:01 jwnrt