honggyukim / heaptrace

a tool that collects and reports heap allocated memory
GNU General Public License v2.0
13 stars 3 forks source link

`GLIBC` version unmatching issue for some cross compile environment #16

Closed Bojun-Seo closed 1 year ago

Bojun-Seo commented 1 year ago

heaptrace failed to run because of GLIBC version unmatching for following cross compile environment. I'm curious about the reason why heaptrace require specific GLIBC version and the location of GLIBC version checking logic in heaptrace.

Target information

Arch: arm64 (raspberry pi)
OS: Debian GNU/Linux 11 (Raspbian 64 bits version)

Unmatching case

Host arch: x86_64
Host OS: Ubuntu 22.04.1 LTS
Host compiler: aarch64-linux-gnu-g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Compile command: CROSS_COMPILE=aarch64-linux-gnu- make

I copied heaptrace file and libheaptrace.so to the same directory on the target. Run heaptrace and got error like below.

$ ./heaptrace /usr/bin/ls
./heaptrace: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./heaptrace)

But, there's no problem on following environment.

Host arch: x86_64
Host OS: Ubuntu 18.04.6 LTS
Host compiler: aarch64-linux-gnu-g++ (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0
Compile command: CROSS_COMPILE=aarch64-linux-gnu- make
Bojun-Seo commented 1 year ago

This issue happens not because heaptrace has any problem but it is a normal cross compile environment issue. There are a lot of solutions to resolve this kind of issues and openembedded is one of the solution. https://www.openembedded.org/wiki/Main_Page I'll share or update openembedded build script(bb file) later if I could.