Red HatThis forum is for the discussion of Red Hat Linux.
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.
i am trying to use the shared object of libusb in my code but while compilation its giving me error
my Makefile is
Code:
all:
g++ -fPIC -o lib/libcyusb.o -c lib/libcyusb.c
g++ -shared -Wl,-soname,libcyusb.so -o lib/libcyusb.so.1 lib/libcyusb.o -l usb-1.0 -l rt
cd lib; ln -sf libcyusb.so.1 libcyusb.so
rm -f lib/libcyusb.o
clean:
rm -f lib/libcyusb.so lib/libcyusb.so.1
help:
@echo 'make would compile and create the library and create a link'
@echo 'make clean would remove the library and the soft link to the library (soname)'
i have this Makefile now as i have found there is libusb-0.1.so.4 not libusb-1.0.so
Code:
all:
g++ -fPIC -o lib/libcyusb.o -c lib/libcyusb.c
g++ -shared -Wl,-soname,libcyusb.so -o lib/libcyusb.so.1 lib/libcyusb.o -L /usr/lib/ -l libusb-0.1 -L /usr/lib/ -l rt
cd lib; ln -sf libcyusb.so.1 libcyusb.so
rm -f lib/libcyusb.o
clean:
rm -f lib/libcyusb.so lib/libcyusb.so.1
help:
@echo 'make would compile and create the library and create a link'
@echo 'make clean would remove the library and the soft link to the library (soname)'
copy (or create a symbolic link to) the lib /usr/lib/libusb-0.1.so.4 or /usr/lib/libusb-0.1.so.4.4.4 into your lib dir using the name libusb-1.0.so and restore your makefile
copy (or create a symbolic link to) the lib /usr/lib/libusb-0.1.so.4 or /usr/lib/libusb-0.1.so.4.4.4 into your lib dir using the name libusb-1.0.so and restore your makefile
Dear sir,
thank you sir
thank you very much it got compiled but its not getting the functionality from the libusb
if i try to compile my code which uses the libusb.so through the libcyusb.so it gives error like undefined symbols of the API i am using of libusb
like
Code:
[root@localhost src]# make
g++ -o 01_getdesc 01_getdesc.c -L ../lib -l cyusb
../lib/libcyusb.so: undefined reference to `libusb_clear_halt'
../lib/libcyusb.so: undefined reference to `libusb_get_device_address'
../lib/libcyusb.so: undefined reference to `libusb_close'
../lib/libcyusb.so: undefined reference to `libusb_get_active_config_descriptor'
../lib/libcyusb.so: undefined reference to `libusb_get_config_descriptor_by_value'
../lib/libcyusb.so: undefined reference to `libusb_open'
../lib/libcyusb.so: undefined reference to `libusb_claim_interface'
../lib/libcyusb.so: undefined reference to `libusb_set_configuration'
../lib/libcyusb.so: undefined reference to `libusb_free_device_list'
../lib/libcyusb.so: undefined reference to `libusb_get_device_list'
../lib/libcyusb.so: undefined reference to `libusb_get_max_iso_packet_size'
../lib/libcyusb.so: undefined reference to `libusb_control_transfer'
../lib/libcyusb.so: undefined reference to `libusb_get_config_descriptor'
../lib/libcyusb.so: undefined reference to `libusb_interrupt_transfer'
../lib/libcyusb.so: undefined reference to `libusb_get_bus_number'
../lib/libcyusb.so: undefined reference to `libusb_free_config_descriptor'
../lib/libcyusb.so: undefined reference to `libusb_exit'
../lib/libcyusb.so: undefined reference to `libusb_init'
../lib/libcyusb.so: undefined reference to `libusb_reset_device'
../lib/libcyusb.so: undefined reference to `libusb_set_interface_alt_setting'
../lib/libcyusb.so: undefined reference to `libusb_get_max_packet_size'
../lib/libcyusb.so: undefined reference to `libusb_detach_kernel_driver'
../lib/libcyusb.so: undefined reference to `libusb_open_device_with_vid_pid'
../lib/libcyusb.so: undefined reference to `libusb_get_configuration'
../lib/libcyusb.so: undefined reference to `libusb_get_device_descriptor'
../lib/libcyusb.so: undefined reference to `libusb_kernel_driver_active'
../lib/libcyusb.so: undefined reference to `libusb_bulk_transfer'
../lib/libcyusb.so: undefined reference to `libusb_release_interface'
../lib/libcyusb.so: undefined reference to `libusb_get_device'
../lib/libcyusb.so: undefined reference to `libusb_attach_kernel_driver'
../lib/libcyusb.so: undefined reference to `libusb_get_string_descriptor_ascii'
collect2: ld returned 1 exit status
make: *** [all] Error 1
any suggestions sir to over come this
why this libcyusb.so is not getting the all the functionality from libusb-1.0.so (libcyusb.so created using the Makefile we have disccused)
Dear sir,
thank you sir
thank you very much it got compiled but its not getting the functionality from the libusb
if i try to compile my code which uses the libusb.so through the libcyusb.so it gives error like undefined symbols of the API i am using of libusb
like
Code:
[root@localhost src]# make
g++ -o 01_getdesc 01_getdesc.c -L ../lib -l cyusb
../lib/libcyusb.so: undefined reference to `libusb_clear_halt'
../lib/libcyusb.so: undefined reference to `libusb_get_device_address'
../lib/libcyusb.so: undefined reference to `libusb_close'
../lib/libcyusb.so: undefined reference to `libusb_get_active_config_descriptor'
../lib/libcyusb.so: undefined reference to `libusb_get_config_descriptor_by_value'
../lib/libcyusb.so: undefined reference to `libusb_open'
../lib/libcyusb.so: undefined reference to `libusb_claim_interface'
../lib/libcyusb.so: undefined reference to `libusb_set_configuration'
../lib/libcyusb.so: undefined reference to `libusb_free_device_list'
../lib/libcyusb.so: undefined reference to `libusb_get_device_list'
../lib/libcyusb.so: undefined reference to `libusb_get_max_iso_packet_size'
../lib/libcyusb.so: undefined reference to `libusb_control_transfer'
../lib/libcyusb.so: undefined reference to `libusb_get_config_descriptor'
../lib/libcyusb.so: undefined reference to `libusb_interrupt_transfer'
../lib/libcyusb.so: undefined reference to `libusb_get_bus_number'
../lib/libcyusb.so: undefined reference to `libusb_free_config_descriptor'
../lib/libcyusb.so: undefined reference to `libusb_exit'
../lib/libcyusb.so: undefined reference to `libusb_init'
../lib/libcyusb.so: undefined reference to `libusb_reset_device'
../lib/libcyusb.so: undefined reference to `libusb_set_interface_alt_setting'
../lib/libcyusb.so: undefined reference to `libusb_get_max_packet_size'
../lib/libcyusb.so: undefined reference to `libusb_detach_kernel_driver'
../lib/libcyusb.so: undefined reference to `libusb_open_device_with_vid_pid'
../lib/libcyusb.so: undefined reference to `libusb_get_configuration'
../lib/libcyusb.so: undefined reference to `libusb_get_device_descriptor'
../lib/libcyusb.so: undefined reference to `libusb_kernel_driver_active'
../lib/libcyusb.so: undefined reference to `libusb_bulk_transfer'
../lib/libcyusb.so: undefined reference to `libusb_release_interface'
../lib/libcyusb.so: undefined reference to `libusb_get_device'
../lib/libcyusb.so: undefined reference to `libusb_attach_kernel_driver'
../lib/libcyusb.so: undefined reference to `libusb_get_string_descriptor_ascii'
collect2: ld returned 1 exit status
make: *** [all] Error 1
any suggestions sir to over come this
why this libcyusb.so is not getting the all the functionality from libusb-1.0.so (libcyusb.so created using the Makefile we have disccused)
thanks lot
regards
rohaan
dear sir,
i have tried again on the ubuntu its works gud there is my .so creation has got any issue related with the Ubuntu and red aht diffrnce or wrong installation of the libusb rpm what will suggst me please let me know
regards
rohan
Last edited by rohaanembedded; 07-18-2013 at 05:37 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.