Linaro / OpenCSD

CoreSight trace stream decoder developed openly
https://github.com/Linaro/opencsd/wiki
Other
141 stars 53 forks source link

perf+opencsd static link build failure #29

Closed saiprakash-ranjan closed 4 years ago

saiprakash-ranjan commented 4 years ago

I have been trying to build perf statically linked with opencsd. It is very useful on boards without proper rootfs and use initramfs.

So I am trying to build perf natively on arm64 board with debian os, but I always see tons of below errors when I try to build perf+opencsd statically linked, is it not supported? gcc version 8.3.0 (Debian 8.3.0-6)

make LDFLAGS=-static -C tools/perf VF=1 CORESIGHT=1

/usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/8/../../../aarch64-linux-gnu/libc.a(dl-version.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_dl_ns' which may bind externally can not be used when making a shared object; recompile with -fPIC

There are a lot more of other similar errors.

mikel-armbb commented 4 years ago

Hi Sai,

I can successfully build and run a statically linked version of the test program trc_pkt_lister using the static libraries built with opencsd (libopencsd.a). libopencsd.a is normally installed alongside libopencsd.so, both are created with the same object files compiled with -fPIC.

So the issue you are seeing is either with the installed gcc libraries on your system, or the perf build process itself.

Regards

Mike

On Tue, 13 Oct 2020 at 09:05, Sai Prakash Ranjan notifications@github.com wrote:

I have been trying to build perf statically linked with opencsd. It is very useful on boards without proper rootfs and use initramfs.

So I am trying to build perf natively on arm64 board with debian os, but I always see tons of below errors when I try to build perf+opencsd statically linked, is it not supported? gcc version 8.3.0 (Debian 8.3.0-6)

make LDFLAGS=-static -C tools/perf VF=1 CORESIGHT=1

/usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/8/../../../aarch64-linux-gnu/libc.a(dl-version.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_dl_ns' which may bind externally can not be used when making a shared object; recompile with -fPIC

There are a lot more of other similar errors.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Linaro/OpenCSD/issues/29, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADF7BM7NTEMZICDA7ZBBSBLSKQC5XANCNFSM4SOKSIAQ .

-- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK

mikel-armbb commented 4 years ago

static linked build of trc_pkt_lister bult and tested on both x86 and aarch64. Closing issue as this does not appear to be a library / opencsd build issue.

saiprakash-ranjan commented 4 years ago

Hi Mike, thanks for looking, I'll see if anything is missed on perf side.