3

I am a java developer. I have some C++ code to make some system realted calls. This code is compiled on Intel 32-bit platform using GCC (I have make files) and it works fine on regular Intel based 32-bit linux machine. Now I need to run this on a linux OS running on Marvell ARM processor. When I load the shared objects in java I get the following error.

cannot open shared object file: No such file or directory (Possible cause: can't load IA 32-bit .so on a ARM-bit platform)

Please tell me how to resolve this issue. I looked at the GCC options and I found one option to specify the architecture (-march=armv5) and I can't compile with that option.

Thanks in advance.

6
  • 8
    You need a cross-compiler, or just re-compile on the Linux ARM system. Commented Jan 19, 2011 at 20:38
  • 3
    Visit ymorin.is-a-geek.org/hg/crosstool-ng which supplies a suite for creating cross-compilers for many host and target platforms Commented Jan 19, 2011 at 20:43
  • 1
    Also, crosstool-ng homepage: ymorin.is-a-geek.org/projects/crosstool Commented Jan 19, 2011 at 20:55
  • @Hasturkun: Already mentioned that!? Commented Jan 19, 2011 at 21:14
  • 1
    get the codesourcery compiler and cross compile your program (replace gcc with arm-none-linux-gcc, etc in the makefile). Commented Jan 20, 2011 at 2:41

3 Answers 3

7

You need more than just a switch, you need a cross-compiler. You can make your own, but probably the easiest way is :

  • Find the development tools for your board. It probably comes with a development kit that includes a cross-compilation toolchain

  • If you don't have these, you can try to install a precompiled cross-compilation like the ones provided freely by CodeSourcery

Then you have to make the location of your toolchain (look for something like arm-none-linux-gnueabi-gcc) available in your path.

Cross compiling simple project is then easy, just override the CC variable in your Makefile :

CROSS = arm-none-linux-gnueabi-
CC = $(CROSS)gcc
LD = $(CROSS)ld
Sign up to request clarification or add additional context in comments.

Comments

0

Try using the -mcpu=armv5 switch for gcc.

2 Comments

-mcpu is deprecated. if I use -march=armv5, i get the following error. error: bad value (armv5) for -march= switch
In most cases (this case included) you need a cross compiler that targets the ARM environment and the compiler that produced the intel code will not know how to also compile arm code.
0

Here is what's written on http://elinux.org/RPi_Software#ARM:

-Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.