Cannot find -lusb in opensuse 12.2


 
Thread Tools Search this Thread
Operating Systems Linux SuSE Cannot find -lusb in opensuse 12.2
# 1  
Old 10-21-2013
Cannot find -lusb in opensuse 12.2

I am compiling a program under opensuse 12.2 with the following build rule,

$(BDIR)/suse_test_app: $(OBJSS)
$(CC++) $(OPTIMIZE) -o $@ $(FCFLAGS) $(OBJSS) -lusb -lpthread

I am getting a linker error,
cannot find -lusb

I have the usb devel lib (libusb-1_0-devel) installed in yast, so I'm not sure why I am getting this error. Does the library have a different name under suse?
According to yast, the files are here,
/usr/include/libusb-1.0
/usr/include/libusb-1.0/libusb.h
/usr/lib64/libusb-1.0.so

I have checked and all of that is where it is supposed to be. Can someone let me know how to fix this. Do I need to create a link somewhere that will let make know where the library is?

LMHmedchem
# 2  
Old 10-21-2013
The .so file is not enough, you need the .a file to link.

I'd expect the .so to be part of libusb, not libusb-devel. Make sure you have both installed.
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 10-21-2013
Quote:
Originally Posted by Corona688
The .so file is not enough, you need the .a file to link.

I'd expect the .so to be part of libusb, not libusb-devel. Make sure you have both installed.
Where would I look to make sure that the .a file is where it is supposed to be?

I have the following installed for usb,

libusb-0_1-4 - libusb-1.0 Compatibility Library for libusb-0.1

/usr/lib64/libusb-0.1.so.4
/usr/lib64/libusb-0.1.so.4.4.4
/usr/share/doc/packages/libusb-0_1-4
/usr/share/doc/packages/libusb-0_1-4/AUTHORS
/usr/share/doc/packages/libusb-0_1-4/COPYING
/usr/share/doc/packages/libusb-0_1-4/ChangeLog
/usr/share/doc/packages/libusb-0_1-4/LICENSE
/usr/share/doc/packages/libusb-0_1-4/NEWS
/usr/share/doc/packages/libusb-0_1-4/README

libusb-1_0-0 - USB Library

/usr/lib64/libusb-1.0.so.0
/usr/lib64/libusb-1.0.so.0.1.0
/usr/share/doc/packages/libusb-1_0-0
/usr/share/doc/packages/libusb-1_0-0/AUTHORS
/usr/share/doc/packages/libusb-1_0-0/COPYING
/usr/share/doc/packages/libusb-1_0-0/NEWS
/usr/share/doc/packages/libusb-1_0-0/README
/usr/share/doc/packages/libusb-1_0-0/THANKS
/usr/share/doc/packages/libusb-1_0-0/TODO

libusb-1_0-devel - USB Library

/usr/include/libusb-1.0
/usr/include/libusb-1.0/libusb.h
/usr/lib64/libusb-1.0.so
/usr/lib64/pkgconfig/libusb-1.0.pc
/usr/share/doc/packages/libusb-1_0-devel
/usr/share/doc/packages/libusb-1_0-devel/PORTING

libusbmuxd2 - A library to abstract socket/protocol communication to the usbmuxd daemon

/usr/lib64/libusbmuxd.so.1.0.8
/usr/lib64/libusbmuxd.so.2

If I change my link line to,
$(BDIR)/suse_test_app: $(OBJSS)
$(CC++) $(OPTIMIZE) -o $@ $(FCFLAGS) $(OBJSS) -lusb-1.0 -lpthread

I can get the app to link. There is a segfault at runtime, so I don't know if the above is linking to the proper library or not. I just assumed that -lusb was referring to a devel element, but I guess it makes more sense that it would be a runtime element, since users wouldn't have the devel library installed.

LMHmedchem
# 4  
Old 10-21-2013
The development library is what's supposed to allow you to link to the library but generally isn't the library itself.

The devel library looks weird. It installs headers but doesn't install symbols. I suspect the "/usr/lib64/libusb-1.0.so" it installs is a symlink, and if it isn't, why on earth is it installing a third version of libusb? That may be the reason for the crash, linking one version and loading another.

I see it includes a file for pkgconfig, so you can do pkg-config --ldflags libusb-1.0 to see how it's supposed to be linked. If it doesn't work, I suspect there's files actually missing.

Last edited by Corona688; 10-21-2013 at 06:48 PM..
# 5  
Old 10-21-2013
Quote:
Originally Posted by Corona688
I see it includes a file for pkgconfig, so you can do pkg-config --ldflags libusb-1.0 to see how it's supposed to be linked. If it doesn't work, I suspect there's files actually missing.
If I do pkg-config --ldflags libusb-1.0 in bash, I get an error, --ldflags: unknown option. I could add $(pkg-config --ldflags libusb-1.0) to the link rule instead of -lusb, but I don't think that is going to do anything if it fails in bash.

LMHmedchem
# 6  
Old 10-21-2013
Pardon me, --libs.
# 7  
Old 10-21-2013
Running pkg-config --libs libusb-1.0 gives -lusb-1.0, which is what I ended up using to get it to compile.

I have compiled with this, but the app will still not work. It is possible that I have some other error in there that I need to find. How could I go about finding if the .a file is where it is supposed to be?

LMHmedchem
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. SuSE

Is OpenSuSE 12.1 stable and reliable?

Hi, We are ready to update OpenSuSE for our web servers from 11.2 to either 11.4 or 12.1. 12.1 is still a beta version. Is it stable and reliable enough for production servers? Please share your valuable experiences. Thank you in advance! (5 Replies)
Discussion started by: aixlover
5 Replies

2. SuSE

openSuse 11.1 RAID 0 Question

Hello, I have a file server running openSuse 11.1, that has two HDDs running in RAID 0 (mirroring) using the md software RAID linux driver. I was considering removing this RAID, using one of the drives as the OS and the other as a data drive. Is there any way to stop using this as a RAID set to do... (4 Replies)
Discussion started by: vwgtiturbo
4 Replies

3. SuSE

openSUSE support

does Novell support openSUSE as it does for it's server packages, or is openSUSE's support the same as every other distribution of linux? (1 Reply)
Discussion started by: bcbotha
1 Replies

4. UNIX for Advanced & Expert Users

openSuse 10.3 , Emulex HBA

hello, i have a dell Poweredge 2950 ( Server ) and an IBM storage device DS 3000 family ( Storage ) . I am supposed to link the IBM storage device to the Dell Poweredge via "Emulex 4Gb Fibre Channel Host Bus Adapter". I have put the addapter card in my server and connected it to the storage.... (3 Replies)
Discussion started by: nux007
3 Replies

5. SuSE

Opensuse mt command

do not have lock and unlock function, is any way to lock the tape drive under opensuse 10? thanks (4 Replies)
Discussion started by: lijiajin
4 Replies

6. Linux

The LimitRequestBody filed in openSUSE 10.2

Because some program i have installed can not upload files bigger than some size as printing, the base got a packet bigger than 'max_allowed_packet' bytes what that i need to do as written in the documentation of the program increase the value of a fileld called LimitRequestBody told that is in... (5 Replies)
Discussion started by: tal
5 Replies

7. UNIX for Dummies Questions & Answers

Opensuse installation

I have never installed unix, after going through forum i realised opensuse is one of the goodoptions. I have downloaded iso image and burned DVD and took installation print out. I have created a partition (g)of 10gb, but my question is how do i make unix to get installed on my partitioned... (0 Replies)
Discussion started by: striker1
0 Replies
Login or Register to Ask a Question