Lester Romano
Lester Romano

Reputation: 11

Cross-compilation for ARM-embedded

I am trying to install Crypto++ for cross-compilation on a beaglebone black and I am using Ubuntu for compilation. I am quite a newbie in this please help me out.

I did:

. ./setenv-embedded.sh

And everything seems fine. Then I tried to the the make command:

make -f GNUmakefile-cross static static dynamic cryptest.exe

But I did not get the same output as shown at ARM Embedded (Command Line).

And then trying to test it.

/usr/bin/arm-linux-gnueabi-readelf -h ./cryptest.exe | grep -i 'class\|machine' 
Class:       Elf32
Machine:     Intel 80386

The machine is still Intel not ARM:

enter image description here

Can you help me with this one?

Thank you very much

Upvotes: 0

Views: 1051

Answers (1)

jww
jww

Reputation: 102386

If you notice, you get a message "nothing needs to be done for 'static'" (and friends).

You need to perform a make clean or make distclean to remove the previous i686/x86_64 build.

You should also ensure you are using the latest GNUmakefile-cross and the latest setenv-embedded.sh. If you are using Crypto++ 5.6.3 or above, then its already in Git and you only need to git pull. If you are using Crypto++ 5.6.2 and earlier, then you can download them from ARM Embedded (Command Line).


Here's what it looks like for me on Ubuntu 14.04.

$ . ./setenv-embedded.sh 
CPP: /usr/bin/arm-linux-gnueabi-cpp
CXX: /usr/bin/arm-linux-gnueabi-g++
AR: /usr/bin/arm-linux-gnueabi-ar
LD: /usr/bin/arm-linux-gnueabi-ld
RANLIB: /usr/bin/arm-linux-gnueabi-gcc-ranlib-4.7
ARM_EMBEDDED_TOOLCHAIN: /usr/bin
ARM_EMBEDDED_CXX_HEADERS: /usr/arm-linux-gnueabi/include/c++/4.7.3
ARM_EMBEDDED_FLAGS: -I/usr/arm-linux-gnueabi/include/c++/4.7.3 -I/usr/arm-linux-gnueabi/include/c++/4.7.3/arm-linux-gnueabi
ARM_EMBEDDED_SYSROOT: /usr/arm-linux-gnueabi

$ make -f GNUmakefile-cross 
/usr/bin/arm-linux-gnueabi-g++ -DNDEBUG -g2 -Os -fPIC -pipe
  -I/usr/arm-linux-gnueabi/include/c++/4.7.3
  -I/usr/arm-linux-gnueabi/include/c++/4.7.3/arm-linux-gnueabi
  --sysroot=/usr/arm-linux-gnueabi -c cryptlib.cpp
  ...

And then:

$ /usr/bin/arm-linux-gnueabi-readelf -h ./libcryptopp.a | grep -i 'class\|machine' | head -2
  Class:                             ELF32
  Machine:                           ARM

But I did not get the same output as shown at ARM Embedded (Command Line).

I can't dump things for libcryptopp.so or cryptest.exe because it appears Ubuntu tool chain took a regression. The linker can no longer link an executable.


Ubuntu's cross-compiler is kind of borked. We filed a few bug reports against in when writing the examples on the wiki. Its the reason we provide an example of using ARM's cross-compiler at ARM Embedded (Bare Metal).

Upvotes: 2

Related Questions