Re: lfs -> Ubuntu cross compiler w/ apt?
Nathan Coulson <[email protected]>
| Newsgroups | gmane.linux.lfs.general |
|---|---|
| Message-ID | <CAFvYhDDFoVMg1ZKHdn4nnwcpM8N9pgOj8wKp7tEuU1D8k=yVtg@mail.gmail.com> |
On Mon, Feb 6, 2012 at 3:08 AM, Nathan Coulson <[email protected]> wrote: > I built myself a compiler that can compile binaries for ubuntu (using > their libraries). Originally I just used the standard LFS compiler, > but later on had a few messages that I believe were complaining that > my glibc was newer then ubuntu's. (was long ago, don't quite recall > the exact message). > > To work around this, I built a > > First, I grabbed a few of the ubuntu .deb files, and converted them w/ > the deb2tgz utility. > > install -d -m755 /usr/x86_64-ubuntu1104-linux-gnu/sysroot > > tar -xf src/libc6_2.13-0ubuntu13_amd64.tar.xz -C > /usr/x86_64-ubuntu1104-linux-gnu/sysroot > tar -xf src/libc6-i386_2.13-0ubuntu13_amd64.tar.xz -C > /usr/x86_64-ubuntu1104-linux-gnu/sysroot > tar -xf src/libc6-dev_2.13-0ubuntu13_amd64.tar.xz -C > /usr/x86_64-ubuntu1104-linux-gnu/sysroot > tar -xf src/libc6-dev-i386_2.13-0ubuntu13_amd64.tar.xz -C > /usr/x86_64-ubuntu1104-linux-gnu/sysroot > tar -xf src/linux-libc-dev_2.6.38-11.48_amd64.tar.xz -C > /usr/x86_64-ubuntu1104-linux-gnu/sysroot > tar -xf src/ia32-libs_20090808ubuntu13_amd64.tar.xz -C > /usr/x86_64-ubuntu1104-linux-gnu/sysroot > tar -xf src/libltdl7_2.2.6b-2ubuntu3_amd64.tar.xz -C > /usr/x86_64-ubuntu1104-linux-gnu/sysroot > > fixed up a few absolute symlinks, > > rm /usr/x86_64-ubuntu1104-linux-gnu/sysroot/lib64 > ln -sv lib /usr/x86_64-ubuntu1104-linux-gnu/sysroot/lib64 > #fix absolute symlinks > cd /usr/x86_64-ubuntu1104-linux-gnu/sysroot/usr/lib/x86_64-linux-gnu > for x in *; do if [ -h "$x" ];then LINK=../..`readlink $x`; ln -sf > $LINK $x; fi; done > cd /usr/x86_64-ubuntu1104-linux-gnu/sysroot/usr/lib/ > ln -sf x86_64-linux-gnu/* . > cd /usr/x86_64-ubuntu1104-linux-gnu/sysroot/lib > ln -sf x86_64-linux-gnu/* . > > rm /usr/x86_64-ubuntu1104-linux-gnu/sysroot/usr/include/asm > ln -sfv x86_64-linux-gnu/asm > /usr/x86_64-ubuntu1104-linux-gnu/sysroot/usr/include/asm > > then rebuilt binutils/gcc using the sysroot flag (I used the same > versions from LFS, so perhaps a bit newer then ubuntu's) > ../binutils-${BINUTILS_VERSION}/configure --prefix=/usr \ > --target=x86_64-ubuntu1104-linux-gnu \ > --with-sysroot=/usr/x86_64-ubuntu1104-linux-gnu/sysroot && > make && > make install && > > ../gcc-${GCC_VERSION}/configure --prefix=/usr \ > --target=x86_64-ubuntu1104-linux-gnu \ > --with-sysroot=/usr/x86_64-ubuntu1104-linux-gnu/sysroot \ > --enable-shared --enable-threads=posix \ > --enable-__cxa_atexit --enable-languages=c \ > --disable-libstdcxx-pch \ > --enable-long-long \ > --disable-libgomp --disable-libquadmath \ > --without-ppl --without-cloog && > make -j6 && > make install && > > (I based this upon my linux -> mingw64 compiler, may have a few extra > flags. I'll have to investigate later. although I don't think I > disabled any features I actually use) > > > > > > > It works fine and dandy, but I was wondering if I should be worrying > about the updates in ubuntu, and how hard it would be to setup an apt > repository and just pull the updates directly from ubuntu into a > sysroot folder. Would save time compared to hunting down the .deb's > then converting them manually. Decided to polish my response a bit To work around the fact that ubuntu apparantly chose to use different versions then I decided to, I built a cross compiler via sysroot. The code I fixed the absolute symlinks was subpar, replaced with the following (been using this for half a year, wonder when I messed that up) echo > build_relink.sh << "EOF" ln -svf ../../..`readlink $1` $1 "EOF" chmod 755 build_relink.sh find /usr/x86_64-ubuntu1104-linux-gnu/sysroot/usr/lib/x86_64-linux-gnu \ -lname '/*' -exec ./build_relink.sh '{}' ';' and fixed up gcc to use less flags ../gcc-${GCC_VERSION}/configure --prefix=/usr \ --target=x86_64-ubuntu1104-linux-gnu \ --with-sysroot=/usr/x86_64-ubuntu1104-linux-gnu/sysroot \ --enable-shared --enable-threads=posix \ --enable-__cxa_atexit --enable-languages=c \ --enable-long-long && make -j6 && make install && -- Nathan Coulson (conathan) ------ Location: British Columbia, Canada Timezone: PST (-8) Webpage: http://www.nathancoulson.com -- http://linuxfromscratch.org/mailman/listinfo/lfs-chat FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page