HALF-ASS Instructions on setting up native arm-gcc toolchain. ------------------------------------------------------------- First you need to have a means to compile to arm target. A good instruction for compiling an arm-gcc cross-compiler is at "http://www.handhelds.org/z/wiki/HOWTO Build a Cross Toolchain in Brief" Even if you already have an arm-gcc cross-compiler, you should probably work through those instructions first, even if just as an excercize because building gcc can be a pretty big deal if you have never done it before. INSTRUCTIONS 1. Get or build arm cross-tools. 2. Even if you didn't build your arm cross-toolchain, go look at the instructions on the handhelds.org wiki (http://www.handhelds.org/z/wiki/HOWTO Build a Cross Toolchain in Brief), and get all the source packages mentioned there: gcc-fold-const.patch gcc-2.95.2-diff-991022 binutils-2_9_5_0_22_tar gcc-2.95.2 glibc-2.1.2 3. Unpack the sources...you will already have these source trees if you build your own arm cross-toolchain. unpack gcc patch gcc unpack glibc unpack binutils 4. Build arm-native-binutils using the arm cross-tools Make a directory like "binutils-obj-native" cd into this directory and run the binutils configure script: ../binutils-2_9_5/configure --prefix=/skiff/usr/local --target=arm-linux --build=i686-pc-linux-gnu make make install Now you should have ranlib and some other things in /skiff/usr/local/bin cd into /skiff/usr/local/bin and make a sym link from ./ranlib to ./arm-linux-ranlib Or, don't do that now, but do it later when some other script asks you for it! You've been warned! 5. Build arm-native-gcc using the arm-cross tools Make a directory like "gcc-obj-native" cd into this directory and run the gcc configure script: ../gcc-2_95_2/configure --prefix=/usr/local --target=arm-linux --build=i686-pc-linux-gnu (I think we may need "/skiff/usr/local/bin" in our path, and I think this is where we begin to need the arm-linux-ranlib sym link) next, make LANGUAGES=c,c++ I found that if I didn't make c++ and c at the same time, I had problems with libtsdc++...see below* Now things get a little screwy. We had to use --prefix=/usr/local. That is so gcc will look for c libs in /usr/local/lib There used to be some option I think in building gcc that we could designate manually where gcc was to look for it's c libs. (You see, compiling binutils, we just used prefix /skiff/usr/local, and install was easy) but if we do that to gcc, then gcc will be lost. So.....we must run "make install" from the iPAQ. TO do this, you nfs-mount /skiff from your desktop to /skiff on your iPAQ. Then you nfs mount /skiff/usr to /usr on the iPAQ. Then cd into /skiff/src/gcc-obj-native and run "make install" Now you have gcc and friends in /usr/local/ I had some half-baked idea that I could get around this by running make install from a chroot environment on the desktop, and therefore I wouldn't have to run make install from the iPAQ over the NFS share. If that makes sense to you then maybe it will work, but I have never tried it. 6. Buld arm-native-glibc using arm-cross tools You'll need to have a linux kernel for arm installed and configured, so you can get it's headers. In /skiff/usr/local/include/arm-linux/include you will need to have copied or sym linked asm and linux directories (from ARMKERNELSRC/include) Make a directory like "glibc-obj-native" cd into this directory and run the glibc configure script: ../glibc-2_1_2/configure --prefix=/usr/local/arm-linux --target=arm-linux --build=i686-pc-linux-gnu --enable-add-ons=linuxthreads,crypt Notice that we added the extra pathname component to --prefix (otherwise libc won't be found when linking) It just kind of throws me off because it's the sort of thing you have to do when building cross tools. Oh well it works. So, now do "make" Then, you can do the make install from the desktop..."make install install_root=/skiff" 7. Verify libstdc++ cd into /skiff/usr/local/lib/gcc-lib/arm-linux/2.95.2, and verify the sym link for libstdc++.a I had to do "ln -s ../../../../lib/libstdc++.a.2.10.0 libstdc++.a". My system must have been slightly confused when I installed gcc, and had the sym link wrong ( it had one "../" too many!). Another thing you can do is verify your libstdc++ builtin symbols, I can't remember the details (found it on a message board) but it has something to do with symbols being defined in libgcc.a as opposed to libstdc++.a I found that if you tried to build gcc with "make LANGUAGES=c", and then come back later and try to install c++ over the top of your first installation, you may not have the symbols right. So, try this: $ cat test.cpp int main () { new int; new int [1]; } $ gcc test.cpp /tmp/ccx2Rwli.o: In function `main`: /tmp/ccx2Rwli.o(.text+0xc): undefined reference to `__builtin_new` /tmp/ccx2Rwli.o(.text+0x19): undefined reference to `__builtin_vec_new` collect2: ld returned 1 exit status and if all is well, you won't have the ld error. You can also check out the symbols by running the following command (from desktop or iPAQ, doesn't matter).... $ nm -C /skiff/usr/local/lib/libgcc.a | grep __builtin_new ...and here's what you should get: U __builtin_new U __builtin_new 8. Now build some stuff and have fun. If any of this doesn't work for you, it's not because it's a bad idea, it's just a combination of my bad instruction, and you not knowing what you are doing. Having a gcc-compiler on the iPAQ is very cool. If you had a nice big storage card, and a spiffy text editor, you could be the envy of people far and wide, writing and compiling programs... You can use the compiler by exporting it's dirctory over NFS to iPAQ, or by copying the appropriate arm-gcc family of directories and files from the installed location on the desktop to sufficiently large /usr/local partition on iPAQ. You may need to follow instructions at "http://www.handhelds.org/minihowto/" for building X and building X-clients.