Problem with cross compiling Gold linker

Cary Coutant
Fri Nov 21 21:16:00 GMT 2014

First of all, I'd suggest working from more recent sources.
Binutils-2.23 is fairly old now.

Gold's configure script looks for available implementations of
std::unordered_map or std::tr1::unordered_map before it settles on
using __gnu_cxx::hash_map (from ext/hash_map). If you're getting
deprecation warnings from ext/hash_map, then it should have found one
of the others to use instead. Check your config.log to see why those
configure checks failed.

The struct iovec problem shouldn't be happening if your runtime
defines readv(). Check your config.log to see why HAVE_READV didn't
get defined. (I don't remember the timing of binutils-2.23, but there
was a bug related to HAVE_READV that was fixed in 2010.)


On Fri, Nov 21, 2014 at 1:18 AM, Lei Wang <> wrote:
> Hi. I’m tring to run Gold on ARM-based board. So I have to cross compile gold linker on x86 platform first. The toolchain I used is arm-linux-gnueabi-gcc/g++ 4.8.3 and the version of gold I was compiling is 2.23 (the version of gold is 0.1).
> The first configuration I tried is:
> ./gold/configure --host=arm-linux-gnueabihf CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-g++
> and the result of make shows a lot of warnings on using deprecated header files, such as:
> In file included from gcc-4.8.3/arm-linux-gnueabi/arm-linux-gnueabi/include/c++/4.8.3/ext/hash_map
>                         from gold/gold.h:85
>                         from gold/
> /gcc-4.8.3/arm-linux-gnueabi/arm-linux-gnueabi/include/c++/4.8.3/backward/backward_warning.h:32.:2 error: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. …
> so I tried the second configuration:
> ./gold/configure --disable-werror --host=arm-linux-gnueabihf CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-g++
> And the warning won’t terminate the compilation, but I got:
> gold/ eror: redefinition of ‘struct iovec’
> In file included from gcc-4.8.3/arm-linux-gnueabi/arm-linux-gnueabi/include/bits/fcntl.h:26:0
>                         from gcc-4.8.3/arm-linux-gnueabi/arm-linux-gnueabi/include/fcntl.h:32
>                         from gold/
> gcc-4.8.3/arm-linux-gnueabi/arm-linux-gnueabi/include/bits/uio.h:43:8: error: previous definition of ‘struct iovec’
> And I searched this problem online and tried the solution to add -DHAVE_SYS_UIO_H into CXXFLAGS:
> ./gold/configure --disable-werror --host=arm-linux-gnueabihf CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-g++ CXXFLAGS=“-DHAVE_SYS_UIO_H”
> But it doesn’t work. I can’t find any guides on building gold linker online, so would anyone kindly help me with this? thanks.
> Lei

More information about the Binutils mailing list