Building Eglibc in the Cygwin VM
- Update C:\Cygwin\opt\crosstool\src\build_gcc_cross.sh :
#!/bin/bash export TARGET=arm-linux-gnueabihf export PREFIX=/opt/crosstool/gcc-4.6.3-eglibc-2.13/$TARGET export PATH=$PATH:$PREFIX/bin cd /opt/crosstool/src/build-eglibc find . -delete BUILD_CC=gcc \ CC=$PREFIX/bin/$TARGET-gcc \ CXX=$PREFIX/bin/$TARGET-g++ \ AR=$PREFIX/bin/$TARGET-ar \ RANLIB=$PREFIX/bin/$TARGET-ranlib \ MAKEINFO=: \ ../eglibc-2.13/configure \ --prefix=/usr \ --with-headers=$PREFIX/usr/include \ --build=i686-pc-cygwin \ --host=$TARGET \ --enable-kernel=3.0.0 \ --disable-profile --without-gd \ --without-cvs --enable-add-ons if [ "$?" -ne "0" ]; then echo "=== build script: failed to configure eglibc ===" exit 1 fi make if [ "$?" -ne "0" ]; then echo "=== build script: failed to make eglibc ===" exit 1 fi make install_root=$PREFIX install if [ "$?" -ne "0" ]; then echo "=== build script: failed to install eglibc ===" exit 1 fi echo "=== build script: OK ==="
- You may need to reapply dos2unix to build_gcc_cross.sh if your text editor does not preserve DOS/Unix line endings.
- Run C:\Cygwin\opt\crosstool\src\build_gcc_cross.cmd and wait until it completes.
- If there are no errors, shutdown Cygwin VM and make snapshot "SNAP-9".
- Replace TARGET=arm-linux-gnueabihf with TARGET=arm-linux-gnueabi and ../eglibc-2.13/configure with ../eglibc-2.13.noarmhf/configure in C:\Cygwin\opt\crosstool\src\build_gcc_cross.sh, then run C:\Cygwin\opt\crosstool\src\build_gcc_cross.cmd and wait until it completes.
- If there are no errors, shutdown Cygwin VM and make snapshot "SNAP-10".
Notes:
- Eglibc build will take a lot of time, 4-5 times more than binutils + gcc.
- "--enable-kernel" sets minimum version of Linux kernel for this eglibc to run on. 3.0.0 should be good for Raspberry Pi.
- "--prefix=/usr" is not dangerous and will not hurt your /usr in host system, unless you call "make install" in plain and wrong way. This is an old glibc/eglibc joke.
- If you didn't apply eglibc--cross-cygwin.diff patch, you will get the following error
during build:gcc rpc_parse.c -c -D_RPC_THREAD_SAFE_ -D_CROSS_RPCGEN_ \
-o /opt/crosstool/src/build-eglibc/sunrpc/cross-rpc_parse.o -MD -MP -MF /opt/crosstool
/src/build-eglibc/sunrpc/cross-rpc_parse.o.dt -MT /opt/crosstool/src/build-eglibc/sunrpc/cross-rpc_parse.o
In file included from rpc_parse.c:39:
rpc/types.h:73: error: syntax error before "u_char"
rpc/types.h:73: warning: useless keyword or type name in empty declaration
rpc/types.h:73: warning: empty declaration
rpc/types.h:74: error: syntax error before "u_short"
rpc/types.h:74: warning: useless keyword or type name in empty declaration
rpc/types.h:74: warning: empty declaration
rpc/types.h:75: error: syntax error before "u_int"
rpc/types.h:75: warning: useless keyword or type name in empty declaration
rpc/types.h:75: warning: empty declaration
rpc/types.h:76: error: syntax error before "u_long"
rpc/types.h:76: warning: useless keyword or type name in empty declaration
rpc/types.h:76: warning: empty declaration
rpc/types.h:77: error: parse error before "quad_t"
rpc/types.h:77: warning: data definition has no type or storage class
rpc/types.h:78: error: parse error before "u_quad_t"
rpc/types.h:78: warning: data definition has no type or storage class
rpc/types.h:79: error: parse error before "fsid_t"
rpc/types.h:79: warning: data definition has no type or storage class
rpc/types.h:83: error: syntax error before "daddr_t"
rpc/types.h:83: warning: useless keyword or type name in empty declaration
rpc/types.h:83: warning: empty declaration
rpc/types.h:84: error: syntax error before "caddr_t"
rpc/types.h:84: warning: useless keyword or type name in empty declaration
rpc/types.h:84: warning: empty declaration
make[2]: *** [/opt/crosstool/src/build-eglibc/sunrpc/cross-rpc_parse.o] Error 1
make[2]: Leaving directory `/opt/crosstool/src/eglibc-2.13/sunrpc'
make[1]: *** [sunrpc/others] Error 2
make[1]: Leaving directory `/opt/crosstool/src/eglibc-2.13'
make: *** [all] Error 2 - Also you may get error message about various missing syscalls (__-prefixed) if you forgot to replace .oS with .oZ in makefiles (Cygwin case-insensitive filesystem).
- "timezone" subsystem will fail "make install" phase if you forgot to apply eglibc--cross-cygwin.diff patch. It includes updated Makefile for "timezone" subsystem from eglibc-2.15. The rest of "timezone" files were not updated.
- Some users report that make-3.82 can't build eglibc-2.13 and fails like this:sed: can't read libc.texinfo: No such file or directoryRevert to make-3.81 if you encountered this error.
make[2]: Entering directory `/opt/crosstool/src/eglibc-2.13/manual'
Makefile:236: *** mixed implicit and normal rules. Stop.
make[2]: Leaving directory `/opt/crosstool/src/eglibc-2.13/manual'
make[1]: *** [manual/subdir_lib] Error 2
make[1]: Leaving directory `/opt/crosstool/src/eglibc-2.13'
make: *** [all] Error 2
>> Read next section or
buy already prepared
cross-compiler (€10) to save your time.