On Wed, Apr 15, 2015 at 9:51 AM, Kevin Petit Kevin.Petit@arm.com wrote:
It seems none of the built-in library search paths (gcc –print-search-dirs) allow to find crt[1i].o. They seem to be expected in a multiarch location but aren’t (libc/usr/lib64). We’re working around this with a symlink. Is this a bug? Have you seen similar issues?
I downloaded a toolchain from this page. https://www.linaro.org/downloads/
It works fine for a simple example. I don't see anything in the option list that would cause a problem. Busybox could perhaps be setting environment variables to change compiler behaviour, that can cause problems, but it is rare that people set gcc environment variables. That isn't obvious from the bug report. I haven't built busybox in a long time, so I don't know if it is doing anything unusual offhand.
You can debug this yourself a bit by adding a -v option to see the linker option that gcc is running. This should contain explicit paths to the crt1.o and crti.o files. You can check to see if the paths are correct and the files exist. If there environment variables set, they should be in the -v output.
You can also add -Wl,--verbose to get verbose info from the linker. This will show you the linker built-in paths, and what files the linker is trying to open. For my simple testcase I see
attempt to open /home/wilson/Downloads/gcc-linaro-4.9-2014.11-x86_64_aarch64-linux-gnu/bin/../libc/usr/lib/../lib64/crt1.o succeeded /home/wilson/Downloads/gcc-linaro-4.9-2014.11-x86_64_aarch64-linux-gnu/bin/../libc/usr/lib/../lib64/crt1.o attempt to open /home/wilson/Downloads/gcc-linaro-4.9-2014.11-x86_64_aarch64-linux-gnu/bin/../libc/usr/lib/../lib64/crti.o succeeded /home/wilson/Downloads/gcc-linaro-4.9-2014.11-x86_64_aarch64-linux-gnu/bin/../libc/usr/lib/../lib64/crti.o
In the gcc --print-search-dirs output, at the end, I see
/home/wilson/Downloads/gcc-linaro-4.9-2014.11-x86_64_aarch64-linux-gnu/bin/../libc/lib/:/home/wilson/Downloads/gcc-linaro-4.9-2014.11-x86_64_aarch64-linux-gnu/bin/../libc/usr/lib/
These are the paths used to find the 64-bit libraries, which are just ../lib64 from the 32-bit libraries.
Jim