Linux complier and versions

I’ve created a VM with the Digi embedded Linux. Does the cmd line complier, compile for the target Arm device, or for the native platform?

It’s just that I wish to compile and open source library for the me9201 device. The open source library code base has a complicated configuration build script and I am not sure what I will get if I use gcc. IF the gcc is for the local machine, how can I set gcc to compile for the arm.

Thanks

The VM should provide you with two compilers: gcc (which will compile binaries for x86), and arm-linux-gcc (which will compile ARM binaries). You just need to specify this compiler as the one your system uses. I’m not using the VM to build stuff but I assume that it has arm-linux-gcc in the PATH environment variable (echo $PATH … look for /usr/local/DigiEL-5.9/x-tools/arm-[stuff]-linux-gnueabi/bin). If that’s the case, for a generic autoconf-based library (I’ll use lzo as an example), you can do this:

tar -xvzf lzo-2.06.tar.gz
cd lzo-2.06
CFLAGS=‘your favorite cflags’ ./configure --build=x86_64-unknown-linux-gnu --host=arm-linux --target=arm-linux
make

… using --build, --host, and --target will tell the autoconf script that arm-linux-gcc is your compiler and it will figure the rest out on its own.

If your open source library doesn’t use autoconf, you’ll have to do other stuff like setting CC=arm-linux-gcc but that’s going to vary based on what the build process is.

When you’re done compiling, you can verify that the final product will run on the module by finding an executable and checking its type; in the lzo example I would say

file minilzo/testmini

and the output will look something like this:

testmini: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped

Here is an example of command line crosscompiling an open source application for DEL 5.7:

export PATH=/usr/local/DigiEL-5.7/x-tools/arm-unknown-linux-uclibcgnueabi/bin:$PATH
export TOOLCHAIN_DIR=/usr/local/DigiEL-5.7/x-tools/arm-unknown-linux-uclibcgnueabi/

wget http://curl.haxx.se/download/curl-7.29.0.tar.gz
tar xvfz curl-7.29.0.tar.gz
cd curl-7.29.0

CC=arm-linux-gcc ./configure --host=arm-linux --target=arm-linux --prefix=/usr/local/DigiEL-5.7/x-tools/arm-unknown-linux-uclibcgnueabi

make CC=arm-linux-gcc
make install

Here is another example for DEL 5.9 and i.mx28 target
export PATH=/usr/local/DigiEL-5.9/x-tools/arm-unknown-linux-gnueabi/bin:$PATH
export TOOLCHAIN_DIR=/usr/local/DigiEL-5.9/x-tools/arm-unknown-linux-gnueabi/

wget http://www.tcpdump.org/release/tcpdump-4.3.0.tar.gz
wget http://www.tcpdump.org/release/libpcap-1.3.0.tar.gz
tar xvfz libpcap-1.3.0.tar.gz

cd libpcap-1.3.0/
CC=arm-linux-gcc ./configure --host=arm-linux --target=arm-linux --prefix=/usr/local/DigiEL-5.9/x-tools/arm-unknown-linux-gnueabi --with-pcap=linux
make
make install

cd …
tar xvfz tcpdump-4.3.0.tar.gz
cd tcpdump-4.3.0/
vi configure
Find in configure and change ac_cv_linux_vers=unknown to ac_cv_linux_vers=2

CC=arm-linux-gcc ./configure --host=arm-linux --target=arm-linux --prefix=/usr/local/DigiEL-5.9/x-tools/arm-unknown-linux-gnueabi
make
make install

Hi,

i did this with the lighttpd on my host computer. How do i get the compiled software on my i.mx28 target?

thanks

nils

transfer it via NFS, FTP , or SD card

Ok, i understand. But what if the application i want to compile has dependencies on my target system. But using ./configure searches on my host system.

Something like --with-openssl=/… etc. (i know openssl is pre compiled - just an example)?

For an example, i get the error “./arm-linux-lighttpd: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory” executing lighttpd.

I cross-compiled it with:
CC=arm-linux-gcc ./configure PCRECONFIG=/${ROOTFS_DIR}/home/default/pcre/bin/pcre-config PCRE_LIB=//${ROOTFS_DIR}/home/default/pcre/libpcre.a CFLAGS=“$CFLAGS -DHAVE_PCRE_H=1 -DHAVE_LIBPCRE=1 -I/${ROOTFS_DIR}/home/default/pcre/include” --without-bzip2 --prefix=/${ROOTFS_DIR}/home/default/lighttpd --host=arm-linux --target=arm-linux

you need to also transfer all relevant libraries to the target. if the library is part of the package you need to “make install” that package in to some folder, then transfer the contents of that folder in to relevant folders on target.