Bruce
Bruce

Reputation: 35285

Cross-compiling ltrace for arm-linux

After a bunch of patches I was able to run the Makefile and it now crashes at the final step :(. Here is the error I get:

arm-none-linux-gnueabi-gcc main.o libltrace.a -lelf -o ltrace
arm-none-linux-gnueabi-gcc/bin/ld: cannot find -lelf
collect2: ld returned 1 exit status
make: *** [ltrace] Error 1

I want to run ltrace on Android. Will appreciate any input.

Upvotes: 1

Views: 4631

Answers (3)

Brian O'Dell
Brian O'Dell

Reputation: 3059

Consider Scratchbox. I personally hate cross compiling, especially because I am a huge Python fan, and it is hard to cross compile Python, because it wants to run the python executable (the one that was just built) as a part of the build process. This obviously causes problem when you've compiled an ARM version of Python on your x86 desktop. Because Scratchbox uses emulation, it (and you) can run your ARM binaries on your desktop system (inside the scratchbox environment), that solves a ton of cross compilation issues.

ScratchBox was used for the now defunct Maemo operating system (running on ARM), but people have had success using it for Android:

If you go this route, let me know in the comment section. I have a scratchbox virtual machine sitting around for when I used to develop for Maemo. I am writing Android software now, so I have some personal interest in getting scratchbox working for android.

Upvotes: 1

bazsi77
bazsi77

Reputation: 541

you can't use the libelf library on your own system. you are trying to cross-compile after all. your computer is probably x86 based, the phone is arm. Even if you can convince the compiler to link the final executable, you x86 code will not run on arm.

You have two options:

1) compile libelf too with the cross compiler

2) try grabbing the arm version of libelf from the Debian archive, extract it using dpkg -x to a private directory, and try to link against that.

you can use specify the library name via a full path instead of -l.

Upvotes: 3

Ed Burnette
Ed Burnette

Reputation: 1198

Try: apt-get install libelf-dev and see ld cannot find an existing library

Upvotes: 1

Related Questions