Thursday, December 20, 2012

Gcc broken in Gentoo

I've got Gentoo working pretty well on my RPi (256 MB RAM but I've already ordered the 512 MB upgrade) as I've already posted.

I also posted about progress I'd made in getting some music out of Gentoo on the RPi. In summary, SoX works fine but when installing mpc (Media Player Classic) on the RPi, gcc broke which meant that I couldn't install anything else.

The relevant lines from the aborted build log are as follows:


checking for armv6j-hardfloat-linux-gnueabi-gcc... armv6j-hardfloat-linux-gnueabi-gcc
checking whether the C compiler works... no
configure: error: in `/var/tmp/portage/media-sound/mpc-0.22/work/mpc-0.22':
configure: error: C compiler cannot create executables
See `config.log' for more details

!!! Please attach the following file when seeking support:
!!! /var/tmp/portage/media-sound/mpc-0.22/work/mpc-0.22/config.log
 * ERROR: media-sound/mpc-0.22 failed (configure phase):
 *   econf failed




What surprised me was that when I tried to install mpc in Gentoo on my Desktop (3.5.7-gentoo kernel), I also ended up with a broken compiler for exactly the same reason.
What's going on here?
Do I need to reinstall Gentoo?
But if I do, isn't the same thing going to happen again?

As usual, Google was my friend and lead me to eventually stumble across this forum thread and particularly this post.
The key point here is that when attempting to emerge mpc, there is an ambiguity in that two packages named mpc exist:
dev-libs/mpc
media-sound/mpc

While the second is the one we want (mpc=Media Player Classic), the first is something very different and mpc here stands for MultiPrecision Complex (arithmetic).
On both the RPi and my Desktop, I somehow managed to install this mpc in error.
Then I went ahead and unmerged this mpc before installing media-sound/mpc.
Unfortunately, this lead to libmpc.so.2 being uninstalled despite it being required by the C-compiler.

Luckily, the Tinderbox site contains a huge range of pre-compiled binaries for Gentoo.

On the Desktop install of Gentoo, I downloaded the x86 version of mpc.
To install the binary, move the downloaded .tbz2 file to / and then expand it with

sudo tar xfpjv mpc-0.8.2.tbz2


(Some useful tips on opening .tbz2 files are provided towards the end of this blog post).

and that's it. In my case, my compiler was restored to all its previous functionality.

OK, thats' the Desktop. How about my RPi.

Sure enough, the appropriate version of mpc is available in Tinderbox but after installing it, my compiler still wasn't working.
The error message contained the following:

src/util.h:26:24: fatal error: mpd/client.h: No such file or directory
compilation terminated.

OK, this means that /usr/include/mpd/client.h is missing.
Why it's missing, I really just don't know but getting it back is easy enough.
It just requires installation of libmpdclient which is available for compilation in the Gentoo repos as media-libs/libmpdclient-2.7
Upon emerging this, everything was back to normal.








No comments:

Post a Comment