tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Cross-compilation problems



I'm trying to cross-compile some packages on a x86_64 host for a
earmv7hf target.

I'm following Taylor R. Campbell HOWTE (2017/03/05) but I ran into
several problems.

I had first to set 

PKGSRC_USE_FORTIFY= no 

in /etc/mk.conf so that libnbcompat could simply built, choking on what
is introduced by -D_FORTIFY_SOURCE=2.

When trying to create the first needed package: cross-libtool-base,
the configure script chokes because it is unable to create an
executable.

Indeed, the cross-compiler is invoked with --sysroot=/ and this prevents
it from finding the crt0.o etc. to link the executable with.

So I force it by adding in the Makefile:

CFLAGS+= --sysroot=${CROSS_DESTDIR}

Then apparently it finds the crt0.o etc. but invokes the native loader
to determine if it's an executable! This:

/usr/lib/libgcc_s.so: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status

I wonder what I'm doing wrong or am I the sole one to try
cross-compilation with pkgsrc?

Here are the relevant bits in my /etc/mk.conf:

# pkgsrc (from Taylor R. Campbell HOWTO)

USE_CROSS_COMPILE?= yes

#
CROSSBASE= ${LOCALBASE}/cross-${TARGET_ARCH:U${MACHINE_ARCH}}

.if !empty{USE_CROSS_COMPILE:M[yY][eE][sS]}

# Can't be set on cmd line.
MACHINE_ARCH= earmv7hf

# Added by me: FORTIFY_SOURCE doesn't work with libtool.
#
PKGSRC_USE_FORTIFY= no

# Matrix binaries for target binaries (target not mentioned).
#
TOOLDIR= /data/m/tmp/olimex/tooldir.NetBSD-8.0-amd64
CROSS_DESTDIR= /data/m/tmp/olimex/destdir.evbarm

PACKAGES= /data/m/telegstn/${MACHINE_ARCH}
WRKDIR_BASENAME= work.${MACHINE_ARCH}

.endif

If somebody has any clue about the @!!!**@! configure, automake and all
this... stuff, I'd be happy to hear.

TIA
-- 
        Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
                     http://www.kergis.com/
                       http://www.sbfa.fr/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


Home | Main Index | Thread Index | Old Index