简体   繁体   中英

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.

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.

尝试:apt-get install libelf-dev并看到ld找不到现有的库

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM