LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-05-2009, 10:40 AM   #1
ddeeks
LQ Newbie
 
Registered: May 2009
Posts: 11

Rep: Reputation: 0
Question usb.h in Eclipse -Fedora 10 /usr/lib/libusb-0.1.so.4.4.4 & dlltool not linking


I am compiling a USB device driver using GNU C in Eclipse under
Fedora 10.

This necessitates using #include "/usr/include/usb.h"

so that the usb.h declarations (types and functions) are visible to the compiler. This compiles!

Now the shared objects

/usr/lib/libusb-0.1.so.4.4.4 and /usr/lib/libusbpp-0.1.so.4.4.4 need to be added to the linker.

To do this I went to the

(1) eclipse project explorer and clicked on the the project-> properties
(2) C/C++ Build -> Settings
(3) Tool Settings -> GCC C Linker -> Share Library Settings

IN THE Share Library Setting (tab)

(4) I then checked the shared check box.
(5) Share Object Name: ==> I entered :

/usr/lib/libusb-0.1.so.4.4.4 /usr/lib/libusbpp-0.1.s0.4.4.4


(6) Import Library Name: ==> I entered:

(a)/usr/lib/libusb /usr/lib/libusbpp

NOTE: That this Import LIbrary Name was also left blank

IS THIS FIELD NECESSARY FOR A SHARE OBJECT ???

(7) DEF File Name: ==> I entered:

/usr/lib/libusb.def /usr/lib/libusbpp.def



NO MATTER WHAT IS ENTERED HERE


The linker error is generated from the last field generates the
following error:gcc:

gcc: /usr/lib/libusbpp.def: No such file or directory
gcc: /usr/lib/libusbpp.def: No such file or directory
gcc: /usr/lib/libusbpp.def: No such file or directory

THE QUESTIONS FOR THIS POSTING ARE:

1) What should the setting for the Import Library Name: for a
share object be ---LEFT BLANK?????

2) What should the DEF File Name: Setting be for a share object

3) What are the specifications for a .def file???
 
Old 05-05-2009, 05:00 PM   #2
fantas
Member
 
Registered: Jun 2007
Location: Bavaria
Distribution: slackware, xubuntu
Posts: 143

Rep: Reputation: 22
You usually should only need to add the external libs to the linker settings (i.e. in your case "usb" and "usbpp", the rest will be added automatically by Eclipse) and if your output file is a shared object just tick the "Shared" checkbox in the 'Shared Library Settings', which should be all you have to do here from my experience.

Furthermore, the name, type, extension and prefix you can also easily setup in the 'Build Artifact' options tab.
 
Old 05-07-2009, 12:30 PM   #3
ddeeks
LQ Newbie
 
Registered: May 2009
Posts: 11

Original Poster
Rep: Reputation: 0
The program now links with only the Shared named objects defined as

/usr/lib/libusb-0.1.so.4.4.4
and

/usr/lib/libusbpp-0.1.so.4.4.4 !

The issue now these shared objects are causing a segmentation fault when initiating the
Debug. Please see below



5239-gdb-set confirm off
5239^done
(gdb)
5240-gdb-set width 0
5240^done
(gdb)
5241-gdb-set height 0
5241^done
(gdb)
5242-interpreter-exec console echo
5242^done
(gdb)
5243-gdb-show prompt
5243^done,value="(gdb) "
(gdb)
5244-gdb-set auto-solib-add on
5244^done
(gdb)
5245-gdb-set stop-on-solib-events 0
5245^done
(gdb)
5246-gdb-set stop-on-solib-events 1
5246^done
(gdb)
5247-gdb-show solib-search-path
5247^done,value=""
(gdb)
5248-gdb-set solib-search-path /usr/lib/libusb-0.1.so.4.4.4:/usr/lib/libusbpp-0.1.so.4.4.4
5248^done
(gdb)
5249
&"\n"
5249^done
(gdb)
5250-environment-cd /home/ddeeks/workspace/PocketPalNU
5250^done
(gdb)

5251-environment-directory /home/ddeeks/workspace/PocketPalNU /home/ddeeks/workspace/PocketPalNU/.settings /home/ddeeks/workspace/PocketPalNU/Debug /home/ddeeks/workspace/PocketPalNU/Release
5251^done,source-path="/home/ddeeks/workspace/PocketPalNU:/home/ddeeks/workspace/PocketPalNU/.settings:/home/ddeeks/workspace/PocketPalNU/Debug:/home/ddeeks/workspace/PocketPalNU/Release:$cdir:$cwd"
(gdb)
5252 info threads
&"info threads\n"
&"No registers.\n"
5252^error,msg="No registers."
(gdb)
5253-data-list-register-names
5253^done,register-names=["eax","ecx","edx","ebx","esp","ebp","esi","edi","eip","eflags","cs","ss","ds","es","fs","gs","st0"," st1","st2","st3","st4","st5","st6","st7","fctrl","fstat","ftag","fiseg","fioff","foseg","fooff","fop ","xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7","mxcsr","orig_eax","mm0","mm1","mm2","mm3" ,"mm4","mm5","mm6","mm7"]
(gdb)
5254-break-insert /home/ddeeks/workspace/PocketPalNU/test1.c:118
5254^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00001015",func="main",f ile="../test1.c",fullname="/home/ddeeks/workspace/PocketPalNU/test1.c",line="118",times="0"}
(gdb)
5255-break-insert -t main
5255^done,bkpt={number="2",type="breakpoint",disp="del",enabled="y",addr="0x00001005",func="main",fi le="../test1.c",fullname="/home/ddeeks/workspace/PocketPalNU/test1.c",line="106",times="0"}
(gdb)
5256-exec-run
5256^running
(gdb)
5256*stopped,reason="signal-received",signal-name="SIGSEGV",signal-meaning="Segmentation fault",thread-id="0",frame={addr="0x00000001",func="??",args=[]}
(gdb)
5257 info proc
&"info proc\n"
~"process 23638\n"
~"cmdline = '/home/ddeeks/workspace/PocketPalNU/Debug/test1.out'\n"
~"cwd = '/home/ddeeks/workspace/PocketPalNU'\n"
~"exe = '/home/ddeeks/workspace/PocketPalNU/Debug/test1.out'\n"
5257^done
(gdb)
5258 info threads
&"info threads\n"
&"warning: Couldn't restore frame in current thread, at frame 0\n"
~"0x00000001 in ?? ()\n"
5258^done
(gdb)
5259-stack-info-depth
5259^done,depth="1"
(gdb)
5260-stack-list-frames 0 1
5260^done,stack=[frame={level="0",addr="0x00000001",func="??"}]
(gdb)
5261-data-list-changed-registers
5261^done,changed-registers=["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21", "22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40"," 41"]
(gdb)
5262 info sharedlibrary
&"info sharedlibrary\n"
~"No shared libraries loaded at this time.\n"
5262^done
(gdb)
5263 info signal SIGSEGV
&"info signal SIGSEGV\n"
~"Signal Stop\tPrint\tPass to program\tDescription\n"
~"SIGSEGV Yes\tYes\tYes\t\tSegmentation fault\n"
5263^done
(gdb)








5264-data-disassemble -s 0x1 -e 0x65 -- 0
Cannot access memory at address 0x1
&"Cannot access memory at address 0x1\n"
5264^error,msg="Cannot access memory at address 0x1"
(gdb)
5265-stack-list-arguments 0 0 0
5265^done,stack-args=[frame={level="0",args=[]}]
(gdb)
5266-stack-list-locals 0
5266^done,locals=[]
(gdb)


DO I NEED TO EXPLICITLY LOAD THE SHARED LIBRARY OBJECTS???
and if so how???



Regards

Dan
 
Old 05-08-2009, 09:06 AM   #4
fantas
Member
 
Registered: Jun 2007
Location: Bavaria
Distribution: slackware, xubuntu
Posts: 143

Rep: Reputation: 22
If you have the shared objects in your linker settings and the project compiles fine, then all should be ok.

I can't decipher what gdb is outputting, but if you want to try to load the shared objects manually you can use 'dlopen', 'dlsym' et al (libdl needs to be linked here).
 
Old 05-12-2009, 09:19 AM   #5
ddeeks
LQ Newbie
 
Registered: May 2009
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks

Thank you for your help
 
  


Reply

Tags
dll, fault, library, share, sigsegv



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
64-bit Fedora 9 /usr/lib/librt.so* library linux001 Fedora 1 11-06-2008 06:05 PM
oops, I stripped /usr/lib and /usr/X11R6/lib ! H_TeXMeX_H Slackware 2 02-08-2007 09:27 PM
/usr/local/lib not searched for shared objects in Redhat/Fedora? Arodef Programming 2 09-23-2005 12:44 AM
Compromised? Files "/usr/lib.hwm", "/usr/lib.pwd", "/usr/lib.pwi" Klaus Pforte Linux - Security 4 09-28-2004 11:33 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:37 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