[LLVMdev] Cross compile LLVM using gcc (powerpc and x86)

Einar Már Björgvinsson Einar.Bjorgvinsson at marel.com
Mon Feb 25 16:10:27 PST 2013


Hi there,
I hope this is the right list.

I have been trying to cross compile the LLVM 3.2 for our x86 target by using i586 cross compiler provided by Oselas toolchain (http://www.pengutronix.de/oselas/toolchain/index_de.html).

I have cross-compiled multitudes of 3rd party projects before and usually I can apply similar methods to compile the most of them.
I have however not been able to figure out exactly what is going on with this one.

My settings:

----------------------------

./configure --build=i686-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --libexecdir=${prefix}/lib/llvm --disable-maintainer-mode --disable-dependency-tracking --host=i586-unknown-linux-gnu --target=i586-unknown-linux-gnu --with-gcc-toolchain=/opt/pluto-targets/i386-rootfs//usr/bin --with-default-sysroot --with-gnu-ld=i586-unknown-linux-gnu-ld --with-gnu-as=i586-unknown-linux-gnu-as --with-gnu-ar=i586-unknown-linux-gnu-ar --disable-bootstrap -disable-optimized --disable-multilib --enable-checking --disable-shared --enable-languages=c,c++

XPATH=/opt/pluto-targets/i386-rootfs/
CROSS=i586-unknown-linux-gnu
export LDFLAGS := --sysroot=$(XPATH) -L$(XPATH)/lib -L$(XPATH)/usr/lib -L$(XPATH)/usr/local/lib -L/lib -L/usr/lib
export CFLAGS := --sysroot=$(XPATH) -I=/include -I=/usr/include -I=/usr/local/include
export CPPFLAGS := $(CFLAGS)
export CXXFLAGS := $(CFLAGS)
#export LDFLAGS := -L$(XPATH)/lib -L$(XPATH)/usr/lib -L$(XPATH)/usr/local/lib
#export CFLAGS := -I=$(XPATH)/include -I=$(XPATH)/usr/include -I=$(XPATH)/usr/local/include
export CC := $(CROSS)-gcc
export CXX := $(CROSS)-g++
export LIBTOOL := $(CROSS)-libtool

----------------------------

I haven't manage to get passed the configure stage since on of the conftests keeps failing like:

----------------------------

configure:4836: i686-linux-gnu-gcc -o conftest --sysroot=/opt/pluto-targets/i386-rootfs/ -I=/include -I=/usr/include -I=/usr/local/include --sysroot=/opt/pluto-targets/i386-rootfs/ -I=/include -I=/usr/include -I=/usr/local/include --sysroot=/opt/pluto-targets/i386-rootfs/ -L/opt/pluto-targets/i386-rootfs//lib -L/opt/pluto-targets/i386-rootfs//usr/lib -L/opt/pluto-targets/i386-rootfs//usr/local/lib -L/lib -L/usr/lib conftest.c  1>&5
/usr/bin/ld: cannot find /lib/libc.so.6 inside
/usr/bin/ld: cannot find /usr/lib/libc_nonshared.a inside
collect2: ld returned 1 exit status
configure:4839: $? = 1
configure:4848: error: installation or configuration problem: compiler cannot create executables.

----------------------------

I can clearly see that it is looking for libc in /lib but should be in /usr/lib and I haven't managed to control that.


I just wanted to send an email here before I start to hack it to much, hoping for some replies on this.

Kind regards
Einar M. Bjorgvinsson
Embedded Software Engineer
Marel ehf
Iceland

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130226/16477ad9/attachment.html>


More information about the llvm-dev mailing list