Home » Uncategorized » bootstrap-linux + musl-cross

bootstrap-linux + musl-cross

https://github.com/pikhq/bootstrap-linux

https://github.com/GregorR/musl-cross

almost linux module set built-in.

after boot, gcc compilation didn’t work.

gcc hello.c

libgcc_s.so.1 needed by as

problem solved, thanks to rofl0r, dalias!

https://github.com/pikhq/bootstrap-linux/issues/8

gcc 4.8.0 doesn’t support gcc bootstrapping for c++, so tried gcc-4.7.3

For the records:

./configure –prefix= –host=x86_64-linux-musl –target=x86_64-linux-musl –build=x86_64-linux –enable-languages=c,c++ –disable-libmudflap –disable-shared –disable-nls –disable-libgomp –with-newlib

export C_INCLUDE_PATH=/tmp/bootstrap-linux/work/gcc-4.7.3/mpfr/src
export LD_LIBRARY_PATH=/tmp/bootstrap-linux/work/gcc-4.7.3/host-x86_64-linux-musl/mpfr/src/.libs
export LIBRARY_PATH=$LD_LIBRARY_PATH

//configure script guess mpfr libs is in .libs but it is in src/.libs //for mpfr 3.x
ln -s /tmp/bootstrap-linux/work/gcc-4.7.3/host-x86_64-linux-musl/mpfr/src/.libs /tmp/bootstrap-linux/work/gcc-4.7.3/host-x86_64-linux-musl/mpfr/.libs

//configure script guess ctype for solaris, but this is generic/linux-musl ctype_base.h
cp /tmp/bootstrap-linux/work/gcc-4.7.3/libstdc++-v3/config/os/generic/ctype_base.h /tmp/bootstrap-linux/work/gcc-4.7.3/x86_64-linux-musl/libstdc++-v3/include/x86_64-linux-musl/bits/

//configure script guess wrong ctype, so fix it for generic/linux-musl ctype_base.h
cp /tmp/bootstrap-linux/work/gcc-4.7.3/libstdc++-v3/config/os/generic/ctype_configure_char.cc /tmp/bootstrap-linux/work/gcc-4.7.3/x86_64-linux-musl/libstdc++-v3/src/c++98/

gcc/g++ 4.7.3 4.8.0 bootstrapping succeed.

https://github.com/pikhq/bootstrap-linux/issues/9

#include <sys/param.h> /* for PATH_MAX */
#include <fcntl.h>     //
--
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20121231/160699.html

--
vi /include/stdio.h
#if 1/0
#define tmpfile64 tmpfile
#define fopen64 fopen
#define fseeko64 fseeko
#define ftello64 ftello
#endif

--
vi /include/stdlib.h
#define strtod_l(a,b,c) strtod(a,b)
#define strtof_l(a,b,c) strtof(a,b)

--
http://www.linuxfromscratch.org/blfs/view/svn/x/installing.html
Mesa configuration:
./configure --prefix=/usr --sysconfdir=/etc --enable-texture-float --enable-gles1 --enable-gles2 --enable-osmesa --enable-xa --enable-gallium-egl --enable-glx-tls --with-egl-platforms=drm,x11 --with-gallium-drivers=svga,swrast --build=x86_64-linux-musl --disable-gbm --disable-shared --enable-static
vi Mesa-9.1.2/src/mesa/main/querymatrix.c
#if 0
enum {FP_NAN, FP_INFINITE, FP_ZERO, FP_SUBNORMAL, FP_NORMAL}
fpclassify(double x)
{
    /* XXX do something better someday */
    return FP_NORMAL;
}
#endif

--
[solved] additional note, libstdc++.a fPIC issue:
back to previous compiled gcc source.
cd gcc-build/x86_64-linux-musl/libstdc\+\+-v3/
make clean
vi Makefile
CFLAGS = -g -O2 -fPIC
CPPFLAGS = -fPIC
LDFLAGS = -fPIC


cd gcc-build/x86_64-linux-musl/libstdc\+\+-v3/src/
vi Makefile
CFLAGS = -g -O2 -fPIC
CPPFLAGS = -fPIC
LDFLAGS = -fPIC

cd gcc-build/x86_64-linux-musl/libstdc\+\+-v3/src/c++98/
vi Makefile
CFLAGS = -g -O2 -fPIC
CPPFLAGS = -fPIC
LDFLAGS = -fPIC

cd gcc-build/x86_64-linux-musl/libstdc\+\+-v3/src/c++11/
vi Makefile
CFLAGS = -g -O2 -fPIC
CPPFLAGS = -fPIC
LDFLAGS = -fPIC
cd gcc-build/x86_64-linux-musl/libstdc\+\+-v3/libsupc\+\+/ 
vi Makefile 
CFLAGS = -g -O2 -fPIC 
CPPFLAGS = -fPIC 
LDFLAGS = -fPIC

//added due to XML-Parser-2.41
cd gcc-build/x86_64-linux-musl/libssp/ 
vi Makefile 
CFLAGS = -g -O2 -fPIC 
CPPFLAGS = -fPIC 
LDFLAGS = -fPIC
make && make install 
cp ../gcc-4.8.0/libstdc\+\+-v3/config/os/generic/ctype_base.h /include/c++/4.8.0/x86_64-linux-musl/bits/

--
vi xserver/hw/xfree86/common/xf86Events.c
http://patchwork.freedesktop.org/patch/13577/
+#if 0
         /* check for any new output devices */
         xf86platformVTProbe();
+#endif

--
llvm clang gets Segmentation fault, but mesa3d could be compile by gcc 4.8.0(x86_64-linux-musl) without llvm/libclc.
$ clang 
traps: clang[12297] general protection ip:1df76a8 sp:7fffd96774b0 error:0 in clang[400000+2233000]

llvm clang could be built, but compiler-rt doesnt,
when config.sub error occurred, munge-config-sub
llvm-configuration: 
CC=gcc CXX=g++ ../llvm/configure --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib/llvm --enable-libffi --enable-optimized --disable-shared --enable-target=all --disable-assertions --disable-debug-runtime --disable-expensive-checks --enable-experimental-targets=R600

vi llvm-build/tools/clang/unittests/ASTMatchers/Dynamic/Makefile
- clangRewrite.a clangParse.a clangSema.a \
+ clangRewriteCore.a clangRewriteFontend.a clangParse.a clangSema.a \
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s