nezticle / RaspberryPi-BuildRoot

The objective of this project is to provide an SDK and root file system for the Raspberry Pi that is lightweight and takes full advantage of the hardware available. The resulting image produced is small distro known as Bsquask (linux). The Bsquask SDK provides a GCC 4.6.3 toolchain for building armv6 binaries with the hardfloat ABI, as well as bootloaders, kernel image, rootfs, and development sysroot for the Raspberry Pi.
http://bsquask.com
GNU General Public License v2.0
229 stars 61 forks source link

Clean build does not work with latest on master #15

Closed fueler closed 11 years ago

fueler commented 11 years ago

fueler@fueler-rpi:~/rpi/bsquask$ make make -C /home/fueler/rpi/BuildRoot O=/home/fueler/rpi/bsquask/. Checking external toolchain settings Incorrect selection of the C library

This git change in BuildRoot added this change. http://git.buildroot.net/buildroot/commit/?id=9456b58a8b3b4efdd8038a68370acf618aa9465b

I did not get this error until after doing a "git pull" and performing a "make clean" then a "make".

ghost commented 11 years ago

I've ran into the same issues with previous pulls. My solution; move the 'dl' directory out of the tree, run a make distclean (perhaps also saving your configs) and moving the configs and 'dl' directory back into the tree

Perhaps a bit harsh but it did do the job.

nezticle commented 11 years ago

I just double checked this by starting from a clean environment (git clean -dfx) and a new build directory, and I'm not still not getting this error. I would recommend cleaning your BuildRoot directory as well (after committing/saving any changes first). Let me know if you still have this problem after this, and we'll find a solution.

fueler commented 11 years ago

/usr/bin/gcc -O2 -I/home/fueler/rpi/bsquask/host/include -I/home/fueler/rpi/bsquask/host/usr/include -Wall -W -DHAVE_CONFIG_H -I./zlib -I. -I. -c -o zlib/zutil.o zlib/zutil.c /usr/bin/ar cr zlib/libz.a zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/deflate.o zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o zlib/zutil.o ranlib zlib/libz.a /usr/bin/gcc -O2 -I/home/fueler/rpi/bsquask/host/include -I/home/fueler/rpi/bsquask/host/usr/include -Wall -W -L/home/fueler/rpi/bsquask/host/lib -L/home/fueler/rpi/bsquask/host/usr/lib -Wl,-rpath,/home/fueler/rpi/bsquask/host/usr/lib -o ccache main.o ccache.o mdfour.o hash.o execute.o util.o args.o stats.o version.o cleanup.o snprintf.o unify.o manifest.o hashtable.o hashtable_itr.o murmurhashneutral2.o hashutil.o getopt_long.o exitfn.o lockfile.o counters.o language.o compopt.o -Lzlib -lm -lz

host-ccache 3.1.7 Installing to host directory PATH=/home/fueler/rpi/bsquask/host/bin:/home/fueler/rpi/bsquask/host/usr/bin:/home/fueler/rpi/bsquask/host/usr/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games LD_LIBRARY_PATH="/home/fueler/rpi/bsquask/host/usr/lib:" PKG_CONFIG="/home/fueler/rpi/bsquask/host/usr/bin/pkg-config" PKG_CONFIG_SYSROOT_DIR="/" PKG_CONFIGLIBDIR="/home/fueler/rpi/bsquask/host/usr/lib/pkgconfig" PERLLIB="/home/fueler/rpi/bsquask/host/usr/lib/perl" /usr/bin/make -j2 -C /home/fueler/rpi/bsquask/build/host-ccache-3.1.7/ install /usr/bin/install -c -d /home/fueler/rpi/bsquask/host/usr/bin /usr/bin/install -c -m 755 ccache /home/fueler/rpi/bsquask/host/usr/bin /usr/bin/install -c -d /home/fueler/rpi/bsquask/host/usr/share/man/man1 /usr/bin/install -c -m 644 ./ccache.1 /home/fueler/rpi/bsquask/host/usr/share/man/man1/ mkdir -p /home/fueler/rpi/bsquask/host/opt/ext-toolchain bzcat /home/fueler/rpi/BuildRoot/dl/arm-raspberrypi-linux-gnueabi.tar.bz2 | \ tar --strip-components=1 --exclude='usr/lib/locale/' -C /home/fueler/rpi/bsquask/host/opt/ext-toolchain -xf - Checking external toolchain settings Incorrect selection of the C library make[1]: _\ [/home/fueler/rpi/bsquask/stamps/ext-toolchain-checked] Error 255 make: *\ [all] Error 2

That's from clean build directory. Going to try and clear everything and start from scratch.

fueler commented 11 years ago

/usr/bin/gcc -O2 -I/home/fueler/rpi/bsquask/host/include -I/home/fueler/rpi/bsquask/host/usr/include -Wall -W -L/home/fueler/rpi/bsquask/host/lib -L/home/fueler/rpi/bsquask/host/usr/lib -Wl,-rpath,/home/fueler/rpi/bsquask/host/usr/lib -o ccache main.o ccache.o mdfour.o hash.o execute.o util.o args.o stats.o version.o cleanup.o snprintf.o unify.o manifest.o hashtable.o hashtable_itr.o murmurhashneutral2.o hashutil.o getopt_long.o exitfn.o lockfile.o counters.o language.o compopt.o -Lzlib -lm -lz

host-ccache 3.1.7 Installing to host directory PATH=/home/fueler/rpi/bsquask/host/bin:/home/fueler/rpi/bsquask/host/usr/bin:/home/fueler/rpi/bsquask/host/usr/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games LD_LIBRARY_PATH="/home/fueler/rpi/bsquask/host/usr/lib:" PKG_CONFIG="/home/fueler/rpi/bsquask/host/usr/bin/pkg-config" PKG_CONFIG_SYSROOT_DIR="/" PKG_CONFIG_LIBDIR="/home/fueler/rpi/bsquask/host/usr/lib/pkgconfig" PERLLIB="/home/fueler/rpi/bsquask/host/usr/lib/perl" /usr/bin/make -j2 -C /home/fueler/rpi/bsquask/build/host-ccache-3.1.7/ install /usr/bin/install -c -d /home/fueler/rpi/bsquask/host/usr/bin /usr/bin/install -c -m 755 ccache /home/fueler/rpi/bsquask/host/usr/bin /usr/bin/install -c -d /home/fueler/rpi/bsquask/host/usr/share/man/man1 /usr/bin/install -c -m 644 ./ccache.1 /home/fueler/rpi/bsquask/host/usr/share/man/man1/ --2012-09-24 20:41:06-- http://bsquask.com/downloads/toolchains/arm-raspberrypi-linux-gnueabi.tar.bz2 Resolving bsquask.com (bsquask.com)... 176.58.100.20 Connecting to bsquask.com (bsquask.com)|176.58.100.20|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 43734928 (42M) [application/x-bzip2] Saving to: `/home/fueler/rpi/BuildRoot/dl/arm-raspberrypi-linux-gnueabi.tar.bz2.tmp'

100%[======================================================================================================================>] 43,734,928 1.76M/s in 25s

2012-09-24 20:41:31 (1.67 MB/s) - `/home/fueler/rpi/BuildRoot/dl/arm-raspberrypi-linux-gnueabi.tar.bz2.tmp' saved [43734928/43734928]

mkdir -p /home/fueler/rpi/bsquask/host/opt/ext-toolchain bzcat /home/fueler/rpi/BuildRoot/dl/arm-raspberrypi-linux-gnueabi.tar.bz2 | \ tar --strip-components=1 --exclude='usr/lib/locale/' -C /home/fueler/rpi/bsquask/host/opt/ext-toolchain -xf - Checking external toolchain settings Incorrect selection of the C library make[1]: ** [/home/fueler/rpi/bsquask/stamps/ext-toolchain-checked] Error 255 make: *\ [all] Error 2 fueler@fueler-rpi:~/rpi/bsquask$

That's a completely a fresh build.

fueler commented 11 years ago

fueler@fueler-rpi:~/rpi/bsquask$ cat /etc/issue Ubuntu 12.04.1 LTS \n \l

fueler@fueler-rpi:~/rpi/bsquask$ uname -a Linux fueler-rpi 3.2.0-31-generic #50-Ubuntu SMP Fri Sep 7 16:16:45 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

nezticle commented 11 years ago

That is quite unusual (and you are building from the same distro and arch as me). Could you make sure that BR2_TOOLCHAIN_EXTERNAL_GLIBC=y is set in your .config file?

My hypothesis is that your configuration is testing for uClibc, in which case the C Library test for the external toolchain will fail (due to the absence of libc.so.0). When BR2_TOOLCHAIN_EXTERNAL_GLIBC=y is set, the C library test will correctly find libc.so.6 and pass. You can check for the libc file provided manually by looking in [build-dir]/host/usr/arm-unknown-linux-gnueabi/sysroot/lib/

fueler commented 11 years ago

from .config #

Toolchain

BR2_TOOLCHAIN_BUILDROOT is not set

BR2_TOOLCHAIN_EXTERNAL=y

BR2_TOOLCHAIN_CTNG is not set

BR2_TOOLCHAIN_EXTERNAL_RASPBERRYPI_ARM=y

BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201109 is not set

BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201103 is not set

BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201009 is not set

BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM2010Q1 is not set

BR2_TOOLCHAIN_EXTERNAL_CUSTOM is not set

BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y

BR2_TOOLCHAIN_EXTERNAL_PREINSTALLED is not set

BR2_TOOLCHAIN_EXTERNAL_PREFIX="arm-raspberrypi-linux-gnueabi" BR2_TOOLCHAIN_EXTERNAL_GLIBC=y

fueler@fueler-rpi:~/rpi/bsquask/host/usr/arm-unknown-linux-gnueabi/sysroot/lib$ ls -l total 0

This is the environment setup that I used when building it the first time.

fueler@fueler-rpi:~/rpi/bsquask/host/usr/arm-unknown-linux-gnueabi/sysroot/lib$ cat ~/rpi/bsquask.buildroot

Base directory

export BSQUASK_DIR=/home/fueler/rpi/bsquask

Native Build Tools

export BSQUASK_HOST_DIR=$BSQUASK_DIR/host

Sysroot directory, where everything gets installed

export BSQUASK_STAGING_DIR=$BSQUASK_DIR/staging

Deployment directory

export BSQUASK_TARGET_DIR=$BSQUASK_DIR/target

Adding Build Tools to PATH

export PATH=$BSQUASK_HOST_DIR/usr/bin:$PATH

Here is the directory contents: fueler@fueler-rpi:~/rpi/bsquask/host/usr/arm-unknown-linux-gnueabi$ find . . ./sysroot ./sysroot/usr ./sysroot/usr/lib ./sysroot/usr/include ./sysroot/usr/bin ./sysroot/lib ./sysroot/bin

I am really stumped as I do not know the ins and outs of the build system. It worked like a champ before I updated the BuildRoot git repo.

nezticle commented 11 years ago

I looked over the ext-toolchain code and I think I found a bug in the upstream Buildroot code.

check_glibc = \
    SYSROOT_DIR="$(strip $1)"; \
    if test `find $${SYSDROOT_DIR}/lib/ -maxdepth 1 -name 'ld-linux*.so.*' -o -name 'ld.so.*' | wc -l` -eq 0 ; then \
        echo "Incorrect selection of the C library"; \
        exit -1; \
    fi; \

SYSDROOTDIR doesn't exist anywhere else in the codebase and is a typo which would lead to this command being run: find /lib/ -maxdepth 1 -name 'ld-linux.so._' -o -name 'ld.so.*' | wc -l Which still would pass on my computer, but is not testing what's intended because now its testing your host systems libc.

Hopefully this is what is causing your problem, so I've pushed the following fix: 4d8903c0a5ee98ae7fcc81faad63f32f3e65c682

asb commented 11 years ago

Yes, this was fixed upstream too: http://git.buildroot.net/buildroot/commit/toolchain/helpers.mk?id=666eb02be3cd4115a1ef8b78a63d64d12b24469e

nezticle commented 11 years ago

@asb thats good news, was just about to send the patch to the BuildRoot list. (at the very least now I'm signed up for the BuildRoot mailing list).

fueler commented 11 years ago

That fixed it, thank you for your help!