[cfe-dev] Cross-compiling with Clang and LLD fails trying to call GCC

waddlesplash via cfe-dev cfe-dev at lists.llvm.org
Wed Aug 15 10:57:55 PDT 2018


Hi,

I'm one of the developers of the Haiku operating system [1]. Currently
we use GCC (7.3), however, there has been ongoing work by myself and a
few others to add support for building with Clang.

The Linux box I've been attempting this on does not have any GCC
installed at all, neither Ubuntu's GCC nor our cross-tools GCC. But
when I get to the first link that uses Clang instead of LLD directly
(most kernel-related things invoke the linker directly), this happens:

clang: error: unable to execute command: Executable "gcc" doesn't exist!
clang: error: linker (via gcc) command failed with exit code 1 (use -v
to see invocation)

The full invocation and output of clang -v can be seen at [2], along
with a list of all the linkers in /usr/bin.

As you can see, we're not using --gcc-toolchain in invoking Clang, but
instead are using -nostdlib and adding the glue code and standard
libraries to the invocation manually (we do the same when using
cross-GCC), as well as -fuse-ld=lld; so there really isn't any reason
Clang should be trying to call GCC here, as far as I can tell.

The same thing occurs on a "true" cross-compile, i.e. x86_64->ARM, so
this isn't arch-specific.

-waddlesplash

[1]: https://www.haiku-os.org
[2]: https://gist.github.com/waddlesplash/6c502351f2b0b5d3e7ac1d07a677b9fb



More information about the cfe-dev mailing list