Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] Getting cross with cross-compiling...
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
yther
Apprentice
Apprentice


Joined: 25 Oct 2002
Posts: 151
Location: Charlotte, NC (USA)

PostPosted: Mon Sep 18, 2006 6:28 am    Post subject: [solved] Getting cross with cross-compiling... Reply with quote

Ok, mucking around on my own (as my questions on Gentoo fora tend to go unanswered) I've gotten distcc set up and can successfully cross-compile most packages with it. (If I can build mplayer with it, x86 -> PPC, it's gotta be working about as well as possible!) However, some packages just won't build. Observe:
Code:
CFLAGS="-O2 -pipe" CXXFLAGS="-O2 -pipe" emerge --oneshot xdelta
...
[configure stuff snipped]
...
gcc -shared  library.lo simple.lo edsio.lo edsio_edsio.lo sha.lo md5c.lo fh.lo generic.lo default.lo base64.lo maketime.lo partime.lo  -L/usr/lib -lglib -lc  -Wl,-soname -Wl,libedsio.so.0 -o .libs/libedsio.so.0.0.0
/usr/lib/gcc/powerpc-unknown-linux-gnu/4.1.1/../../../../powerpc-unknown-linux-gnu/bin/ld: library.lo: Relocations in generic ELF (EM: 3)
library.lo: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
distcc[27588] ERROR: compile (null) on localhost failed
make[2]: *** [libedsio.la] Error 1
make[2]: Leaving directory `/var/tmp/portage/xdelta-1.1.3-r1/work/xdelta-1.1.3/libedsio'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/xdelta-1.1.3-r1/work/xdelta-1.1.3'
make: *** [all-recursive-am] Error 2

!!! ERROR: dev-util/xdelta-1.1.3-r1 failed.

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/include/glib-1.2 -I/usr/lib/glib/include -O2 -mtune=7400 -pipe -Wall -c  -fPIC -DPIC library.c -o .libs/library.lo

Now, according to the Cross-compiling with distcc HOWTO, I've set up the wrapper script and the symlinks. As I said above, most programs even built before I remembered to do that step! :oops:

[Edit: While double-checking today, I discovered I didn't read the above document carefully enough, particularly where it says to create the wrapper script on the box that will be running emerge. So, if you are having similar problems to those I've been suffering, make sure you've got the wrapper on the emerge host and not the helper box(es)!]
Code:
Urd ~ # ls -lh /usr/lib/distcc/bin
total 4.0K
lrwxrwxrwx 1 root root 33 Sep 18 01:41 c++ -> powerpc-unknown-linux-gnu-wrapper
lrwxrwxrwx 1 root root 33 Sep 18 01:41 cc -> powerpc-unknown-linux-gnu-wrapper
lrwxrwxrwx 1 root root 33 Sep 18 01:41 g++ -> powerpc-unknown-linux-gnu-wrapper
lrwxrwxrwx 1 root root 33 Sep 18 01:41 gcc -> powerpc-unknown-linux-gnu-wrapper
lrwxrwxrwx 1 root root 15 Jun 24 06:40 i686-pc-linux-gnu-c++ -> /usr/bin/distcc
lrwxrwxrwx 1 root root 15 Jun 24 06:40 i686-pc-linux-gnu-g++ -> /usr/bin/distcc
lrwxrwxrwx 1 root root 15 Jun 24 06:40 i686-pc-linux-gnu-gcc -> /usr/bin/distcc
-rwxr-xr-x 1 root root 80 Sep 18 02:11 powerpc-unknown-linux-gnu-wrapper

I know the above error happens because the wrong compiler is being called, and therefore an x86 object is coming back, but it's calling gcc, which should be fine. Can anybody see what I've overlooked?

Another thing: Note up at the very top of this post, how I had to filter C(XX)FLAGS. If I leave them set to "-O2 -pipe -mtune=7400" I will get an error back from this package and some others, that the compiler doesn't recognize 7400 as a valid option for "-mtune=". According to the GCC info pages, 7400 is perfectly valid as the flavor of G4 I have. Why would this not work?

Example:
Code:
$ emerge --oneshot ssmtp
...
gcc -Wall  -DSTDC_HEADERS=1 -DHAVE_LIMITS_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYSLOG_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBNSL=1 -DRETSIGTYPE=void -DHAVE_VPRINTF=1 -DHAVE_GETHOSTNAME=1 -DHAVE_SOCKET=1 -DHAVE_STRDUP=1 -DHAVE_STRSTR=1 -DREWRITE_DOMAIN=1 -DHAVE_SSL=1  -DSSMTPCONFDIR=\"/etc/ssmtp\" -DCONFIGURATION_FILE=\"/etc/ssmtp/ssmtp.conf\" -DREVALIASES_FILE=\"/etc/ssmtp/revaliases\"  -O2 -mtune=7400 -pipe   -c -o ssmtp.o ssmtp.c
distcc[28219] ERROR: compile /var/tmp/ccache/ssmtp.tmp.nenene.28215.i on 192.168.0.5 failed
ssmtp.c:1: error: bad value (7400) for -mtune= switch
make: *** [ssmtp.o] Error 1


Last edited by yther on Sun Oct 01, 2006 12:58 am; edited 1 time in total
Back to top
View user's profile Send private message
yther
Apprentice
Apprentice


Joined: 25 Oct 2002
Posts: 151
Location: Charlotte, NC (USA)

PostPosted: Mon Sep 18, 2006 7:01 am    Post subject: Further (lack of) info... Reply with quote

As another testing step, I put distccd's logging level (on the x86 compile host) to "debug", but the system log shows nothing from distccd except the fact that it is starting:
Code:
# tail -f /var/log/everything/current
Sep 18 02:42:54 [distccd] (dcc_setup_daemon_path) daemon's PATH is /usr/i686-pc-linux-gnu/gcc-bin/4.1.1:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:
/usr/i686-pc-linux-gnu/gcc-bin/4.1.1:/usr/i686-pc-linux-gnu/powerpc-unknown-linux-gnu/gcc-bin/4.1.1
Sep 18 02:42:54 [distccd] (dcc_should_be_inetd) stdin is a tty; assuming --daemon mode
Sep 18 02:42:54 [distccd] (dcc_listen_by_addr) listening on 0.0.0.0:3632
Sep 18 02:42:54 [distccd] (dcc_standalone_server) 1 CPU online on this server
Sep 18 02:42:54 [distccd] (dcc_standalone_server) allowing up to 3 active jobs
Sep 18 02:42:54 [distccd] (dcc_log_daemon_started) preforking daemon started (2.18.3 i686-pc-linux-gnu, built Sep 13 2006 16:06:22)

At this point I ran the emerge on the PPC box. Nothing more from distccd showed up there.

Edit: Changed the DISTCCD_PATH (and restarted daemon) to put the PPC directory first instead of last; no effect. (Some job info did show up in syslog for this, however.)
Back to top
View user's profile Send private message
yther
Apprentice
Apprentice


Joined: 25 Oct 2002
Posts: 151
Location: Charlotte, NC (USA)

PostPosted: Fri Sep 29, 2006 9:28 am    Post subject: Reply with quote

Hm, 11 days later, 800 views and not one response.

[thinks]

Apparently this is not the place to ask for help with this sort of thing. :(

While I'm talking to myself, I should let myself know that a couple of daemon restarts later, distributed jobs now show up in the logs, but there are still many ebuilds that do not work with -mtune=altivec. [Edit: This is my bad wetware talking here; the actual flag is -maltivec.] I've taken to putting files in /etc/portage/env to set generic CFLAGS or disable distcc entirely. It seems to happen mostly with C++ applications, though Firefox and KDE programs build without problems.


Last edited by yther on Fri Sep 29, 2006 12:36 pm; edited 1 time in total
Back to top
View user's profile Send private message
JoseJX
Retired Dev
Retired Dev


Joined: 28 Apr 2002
Posts: 2774

PostPosted: Fri Sep 29, 2006 11:58 am    Post subject: Reply with quote

Usually it's a bug with the build system in calling gcc. You can feel free to file a bug for these.

Not being able to use the 7400 CFLAGs is a symptom of the wrong compiler being called.

As for -mtune=altivec, that's not a valid invocation anyway. -mtune is for giving scheduling hints to GCC. To enable altivec support, you'll need to build with -maltivec -mabi=altivec.
_________________
Gentoo PPC FAQ: http://www.gentoo.org/doc/en/gentoo-ppc-faq.xml
Back to top
View user's profile Send private message
yther
Apprentice
Apprentice


Joined: 25 Oct 2002
Posts: 151
Location: Charlotte, NC (USA)

PostPosted: Fri Sep 29, 2006 12:34 pm    Post subject: Reply with quote

Thanks for your reply!

JoseJX wrote:
Usually it's a bug with the build system in calling gcc. You can feel free to file a bug for these.

Not being able to use the 7400 CFLAGs is a symptom of the wrong compiler being called.

That's what I suspected, since after removing the altivec stuff from CFLAGS, I then get the errors about "File in wrong format" which are blatant signs of that.

I suppose I'll be filing a bunch of bugs, then!

I'd been hoping there was some fix for this problem in general, as the main thing I'm wanting to build is OpenOffice. Supposedly people have cross-compiled it (as I've read in here somewhere), but the "wrong format" errors are stopping me cold.

JoseJX wrote:
As for -mtune=altivec, that's not a valid invocation anyway. -mtune is for giving scheduling hints to GCC. To enable altivec support, you'll need to build with -maltivec -mabi=altivec.

Quite true, but it's my memory at fault there, not my configuration. :P My actual CFLAGS are "-O2 -mtune=7400 -pipe -maltivec -mabi=altivec".

I should know better than to rely on my brain alone at times like this!
Back to top
View user's profile Send private message
yther
Apprentice
Apprentice


Joined: 25 Oct 2002
Posts: 151
Location: Charlotte, NC (USA)

PostPosted: Sun Oct 01, 2006 1:03 am    Post subject: Fixed it! Reply with quote

JoseJX, thanks again for your reply earlier. Today I decided to double-check everything and realized I had followed the setup for distributed cross-compiling... backwards! :oops:

Putting the wrapper script on the correct box has solved my problems with random packages not compiling. Next I shall try OOo, which took over 36 hours the last time I built it without distcc!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC 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