native toolchain in optware feed for beta testing
Forum » Forum / Optware » native toolchain in optware feed for beta testing
started by: bzhoubzhou
on: 1214546665|%e %b %Y, %H:%M %Z|agohover
number of posts: 14
rss icon RSS: new posts
summary:
native toolchain from optware cross build environment
native toolchain via optware?
bzhoubzhou 1214546665|%e %b %Y, %H:%M %Z|agohover

Hi all,

Recently I added native toolchain (gcc4) to openwrt-ixp4xx and cs06q3armel optware feed. It consists of three ipk's: binutils, gcc, and libc-dev. With some small change to the optware mk files, now it can build certain versions of gcc3 as well.

Although I don't have a MBWE so I cannot test, it occurs to me that this can apply to gumstix1151 feed too. I know there is gcc binary toolchain already, but wouldn't it be nice that you can build & install your own with ipkg? And a more recent version as well! If this is working, you no longer need to recover the binary toolchain from the old firmware.

Here are the steps (assuming you're on linux with build-essential already installed):

$ cd $HOME         (you can use whatever directory you want, of course)
 $ svn co http://svn.nslu2-linux.org/svnroot/optware/trunk optware
 $ cd $HOME/optware
 $ make gumstix1151-target && cd gumstix1151
 $ make directories ipkg-utils toolchain    (toolchain build will take a while)
 $ make binutils-ipk
 $ make gcc-ipk NATIVE_GCC_VERSION=3.4.6
 $ make libc-dev-ipk

The file copying of the last two steps still need some work. They's basically copying files from cross toolchain to ipk. The build result will be under optware/gumstix1151/builds/.

Some one wanna try? If someone get this to work, I can add those to ipkg feed. I'm often available on #nslu2-linux (nick eno) if you have question on the last two steps.

-Brian
bzhou at nslu2 dash linux dot org

unfold native toolchain via optware? by bzhoubzhou, 1214546665|%e %b %Y, %H:%M %Z|agohover
Re: native toolchain via optware?
bzhoubzhou 1214836904|%e %b %Y, %H:%M %Z|agohover

According to http://docwiki.gumstix.org/Buildroot
The svn co step of svn.gumstix.com now requires authentication, use root/root.

unfold Re: native toolchain via optware? by bzhoubzhou, 1214836904|%e %b %Y, %H:%M %Z|agohover
Re: native toolchain via optware?
bzhoubzhou 1214967437|%e %b %Y, %H:%M %Z|agohover

I've fixed a problem in libc-dev.mk, now libc-dev-ipk also can be built.

last edited on 1214967503|%e %b %Y, %H:%M %Z|agohover by bzhou + show more
unfold Re: native toolchain via optware? by bzhoubzhou, 1214967437|%e %b %Y, %H:%M %Z|agohover
Re: native toolchain via optware?
jnscjnsc 1215007120|%e %b %Y, %H:%M %Z|agohover

Done, now libc-dev-ipk builds ok

unfold Re: native toolchain via optware? by jnscjnsc, 1215007120|%e %b %Y, %H:%M %Z|agohover
Re: native toolchain via optware?
bzhoubzhou 1215013300|%e %b %Y, %H:%M %Z|agohover

Now is the moment of truth, does it work?
Transfer the three ipk's to yourbook, ipkg install them (in the order of libc-dev, binutils, and gcc). And try compile a hello.c or something.

unfold Re: native toolchain via optware? by bzhoubzhou, 1215013300|%e %b %Y, %H:%M %Z|agohover
Re: native toolchain via optware?
jnscjnsc 1215022297|%e %b %Y, %H:%M %Z|agohover

Ok, for this moment of truth we will have to wait until Friday. Because I'm not at home and don't have access to the box right now. And it will be faster to wait than explaining to my Girlfriend how to enable nat on the router :-).

unfold Re: native toolchain via optware? by jnscjnsc, 1215022297|%e %b %Y, %H:%M %Z|agohover
Re: native toolchain via optware?
jnscjnsc 1215377938|%e %b %Y, %H:%M %Z|agohover

Sorry for being late, but now I'm managed to install everything. Here is what I tried to compile:

#include <stdio.h>

int main()
{
printf("It works\n");
return 0;
}

It seems to be a lib error, but even with -L flag for gcc I did not manage to get it working. But I did not try very hard. Maybe tomorrow I get the time to test a bit more.

unfold Re: native toolchain via optware? by jnscjnsc, 1215377938|%e %b %Y, %H:%M %Z|agohover
Re: native toolchain via optware?
bzhoubzhou 1215388772|%e %b %Y, %H:%M %Z|agohover

What is the output of

gcc --version
gcc -v -c -o it-works.o it-works.c
gcc -v -o it-works it-works.o
./it-works
last edited on 1215390036|%e %b %Y, %H:%M %Z|agohover by bzhou + show more
unfold Re: native toolchain via optware? by bzhoubzhou, 1215388772|%e %b %Y, %H:%M %Z|agohover
Re: native toolchain via optware?
jnscjnsc 1215412244|%e %b %Y, %H:%M %Z|agohover

/opt/bin/gcc —version
gcc (GCC) 3.4.6

/opt/bin/gcc -v

Reading specs from /opt/lib/gcc/arm-linux-uclibc/3.4.6/specs
Configured with: ../gcc-3.4.6/configure —build=i386-pc-linux-gnu —host=arm-linux-uclibc —target=arm-linux-uclibc —prefix=/opt —disable-nls —disable-static —with-as=/home/jnsc/Project/optware/gumstix1151/toolchain/gumstix-buildroot/build_arm_nofpu/staging_dir/bin/arm-linux-uclibc-as —with-ld=/home/jnsc/Project/optware/gumstix1151/toolchain/gumstix-buildroot/build_arm_nofpu/staging_dir/bin/arm-linux-uclibc-ld —enable-languages=c,c++
Thread model: posix
gcc driver version 3.4.6 executing gcc version 3.4.5

The —with-ld= seems weired, here is the output of the original gcc

Using built-in specs.
Configured with: /data/releases/v1.18/buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure —prefix=/usr —build=i386-pc-linux-gnu —host=arm-linux-uclibc —target=arm-linux-uclibc —enable-languages=c,c++ —enable-shared —with-gxx-include-dir=/usr/include/c++ —disable-__cxa_atexit —enable-target-optspace —with-gnu-ld —disable-nls —enable-threads —enable-multilib —with-float=soft
Thread model: posix
gcc version 3.4.2

/opt/bin/gcc -v -c -o test.o test.c

Reading specs from /opt/lib/gcc/arm-linux-uclibc/3.4.6/specs
Configured with: ../gcc-3.4.6/configure —build=i386-pc-linux-gnu —host=arm-linux-uclibc —target=arm-linux-uclibc —prefix=/opt —disable-nls —disable-static —with-as=/home/jnsc/Project/optware/gumstix1151/toolchain/gumstix-buildroot/build_arm_nofpu/staging_dir/bin/arm-linux-uclibc-as —with-ld=/home/jnsc/Project/optware/gumstix1151/toolchain/gumstix-buildroot/build_arm_nofpu/staging_dir/bin/arm-linux-uclibc-ld —enable-languages=c,c++
Thread model: posix
gcc driver version 3.4.6 executing gcc version 3.4.5
/opt/libexec/gcc/arm-linux-uclibc/3.4.6/cc1 -quiet -v -DARM_ARCH_3 test.c -quiet -dumpbase test.c -auxbase-strip test.o -version -o /tmp/cccZLJSg.s
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/opt/lib/gcc/arm-linux-uclibc/3.4.6/../../../../arm-linux-uclibc/include"
#include "…" search starts here:
#include <…> search starts here:
/opt/include
/opt/lib/gcc/arm-linux-uclibc/3.4.6/include
/usr/include
End of search list.
GNU C version 3.4.6 (arm-linux-uclibc)
compiled by GNU C version 3.4.5.
GGC heuristics: —param ggc-min-expand=30 —param ggc-min-heapsize=4096
as -mfpu=softvfp -mfpu=softvfp -o test.o /tmp/cccZLJSg.s

/opt/bin/gcc -v -o test test.o

Reading specs from /opt/lib/gcc/arm-linux-uclibc/3.4.6/specs
Configured with: ../gcc-3.4.6/configure —build=i386-pc-linux-gnu —host=arm-linux-uclibc —target=arm-linux-uclibc —prefix=/opt —disable-nls —disable-static —with-as=/home/jnsc/Project/optware/gumstix1151/toolchain/gumstix-buildroot/build_arm_nofpu/staging_dir/bin/arm-linux-uclibc-as —with-ld=/home/jnsc/Project/optware/gumstix1151/toolchain/gumstix-buildroot/build_arm_nofpu/staging_dir/bin/arm-linux-uclibc-ld —enable-languages=c,c++
Thread model: posix
gcc driver version 3.4.6 executing gcc version 3.4.5
/opt/libexec/gcc/arm-linux-uclibc/3.4.6/collect2 —eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test crt1.o crti.o /opt/lib/gcc/arm-linux-uclibc/3.4.6/crtbegin.o -L/opt/lib/gcc/arm-linux-uclibc/3.4.6 test.o -lgcc —as-needed -lgcc_s —no-as-needed -lc -lgcc —as-needed -lgcc_s —no-as-needed /opt/lib/gcc/arm-linux-uclibc/3.4.6/crtend.o crtn.o
/usr/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status

unfold Re: native toolchain via optware? by jnscjnsc, 1215412244|%e %b %Y, %H:%M %Z|agohover
Re: native toolchain via optware?
bzhoubzhou 1215441490|%e %b %Y, %H:%M %Z|agohover

crt1.o and a bunch of other files are in /opt/arm-linux/lib (in libc-dev ipk), while ld (collect2) is probably searching for /opt/arm-linux-uclibc/lib or /opt/lib/gcc/arm-linux-uclibc/3.4.6. Can you try

# mkdir -p /opt/arm-linux/uclibc/lib
# cp -p /opt/arm-linux/lib/* /opt/arm-linux/uclibc/lib/

then "/opt/bin/gcc -v -o test test.o" again?

To see the exact lib search dirs, you can use

gcc -print-search-dirs 2>&1 | sed -n 's/^libraries: =//p' | tr ':' '\n'
last edited on 1215441670|%e %b %Y, %H:%M %Z|agohover by bzhou + show more
unfold Re: native toolchain via optware? by bzhoubzhou, 1215441490|%e %b %Y, %H:%M %Z|agohover
Re: native toolchain via optware?
jnscjnsc 1215445333|%e %b %Y, %H:%M %Z|agohover

/opt/bin/gcc -v -o test test.o

Reading specs from /opt/lib/gcc/arm-linux-uclibc/3.4.6/specs
Configured with: ../gcc-3.4.6/configure —build=i386-pc-linux-gnu —host=arm-linux-uclibc —target=arm-linux-uclibc —prefix=/opt —disable-nls —disable-static —with-as=/home/jnsc/Project/optware/gumstix1151/toolchain/gumstix-buildroot/build_arm_nofpu/staging_dir/bin/arm-linux-uclibc-as —with-ld=/home/jnsc/Project/optware/gumstix1151/toolchain/gumstix-buildroot/build_arm_nofpu/staging_dir/bin/arm-linux-uclibc-ld —enable-languages=c,c++
Thread model: posix
gcc driver version 3.4.6 executing gcc version 3.4.5
/opt/libexec/gcc/arm-linux-uclibc/3.4.6/collect2 —eh-frame-hdr -dynamic-linker /lib/ld-uClibc.so.0 -X -m armelf_linux -p -o test crt1.o crti.o /opt/lib/gcc/arm-linux-uclibc/3.4.6/crtbegin.o -L/opt/lib/gcc/arm-linux-uclibc/3.4.6 test.o -lgcc —as-needed -lgcc_s —no-as-needed -lc -lgcc —as-needed -lgcc_s —no-as-needed /opt/lib/gcc/arm-linux-uclibc/3.4.6/crtend.o crtn.o
/usr/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status

/opt/bin/gcc -print-search-dirs 2>&1 | sed -n 's/^libraries: =//p' | tr ':' '\n'

/opt/lib/gcc/arm-linux-uclibc/3.4.6/
/usr/lib/gcc/arm-linux-uclibc/3.4.6/
/opt/lib/gcc/arm-linux-uclibc/3.4.6/../../../../arm-linux-uclibc/lib/arm-linux-uclibc/3.4.6/
/opt/lib/gcc/arm-linux-uclibc/3.4.6/../../../../arm-linux-uclibc/lib/

unfold Re: native toolchain via optware? by jnscjnsc, 1215445333|%e %b %Y, %H:%M %Z|agohover
Re: native toolchain via optware?
bzhoubzhou 1215447338|%e %b %Y, %H:%M %Z|agohover

ok, how about

cp -p /opt/arm-linux/lib/* /opt/lib/gcc/arm-linux-uclibc/3.4.6/
unfold Re: native toolchain via optware? by bzhoubzhou, 1215447338|%e %b %Y, %H:%M %Z|agohover
Re: native toolchain via optware?
jnscjnsc 1215454146|%e %b %Y, %H:%M %Z|agohover

I got c and c++ to compile. Here is the simple bit of code I used for c++

#include <iostream>
using namespace std;

int main() {
cout « "It works" « endl;
return 0;
}

unfold Re: native toolchain via optware? by jnscjnsc, 1215454146|%e %b %Y, %H:%M %Z|agohover
Re: native toolchain via optware?
bzhoubzhou 1215464171|%e %b %Y, %H:%M %Z|agohover

Thanks jnsc for the alpha testing. I added the native toolchain packages (gcc, binutils, libc-dev) into optware/gumstix1151 feed with some small fixes. Now people can beta test these by "ipkg update; ipkg install gcc".

unfold Re: native toolchain via optware? by bzhoubzhou, 1215464171|%e %b %Y, %H:%M %Z|agohover
new post
Unless stated otherwise Content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License