Closed ray-adams closed 2 months ago
I can confirm that this also occurs in bcachefs-tools-1.9.0
Looks like a Gentoo issue I faced a while ago.
Could you try creating /etc/portage/env/sys-fs/bcachefs-tools
with the following contents:
RUSTFLAGS="${RUSTFLAGS} -Clink-arg=-lgcc"
I think the issue is that rustc
passes -nodefaultlibs
to the linker (clang+lld) which means "libgcc
" (or in clangs case compiler-rt
) containing the __cpu_model
isn't part of the final linker call.
Looks like a Gentoo issue I faced a while ago. Could you try creating
/etc/portage/env/sys-fs/bcachefs-tools
with the following contents:RUSTFLAGS="${RUSTFLAGS} -Clink-arg=-lgcc"
I think the issue is that
rustc
passes-nodefaultlibs
to the linker (clang+lld) which means "libgcc
" (or in clangs casecompiler-rt
) containing the__cpu_model
isn't part of the final linker call.
Thank you I have passed -C default-linker-libraries
, which I believe disables -nodefaultlibs
. This makes it compile on my system. Since my system is incompatible with gcc, I wouldn't be able to use -lgcc
, unless if I am misunderstanding what that flag does. I don't think -lcompiler-rt
is a valid flag.
Since my system is incompatible with gcc, I wouldn't be able to use -lgcc
Afaik clang resolves -lgcc
to whatever it was configured with at build time. You can check this via clang --print-libgcc-file-name
which should return some kind of libclang_rt.builtins-*.a
EDIT: well not build time but what is set as the default --rtlib
in /etc/clang
Since my system is incompatible with gcc, I wouldn't be able to use -lgcc
Afaik clang resolves
-lgcc
to whatever it was configured with at build time. You can check this viaclang --print-libgcc-file-name
which should return some kind oflibclang_rt.builtins-*.a
EDIT: well not build time but what is set as the default
--rtlib
in/etc/clang
Ah I see now is there a way to specify that directly? And second of all does using -C default-linker-libraries
achieve the same result?
Ah I see now is there a way to specify that directly?
If you want to override the default from /etc/clang
just pass the flag again e.g. clang --rtlib=compiler-rt
And second of all does using -C default-linker-libraries achieve the same result?
Not too sure there but I think it should be about the same
Trying to compile bcachefs-tools-1.7.0 results in a compile failure with undefined symbol error message.