Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Help needed: Setup a crosscompiling environment for Gentoo
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures
View previous topic :: View next topic  
Author Message
mcc2
n00b
n00b


Joined: 06 Sep 2012
Posts: 25

PostPosted: Sun Nov 11, 2012 4:29 am    Post subject: Help needed: Setup a crosscompiling environment for Gentoo Reply with quote

Hi,

I read this documentation: http://www.gentoo.org/proj/en/base/embedded/handbook/?part=1&chap=3
for setting up an crosscompilation environment. The target system is an armv7a Beaglebone.

What I did so far:
I set up a Gentoo Linux natively on the Beaglebone successfully. Native compilation works in the limits of
256MB RAM and the performance the Beaglebone is able to offer. But tehre are too much applications which
compilation process goes far beyond that. Therefore I decided to setup an environment, which makes it possible
to crosscompile whatever I need for the Beaglebone on my AMD64 Gentoo Linux PC.

I setup a crosscompiler before to compile Robert Nelsons kernel for the Beaglebone, which works fine.

To do so I did:
* Copy the complete rootfs of the Beaglebone to a directory on the harddisc of my PC.
* Create a link from /usr/CTARGET to that directory so that "ls -l /usr/CTARGET/." shows the rootfs
* Create a link from /usr/armv7a-softfp-linux-gnueabi/etc/make.profile to /usr/CTARGET/etc/make.profile
* Ensure that /usr/CTARGET/etc/make.profile symlinks to /usr/CTARGET/usr/portage/profiles/default/linux/arm/10.0 (relatively, so it
remains valid when copied to the SD-card of the Beaglebone.
* Call emerge-wrapper --init, which creates two symlinks and does not output any more informations
* Call armv7a-softfp-linux-gnueabi-emerge <pkg> and as an alternative emerge-wrapper --target armv7a-softfp-linux-gnueabi <pkg>
Both failed with different package every time with a similiar symptom:
(As an example I show the output of compiling the MidNight Commander for that platform here, I did not change or restart the shell between the comands):
solfire:/root>emerge-wrapper --target armv7a-softfp-linux-gnueabi app-misc/mc

* IMPORTANT: 2 news items need reading for repository 'gentoo'.
* Use eselect news to read news items.

Calculating dependencies... done!

>>> Verifying ebuild manifests

>>> Starting parallel fetch

>>> Emerging (1 of 19) sys-libs/zlib-1.2.7 for /usr/armv7a-softfp-linux-gnueabi/
* zlib-1.2.7.tar.gz SHA256 SHA512 WHIRLPOOL size ;-) ... [ ok ]
>>> Unpacking source...
>>> Unpacking zlib-1.2.7.tar.gz to /usr/armv7a-softfp-linux-gnueabi/tmp/portage/sys-libs/zlib-1.2.7/work
>>> Source unpacked in /usr/armv7a-softfp-linux-gnueabi/tmp/portage/sys-libs/zlib-1.2.7/work
>>> Compiling source in /usr/armv7a-softfp-linux-gnueabi/tmp/portage/sys-libs/zlib-1.2.7/work/zlib-1.2.7 ...
./configure --shared --prefix=/usr --libdir=/usr/lib --uname=linux
Using armv7a-softfp-linux-gnueabi-ar
Using armv7a-softfp-linux-gnueabi-ranlib
Using armv7a-softfp-linux-gnueabi-nm
Checking for armv7a-softfp-linux-gnueabi-gcc...
Checking for shared library support...
No shared library support; try without defining CC and CFLAGS
Building static library libz.a version 1.2.7 with cc.
Checking for off64_t... Yes.
Checking for fseeko... Yes.
Checking for strerror... Yes.
Checking for unistd.h... Yes.
Checking for stdarg.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf().
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Looking for a four-byte integer type... Found.
make -j 7
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -I. -c -o example.o test/example.c
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -c -o adler32.o adler32.c
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -c -o crc32.o crc32.c
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -c -o deflate.o deflate.c
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -c -o infback.o infback.c
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -c -o inffast.o inffast.c
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -c -o inflate.o inflate.c
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -c -o inftrees.o inftrees.c
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -c -o trees.o trees.c
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -c -o zutil.o zutil.c
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -c -o compress.o compress.c
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -c -o uncompr.o uncompr.c
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -c -o gzclose.o gzclose.c
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -c -o gzlib.o gzlib.c
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -c -o gzread.o gzread.c
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -c -o gzwrite.o gzwrite.c
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -I. -c -o minigzip.o test/minigzip.c
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -I. -D_FILE_OFFSET_BITS=64 -c -o example64.o test/example.c
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -I. -D_FILE_OFFSET_BITS=64 -c -o minigzip64.o test/minigzip.c
armv7a-softfp-linux-gnueabi-ar rc libz.a adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -o example example.o -L. libz.a
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -o minigzip minigzip.o -L. libz.a
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -o example64 example64.o -L. libz.a
cc -march=native -O2 -pipe -msse3 -D_LARGEFILE64_SOURCE=1 -o minigzip64 minigzip64.o -L. libz.a
[b]libz.a: could not read symbols: Archive has no index; run ranlib to add one
libz.a: could not read symbols: Archive has no index; run ranlib to add one
collect2: ld returned 1 exit status
collect2: ld returned 1 exit status
make: *** [example64] Error 1
make: *** Waiting for unfinished jobs....
make: *** [minigzip] Error 1
libz.a: could not read symbols: Archive has no index; run ranlib to add one
collect2: ld returned 1 exit status
libz.a: could not read symbols: Archive has no index; run ranlib to add one
make: *** [example] Error 1
collect2: ld returned 1 exit status
make: *** [minigzip64] Error 1
[/b]emake failed
* ERROR: sys-libs/zlib-1.2.7 failed (compile phase):
* (no error message)
*
* Call stack:
* ebuild.sh, line 93: Called src_compile
* environment, line 1489: Called die
* The specific snippet of code:
* emake || die
*
* If you need support, post the output of `emerge --info '=sys-libs/zlib-1.2.7'`,
* the complete build log and the output of `emerge -pqv '=sys-libs/zlib-1.2.7'`.
* The complete build log is located at '/usr/armv7a-softfp-linux-gnueabi/tmp/portage/sys-libs/zlib-1.2.7/temp/build.log'.
* The ebuild environment file is located at '/usr/armv7a-softfp-linux-gnueabi/tmp/portage/sys-libs/zlib-1.2.7/temp/environment'.
* Working directory: '/usr/armv7a-softfp-linux-gnueabi/tmp/portage/sys-libs/zlib-1.2.7/work/zlib-1.2.7'
* S: '/usr/armv7a-softfp-linux-gnueabi/tmp/portage/sys-libs/zlib-1.2.7/work/zlib-1.2.7'

>>> Failed to emerge sys-libs/zlib-1.2.7 for /usr/armv7a-softfp-linux-gnueabi/, Log file:

>>> '/usr/armv7a-softfp-linux-gnueabi/tmp/portage/sys-libs/zlib-1.2.7/temp/build.log'

* Messages for package sys-libs/zlib-1.2.7 merged to /usr/armv7a-softfp-linux-gnueabi/:

* ERROR: sys-libs/zlib-1.2.7 failed (compile phase):
* (no error message)
*
* Call stack:
* ebuild.sh, line 93: Called src_compile
* environment, line 1489: Called die
* The specific snippet of code:
* emake || die
*
* If you need support, post the output of `emerge --info '=sys-libs/zlib-1.2.7'`,
* the complete build log and the output of `emerge -pqv '=sys-libs/zlib-1.2.7'`.
* The complete build log is located at '/usr/armv7a-softfp-linux-gnueabi/tmp/portage/sys-libs/zlib-1.2.7/temp/build.log'.
* The ebuild environment file is located at '/usr/armv7a-softfp-linux-gnueabi/tmp/portage/sys-libs/zlib-1.2.7/temp/environment'.
* Working directory: '/usr/armv7a-softfp-linux-gnueabi/tmp/portage/sys-libs/zlib-1.2.7/work/zlib-1.2.7'
* S: '/usr/armv7a-softfp-linux-gnueabi/tmp/portage/sys-libs/zlib-1.2.7/work/zlib-1.2.7'
[1] 3668 exit 1 emerge-wrapper --target armv7a-softfp-linux-gnueabi app-misc/mc


What is common to all of my compilation attempts are error message like this one: "Could not read symbols: Archive has no index; run ranlib to add one"
The second, which is definetly wrong is the "-msse3" option, which is not supported on the Beaglebone as far as I know...

I have no clue, what is wrong with the setup and would be very happy if someone with more experience with this kind of setups could
point me to the right direction.

How can I make this run successfully?

Thank you very much in advance for any help!
Best regards,
mcc
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 31907
Location: 56N 3W

PostPosted: Sun Nov 11, 2012 12:21 pm    Post subject: Reply with quote

mcc2

You may not use
Code:
-march=native
in the targets make.conf.

For my Raspberry Pi /usr/armv6j-hardfloat-linux-gnueabi/etc/portage/make.conf contains
Code:
CFLAGS="-O2 -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard  -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"


I suspect that -msse3 won't work either. You need to set CFLAGS explictly or gcc will use CFLAGS applicable to the build host.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
mcc2
n00b
n00b


Joined: 06 Sep 2012
Posts: 25

PostPosted: Tue Nov 13, 2012 3:29 am    Post subject: Reply with quote

Hi,

the problem has been removed.
The Gentoo embedded handbook freely mixes CTARGET with $CTARGET
-- same goes fpr other variables like this -- which confuses a crosscompiling
newbie like me a lot before pinpoint the "root of all evil" :)

But I only change the initially problem with another kind of problem
(see next post)

Thanks a lot for your help! :)

Best regards,
mcc
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on Alternative Architectures All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum