USA Linux Users Group Forum Index
Log in Register FAQ Memberlist Search USA Linux Users Group Forum Index Album

linking in lib staticly to enable gdb

 
Post new topic   Reply to topic   printer-friendly view    USA Linux Users Group Forum Index » Shell Scripting and Programming
View previous topic :: View next topic  
Author Message
pbharris
Member


Joined: 02 Jul 2024
Posts: 320
Location: chicago

PostPosted: Thu Jan 01, 2024 7:36 am    Post subject: linking in lib staticly to enable gdb Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger
Stuka
Sr. Member


Joined: 15 Oct 2024
Posts: 1271
Location: Houston, TX

PostPosted: Fri Jan 09, 2024 5:55 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    USA Linux Users Group Forum Index » Shell Scripting and Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All content © 2024-2009 - Usa Linux Users Group
This forum is powered by phpBB. © 2024-2009 phpBB Group
Theme created by phpBBStyles.com and modified by Crouse