Monday, January 9, 2012

Cross Compile CCNx to Pandaboard ES

I'm trying to cross compile CCNx-0.4.2 but still having difficulty, I think I need to run init-key-helper but it always fail.  I cannot run ccnput too, it always fail encode ccnb.
To cut unnecessary overhead in this work, I compiled CCNx code directly in my pandaboard using ubuntu :)

Anyway this is the steps I have done so far:

1. Download CCNx 0.4.2 from http://www.ccnx.org
2. Dowload openssl-1.0.0d from http://www.openssl.org
3. Download expat-2.0.1

Unzip CCNx and create new folder 'external':
Unzip openssl and expat to this external folder, it will become like this:
CCNx-0.4.2/
-external/
--openssl--0.4.2/
--expat-2.0.1/

create a target folder in ccnx root folder:

mkdir -p target/arm/usr/local


Cross compile each external components:
1. Cross compile openssl



./config no-asm
make CC=arm-linux-gnueabi-gcc AR="arm-linux-gnueabi-ar r" RANLIB="arm-linux-gnueabi-ranlib"
make INSTALL_PREFIX=/home/yeffry/ccnx-0.4.2/target/arm/usr/local


or



./config no-asm --openssldir=$HOME/ccnx-0.4.2/target/arm/usr/local
make CC=arm-linux-gnueabi-gcc AR="arm-linux-gnueabi-ar r" RANLIB="arm-linux-gnueabi-ranlib"
make install


If you got problem compiling ccnx with error from openssl dso, try config openssl with no-dso options.

You could also modify the CC, AR and RANLIB in Makefile

Now openssl will be installed in your $HOME/ccnx-0.4.2/target/arm

2. Cross compile expat



./configure --host=arm-linux-gnueabi --prefix=$HOME/ccnx-0.4.2/target/arm/usr/local
make
make install


3. Cross compile libpcap



./configure --host=arm-linux-gnueabi --prefix=$HOME/ccnx-0.4.2/target/arm/usr/local --with-pcap=linux
make
make install


Now let's compile ccnx:
in ccnx root folder run:


./configure
./make

1 comment:

  1. Hi, Thanks for sharing the procedure for cross compilation. But i ma getting errors while doing the last stem (compiling the ccnx using arm-linux-gnueabi-gcc).
    I have updated the OPEN_SSL path in Linux.mk file to target/arm/usr/local. Still i am getting the below errors while doing make:
    arm-linux-gnueabi-gcc -static -Wall -Wpointer-arith -Wreturn-type -Wstrict-prototypes -I../include -I/home/user/ccnx-0.7.2/target/arm/usr/local/include -D_REENTRANT -fPIC -c -o hashtbtest.o hashtbtest.c
    arm-linux-gnueabi-gcc -static -Wall -Wpointer-arith -Wreturn-type -Wstrict-prototypes -I../include -I/home/user/ccnx-0.7.2/target/arm/usr/local/include -D_REENTRANT -fPIC -o hashtbtest hashtbtest.o -L../lib -lccn
    arm-linux-gnueabi-gcc -static -Wall -Wpointer-arith -Wreturn-type -Wstrict-prototypes -I../include -I/home/user/ccnx-0.7.2/target/arm/usr/local/include -D_REENTRANT -fPIC -c -o skel_decode_test.o skel_decode_test.c
    arm-linux-gnueabi-gcc -static -Wall -Wpointer-arith -Wreturn-type -Wstrict-prototypes -I../include -I/home/user/ccnx-0.7.2/target/arm/usr/local/include -D_REENTRANT -fPIC -o skel_decode_test skel_decode_test.o -L../lib -lccn
    arm-linux-gnueabi-gcc -static -Wall -Wpointer-arith -Wreturn-type -Wstrict-prototypes -I../include -I/home/user/ccnx-0.7.2/target/arm/usr/local/include -D_REENTRANT -fPIC -c -o encodedecodetest.o encodedecodetest.c
    arm-linux-gnueabi-gcc -static -Wall -Wpointer-arith -Wreturn-type -Wstrict-prototypes -I../include -I/home/user/ccnx-0.7.2/target/arm/usr/local/include -D_REENTRANT -fPIC -o encodedecodetest encodedecodetest.o -L../lib -lccn -L/home/user/ccnx-0.7.2/target/arm/usr/local/lib -lcrypto
    ../lib/libccn.a(ccn_setup_sockaddr_un.o): In function `ccn_setup_sockaddr_in':
    ccn_setup_sockaddr_un.c:(.text+0x20a): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /home/user/ccnx-0.7.2/target/arm/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
    dso_dlfcn.c:(.text+0x8): undefined reference to `dlopen'
    dso_dlfcn.c:(.text+0x12): undefined reference to `dlsym'
    dso_dlfcn.c:(.text+0x1a): undefined reference to `dlclose'
    /home/user/ccnx-0.7.2/target/arm/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_pathbyaddr':
    dso_dlfcn.c:(.text+0x58): undefined reference to `dladdr'
    dso_dlfcn.c:(.text+0x90): undefined reference to `dlerror'
    /home/user/ccnx-0.7.2/target/arm/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
    dso_dlfcn.c:(.text+0x30e): undefined reference to `dlsym'
    dso_dlfcn.c:(.text+0x394): undefined reference to `dlerror'
    /home/user/ccnx-0.7.2/target/arm/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
    dso_dlfcn.c:(.text+0x3fe): undefined reference to `dlsym'
    dso_dlfcn.c:(.text+0x47e): undefined reference to `dlerror'
    /home/user/ccnx-0.7.2/target/arm/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
    dso_dlfcn.c:(.text+0x4bc): undefined reference to `dlclose'
    /home/user/ccnx-0.7.2/target/arm/usr/local/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
    dso_dlfcn.c:(.text+0x550): undefined reference to `dlopen'
    dso_dlfcn.c:(.text+0x590): undefined reference to `dlclose'
    dso_dlfcn.c:(.text+0x5b6): undefined reference to `dlerror'
    collect2: ld returned 1 exit status
    make[2]: *** [encodedecodetest] Error 1
    make[2]: Leaving directory `/home/user/ccnx-0.7.2/csrc/lib'
    make[1]: *** [default] Error 1
    make[1]: Leaving directory `/home/user/ccnx-0.7.2/csrc'
    make: *** [default] Error 1
    user@anilmaguluri-ubuntu:~/ccnx-0.7.2$

    Please let me know how to resolve this.
    Thanks & Regards,
    Anil Kumar Maguluri

    ReplyDelete