LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 07-18-2013, 02:19 AM   #1
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Rep: Reputation: Disabled
Unhappy shared object linkin problem


Dear sir,

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 am getting error like
Quote:
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
/usr/bin/ld: cannot find -lusb-1.0
collect2: ld returned 1 exit status
make: *** [all] Error 1
this thing works really smooth on the ubuntu. what can i do to resolve this please let me know
i am not that gud with RHEL and so linking

thanks & Regards
rohan
 
Old 07-18-2013, 02:41 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
do you have libusb-1.0.so somewhere ?
 
1 members found this post helpful.
Old 07-18-2013, 02:57 AM   #3
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
do you have libusb-1.0.so somewhere ?
Dear sir Thanks for reply i tried to search with "locate libusb" i got this thing

Code:
/usr/lib/libusb-0.1.so.4
/usr/lib/libusb-0.1.so.4.4.4
/usr/lib/libusb.a
/usr/lib/libusb.so
/usr/lib/libusbpp-0.1.so.4
regards
rohaan
 
Old 07-18-2013, 03:38 AM   #4
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Unhappy

Quote:
Originally Posted by rohaanembedded View Post
Dear sir Thanks for reply i tried to search with "locate libusb" i got this thing

Code:
/usr/lib/libusb-0.1.so.4
/usr/lib/libusb-0.1.so.4.4.4
/usr/lib/libusb.a
/usr/lib/libusb.so
/usr/lib/libusbpp-0.1.so.4
regards
rohaan
Dear sir,

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)'
but now its giving me erroe like
Code:
[root@localhost cyusb_linux_1.0.3]# make
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 
/usr/bin/ld: cannot find -llibusb-0.1
collect2: ld returned 1 exit status
make: *** [all] Error 1
please let me know where i am making the mistake

regards
rohaan
 
Old 07-18-2013, 03:53 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
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
 
1 members found this post helpful.
Old 07-18-2013, 04:26 AM   #6
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Question

Quote:
Originally Posted by pan64 View Post
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)

thanks lot

regards
rohaan
 
Old 07-18-2013, 05:33 AM   #7
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Unhappy

Quote:
Originally Posted by rohaanembedded View Post
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.
 
Old 07-18-2013, 06:10 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
probably it depends on the version of libusb*.so, probably you can copy it from the working host to the other one.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
data sharing between c++ shared object and Fortran shared object Madhubala Debian 2 08-19-2011 02:22 AM
problem in loading a shared object in linux phani@tcs Linux - Newbie 2 01-11-2006 12:57 PM
Problem in Loading a shared object in linux phani@tcs Programming 1 01-11-2006 08:29 AM
problem in loading a shared object in linux phani@tcs Linux - General 2 01-10-2006 03:50 PM
problem in dynamically loading the shared object sumit Programming 1 01-10-2002 03:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 02:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration