Link to home
Start Free TrialLog in
Avatar of s_turner99
s_turner99

asked on

Can't find object file to complete linking...

(BTW: I'm new to Linux)
Using RedHat 6.0 (kernel 2.2.5-15), trying to compile and link a simple program using gcc.  There are numerous *.h files in /usr/src/linux/include/linux, the one I'm working with is pci.h.  The simple little test program I wrote compiles okay, but I don't know how to locate the object file (or archive) that has to be linked in to resolve references to the function prototypes in pci.h.  I've used find and grep on the entire file system trying to locate a file called pci.o, or even any source code references to the same functions I'm trying to use - didn't find any. :(

Is there a document somewhere that has detailed info on system functions commonly used by device drivers?
Avatar of mpass
mpass

If you haven't run the command "updatedb" yet, then do that. This will create a database containing a list of all files on your system. You can then use the locate command to find whatever you are looking for, so long as you know part of the filename.

locate pci
To find all files with the string 'pci' in it.

locate .o
To find all object files on the system.
Hope this helps.
ASKER CERTIFIED SOLUTION
Avatar of rwenzla
rwenzla

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of s_turner99

ASKER

Thanks rwenzla!

The "make config" asked hundreds of questions, I answered them all (but some of them wrong, no doubt).

Anyway, the pci.o file was successfully created.  Sadly, I tried to link my simple program and now there are dozens of unresolved references relating to pci.o itself!  There's probably something pretty basic about linking in system functions that I'm just not getting...so look for another question for about 50 points or so very soon.
Oh, yes, and mpass thanks for your comments too.  Using "locate" is MUCH faster than trying "find" and "grep" everywhere.

BTW: updatedb kept locking up when it encountered certain directories, what finally worked to get my database updated was "slocate -u -v -e /.automount,/.gnome_private,/misc,/lost+found,/mnt,/net"

Thanks again.
Look in the header pci.h for all the includes.
You'll probably have to link to those .o files, too (and the ones in their .h's and so on).
pci.o is a loadable module, and probably dependant on quite a few other things.  It wasn't meant to stand alone.
Hey rwenzla, if you can tell me exactly how to accomplish your suggestion (previous comment) then I'll give ya 100 points!

My entire problem is that manually searching for all those object files is too tedious and error-prone.  I figure there's gotta be an "automatic" way that I just don't know about.