Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How did you build ltrace? #2

Open
TheCloudlessSky opened this issue Jul 19, 2018 · 1 comment
Open

How did you build ltrace? #2

TheCloudlessSky opened this issue Jul 19, 2018 · 1 comment

Comments

@TheCloudlessSky
Copy link

Hey,

Thanks a lot for these binaries - they've been incredibly useful for me 😄. I was trying to create a static build of ltrace when I gave up and found your project. Would you be willing to share the exact steps you took to create the static binary of ltrace? I've been running into issues getting libelf to statically link properly and I'd really like to see how someone else is doing it. Here's what I have on Ubuntu using a specific ARM cross compiler:

  • $ git clone https://github.com/WolfgangSt/libelf
  • $ cd libelf
  • $ autoreconf -fvi
  • $ CC="my-arm-cross-compiler" ./configure --host=my-arm-cross-compiler --disable-shared
  • $ make (libelf is now built)
  • $ cd ../
  • $ wget https://www.ltrace.org/ltrace_0.7.3.orig.tar.bz2
  • $ tar xvjf ./ltrace_0.7.3.orig.tar.bz2
  • $ cd ltrace-0.7.3
  • $ autoreconf -fvi
  • $ CFLAGS="-Wno-error -Wl,-static -static-libgcc -static" CPPFLAGS="-I/path/to/built/libelf/lib -D__LIBELF_INTERNAL__" LDFLAGS="-L/path/to/built/libelf/lib" ./configure --host=my-arm-cross-compiler --disable-shared
  • $ make

But this is failing with errors (e.g. libelf not linking properly) and I'd like to see where I'm going wrong. So, I would appreciate it if you have the time to provide instructions on how to create a static binary of ltrace for ARM.

@deividAlfa
Copy link

deividAlfa commented Jun 6, 2021

Thanks for the instructions! It worked nicely for me, cross-compiled to arm!
This were my steps:

  • $ git clone https://github.com/WolfgangSt/libelf
  • $ cd libelf
  • $ autoreconf -fvi
  • $ CC="arm-linux-gnueabi-gcc" ./configure --host=arm-linux-gnueabi --disable-shared
  • $ make
  • $ cd ../
  • $ git clone https://github.com/dkogan/ltrace
  • $ cd ltrace
  • $ ./autogen.sh
  • $ CFLAGS="-Wno-error -Wl,-static -static-libgcc -static" CPPFLAGS="-I/home/user/libelf/lib -D__LIBELF_INTERNAL__" LDFLAGS="-L/home/user/libelf/lib" ./configure --host=arm-linux-gnueabi --disable-shared
  • $ make

Copied ltrace to the arm linux system and it executed ok... but always gav error:
"Couldn't get data of section #0 from "/proc/xxxx/exe"

Luckly these builds worked. Saved my life!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants