Page 1 of 1

binutils Compile Error

Posted: Sun Nov 25, 2012 12:57 pm
by Geometrian
Hi,

I'm trying to get a cross-compiler working on a Windows 7 host with Cygwin.

I have downloaded binutils into Cygwin's /usr/src directory, and then I ran in BASH:

Code: Select all

echo "============PREPARATION============"
export PREFIX=/usr/local/cross
export TARGET=i586-elf

cd /usr/src
cd /cygdrive/c/dev/cygwin/usr/src

mkdir build-binutils
mkdir build-gcc

echo "============BINUTILS============"
cd /usr/src/build-binutils
../binutils-2.20.1/configure --target=$TARGET --prefix=$PREFIX --disable-nls
make all
make install
The full output: http://pastebin.com/EQtiTS3h

The first sign of major trouble is line 752, which reads "../../binutils-2.20.1/libiberty/pex-unix.c:547: error: 'F_SETFD' undeclared (first use in this function)". It continues onward and then fails completely.

After some searches, I guessed that the problem was the binutils version. I have also tried 2.23.1, the latest, but the same problem occurs with similar output.

Thanks,

Re: binutils Compile Error

Posted: Sun Nov 25, 2012 3:42 pm
by Brynet-Inc
checking build system type... i686-pc-cygwin
checking host system type... i686-pc-cygwin
checking target system type... i686-pc-cygwin
..
checking for ld used by GCC... c:/dev/perl/c/bin/../lib/gcc/x86_64-w64-mingw32/4.4.3/../../../../x86_64-w64-mingw32/bin/ld.exe
checking if the linker (c:/dev/perl/c/bin/../lib/gcc/x86_64-w64-mingw32/4.4.3/../../../../x86_64-w64-mingw32/bin/ld.exe) is GNU ld... yes
..
.deps/archive.Plo:1: *** multiple target patterns. Stop.
..
You need to sanitize your PATH variables.

Re: binutils Compile Error

Posted: Sun Nov 25, 2012 5:39 pm
by Geometrian
I have remade the PATH, such that "echo $PATH" in a Cygwin terminal (the same as am using to do the builds) is:

Code: Select all

/usr/local/bin:/usr/bin:/cygdrive/c/dev/Perl/c/bin:/cygdrive/c/dev/Perl/c/x86_64-w64-mingw32/bin
However, on run, the same thing occurs. The first mention I think is the following:

Code: Select all

checking for ld... (cached) c:/dev/perl/c/bin/../lib/gcc/x86_64-w64-mingw32/4.4.3/../../../../x86_64-w64-mingw32/bin/ld.exe
The key point is the "cached". I can't find where it's cached. Although that ld is ultimately the right ld, I suspect it's indicative of a larger problem--and the cached values of PATH, wherever they are, are screwing it up. A quick Google hinted at config.cache. I have removed all occurences of this file. Where else would PATH be cached in Cygwin?

Thanks,

Re: binutils Compile Error

Posted: Tue Nov 27, 2012 11:48 am
by jnc100
Its cached from the first run of configure. If I remember correctly, when building binutils you do a ./configure which finds all these programs and caches their locations, then when you run make it will do a further configure in each subdirectory - if the program has been found before then it won't be looked for again.

The main question I have is why you are using a gcc from a subdirectory of perl, and not the one built in to cygwin. I can imagine problems would arise compiling to run on the i686-cygwin host when you are compiling with a mingw gcc.

Regards,
John.

Re: binutils Compile Error

Posted: Tue Nov 27, 2012 12:00 pm
by Geometrian
I reran the installation from a completely new distribution of Cygwin, and that seemed to help a little. The Perl thing was what Cygwin reported when doing which gcc.

Re: binutils Compile Error

Posted: Tue Nov 27, 2012 12:13 pm
by jnc100
From my cygwin:

Code: Select all

$ which gcc
/usr/bin/gcc

$ gcc -dumpmachine
i686-pc-cygwin
Your path seems to be messed up.

Regards,
John.