Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Despite downloading and compiling libusb-1.0 to /usr/local, to know exactky where it is, gcc still can't find it;
gcc -o usb -L/usr/local/lib -llibusb-1.0.so -I/usr/local/include myusbcfile.c
gives;
usbtest.c:4:15: error: storage size of ‘brd_ftdi’ isn’t known
libusb_device brd_ftdi;
^
usbtest.c:5:22: error: storage size of ‘brd_ftdi_handle’ isn’t known
libusb_device_handle brd_ftdi_handle;
^
usbtest.c:6:16: error: storage size of ‘context’ isn’t known
libusb_context context;
^
This clearly indicates gcc can't find the library, tried different forms of this command, everyone giving this error.
Nope I've included it with #include <libusb.h> and since /usr/local/include is in the standard include path I use <>. I tested with citations ("") also but same error there.
I only declared three variables in libusb so it couldn't be so much other errors. And the error message is complete in my point of view, since it was all I got.
/usr/local/include is not the standard include path, therefore you need to use ". You need to show us the c file you wrote, otherwise we can only guess....
As you can see I've included libusb.h properly. The function calls are commented since they give even more errors which concludes the same thing. So to track down the error I made it simple to only declare 3 variables.
actually I still do not know how that libusb was installed, you need to check the location of the file libusb.h. probably it is /usr/local/include/libusb-1.0/libusb.h, but probably not.
Also it was mentioned that is not the full error message, please post the whole output of the command (and also the command itself).
Except not putting my code in brackets I've followed every guideline in the posting-information.
I compiled libusb-1.0.9 which I downloaded from libusb.org with
Code:
./configure --prefix=/usr/local
make
sudo make install
The include file is located is /usr/local/include/libusb-1.0/libusb.h
Code:
~$ ls -l /usr/local/include
Code:
total 4
drwxr-xr-x 2 root root 4096 jan 24 19:58 libusb-1.0
The libfiles are located in /usr/local/lib
Code:
ls -l /usr/local/lib
Code:
total 1156
-rw-r--r-- 1 root root 266594 jan 19 14:57 libftd2xx.a
lrwxrwxrwx 1 root root 34 jan 19 15:56 libftd2xx.so -> /usr/local/lib/libftd2xx.so.1.1.12
-rwxr-xr-x 1 root root 223388 jan 19 14:57 libftd2xx.so.1.1.12
-rw-r--r-- 1 root root 418662 jan 24 19:58 libusb-1.0.a
-rwxr-xr-x 1 root root 953 jan 24 19:58 libusb-1.0.la
lrwxrwxrwx 1 root root 19 jan 24 19:58 libusb-1.0.so -> libusb-1.0.so.0.1.0
lrwxrwxrwx 1 root root 19 jan 24 19:58 libusb-1.0.so.0 -> libusb-1.0.so.0.1.0
-rwxr-xr-x 1 root root 255620 jan 24 19:58 libusb-1.0.so.0.1.0
drwxr-xr-x 2 root root 4096 jan 24 19:58 pkgconfig
and what is the full output of the last command?
please add -Wall. This is the correct syntax I think:
gcc -Wall -o usb -I/usr/local/include usbtest.c -L/usr/local/lib -lusb-1.0
$ gcc -o usb -L/usr/local/lib -llibusb-1.0.so -I/usr/local/include usbtest.c
gives;
Code:
usbtest.c:4:15: error: storage size of ‘brd_ftdi’ isn’t known
libusb_device brd_ftdi;
^
usbtest.c:5:22: error: storage size of ‘brd_ftdi_handle’ isn’t known
libusb_device_handle brd_ftdi_handle;
^
usbtest.c:6:16: error: storage size of ‘context’ isn’t known
libusb_context context;
^
and with -Wall;
Code:
gcc -Wall -o usb -L/usr/local/lib -llibusb-1.0.so -I/usr/local/include usbtest.c
gives;
Code:
usbtest.c:4:15: error: storage size of ‘brd_ftdi’ isn’t known
libusb_device brd_ftdi;
^
usbtest.c:5:22: error: storage size of ‘brd_ftdi_handle’ isn’t known
libusb_device_handle brd_ftdi_handle;
^
usbtest.c:6:16: error: storage size of ‘context’ isn’t known
libusb_context context;
^
Didn't work, and it is the whole error message. When I ran with the function calls, I got several other errors as well saying the functions were not defined so the only conclusion I can make is that it don't somehow finds the declarations. I haven't checked the sources, only the docs but I assume from the docs (where all those functions and variables were listed) they are declared somewhere in my copy of libusb-1.0.9.
Last edited by BombaD; 01-28-2015 at 09:13 AM.
Reason: State that this didn't work either
libusb_context*ctx = 0;
libusb_init(&ctx); //ponter to a pointer!!!
the full definition that tells the compiler the size are in a different header,
and the libusb devs decided that you do not need to know about these internals, thats ok
It seems that using pointers yields a slighty different message; with no errors except that gcc still can't find the library despite trying -lusb-1.0.so flag:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.