0

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

jww
  • 97,681
  • 90
  • 411
  • 885
  • 1
    Don't post images. Paste the text in your question! – too honest for this site Dec 17 '15 at 19:35
  • @Lester - I was able to compile Crypto++ natively on a BeagleBone Black (no need for cross-compiling). The BBB image is preloaded with Git, GCC, Make, etc. The Debian images include Qt. Have you tried SSH'ing into you BBB and compiling just like you would on a desktop? – jww Dec 22 '15 at 12:34
  • @Lester - we recently added a message to [direct you to the next step after running `setenv-*.sh`](https://github.com/weidai11/cryptopp/commit/a6090c64edfc51d9d573398d4b266b2718d09546). I'm kicking myself in in my ass-end because I should have realized it was needed a long time ago. – jww Jun 14 '16 at 00:46
  • really appreciate this @jww Thank you! – Lester Romano Jun 14 '16 at 15:23

1 Answers1

2

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).

jww
  • 97,681
  • 90
  • 411
  • 885
  • Your solution works. Thanks alot. However I am having this trouble. "/usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../../arm-linux-gnueabihf/bin/ld: failed to merge target specific data of file zinflate.o" do you know what this is ? – Lester Romano Dec 16 '15 at 07:06
  • @Lester - I have not encountered it, so I don't know how to fix it. You might take a look at [ARM compilation error, VPF registered used by executable, not object file](http://stackoverflow.com/q/9753749). – jww Dec 16 '15 at 07:18