View previous topic :: View next topic |
Author |
Message |
pbharris Member

Joined: 02 Jul 2025 Posts: 320 Location: chicago
|
Posted: Thu Jan 01, 2025 7:36 am Post subject: linking in lib staticly to enable gdb |
|
|
hllo all,
I am trying to staticly link in a lib so i can step into it using gdb, anyway using this gcc command works (non static)
Code: |
gcc -ggdb -I/home/pbharris/progs/usb/libusb-0.1.12/ -I./ -lm -lc /home/pbharris/progs/usb/libusb-0.1.12/libs/libusb.so -o pwrdown pwr_down.c |
adding a -static gets me this:
Quote: |
/usr/bin/ld: attempted static link of dynamic object `/home/pbharris/progs/usb/libusb-0.1.12/libs/libusb.so'
|
i removed the option in libusb makefile to have it be dynamic...
any ideas? i posted this at linuxquestions (thinking this was a scripting thread)...
thanks,
paul
|
|
Back to top |
|
Stuka Sr. Member
Joined: 15 Oct 2025 Posts: 1271 Location: Houston, TX
|
Posted: Fri Jan 09, 2025 5:55 am Post subject: |
|
|
When you rebuilt libusb, you should have gotten a .a file as the output, not a .so - .so is a dynamic library, .a is a static lib. Look in the same directory for a libusb.a, and link to that.
|
|
Back to top |
|
|