This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Is it possible to build a cross compiler for AIX 6.1 on Ubuntu?


Judging from what I've found 

(e.g.
http://gcc.1065356.n8.nabble.com/Problem-building-cross-compiler-for-AIX-6-1-td655374.html
http://gcc.1065356.n8.nabble.com/problems-building-gcc-4-3-5-1-on-AIX-6-1-with-pthreads-td879969.html)

I suspect the answer is "no", however both of the above threads are 4+ years
old so something may have changed and I'd appreciate the opinion of someone
more knowledgable than me.

I'm attempting to build an AIX 6.1 cross compiler on Ubuntu 16.04 using gcc
5.4.0.  I believe that the problem lies in binutils as I can build an object
file on the Ubuntu machine and link it successfully on the AIX machine,
e.g.:

$ ld -lc -o hello /usr/ccs/lib/crt0.o hello.o
$ ./hello
Hello, world!

But trying to build the executable on Ubuntu (linking with the AIX system
libc.a) gives:

root@oc5328343620:/tmp# gcc -L/cross-compiler/sysroot/lib -o hello hello.c 
/cross-compiler/sysroot/lib/libc.a: file not recognized: File format not
recognized
collect2: error: ld returned 1 exit status

root@oc5328343620:/tmp# file -L /cross-compiler/sysroot/lib/libc.a
/cross-compiler/sysroot/lib/libc.a: archive (big format)

My environment is as follows: 

(Note that this is all being done using a Docker container, I don't imagine
that that's relevant - I have successfully built a Solaris 11 SPARC cross
compiler in a similar fashion - but am mentioning in case it is.)

The AIX 6.1 system libraries and include files are under:
/cross-compiler/sysroot

I have the binutils-2.27 source and confgure the build with:

../binutils-2.27/configure --target=powerpc-ibm-aix6.1
--prefix=/cross-compiler \
	-with-sysroot=/cross-compiler/sysroot

make all; make install

completes successfully, creating /cross-compiler/bin/powerpc-ibm-aix6.1-ld,
etc.

I have the gcc-5.4.0 source along with gmp-4.3.2, mpc-0.8.1 and mpfr-2.4.2
which are unpacked into gmp, mpc and mpfr directories respectively.

../gcc-5.4.0/configure --target=../binutils-2.27/configure
--target=powerpc-ibm-aix6.1 \
	-with-sysroot=/cross-compiler/sysroot --prefix=/cross-compiler \
	--with-gnu-as --with-gnu-ld --disable-libgcj --enable-languages=c

make all-gcc; make install-gcc

completes successfully, creating /cross-compiler/bin/powerpc-ibm-aix6.1-gcc,
etc.

However:

make all-target-libgcc

fails with the following error:

collect2: fatal error: libgcc.a: cannot open as COFF file
compilation terminated.

Thanks for any insights,
Jon



--
View this message in context: http://gcc.1065356.n8.nabble.com/Is-it-possible-to-build-a-cross-compiler-for-AIX-6-1-on-Ubuntu-tp1314232.html
Sent from the gcc - Help mailing list archive at Nabble.com.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]