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?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
If your running a stock kernel (never built your own), it may have come with the .h files, but not the .c or .o files. RedHat makes the source available, but doesn't include it on their one-disk sets. If this is the case you'll need to

Download the source files for your kernel rev.

cd /usr/src/linux-2.2.5  

(/usr/src/linux should be just a symbolic link to the installed kernel version)

'make clean'

'make config' (or make menuconfig or make xconfig)

[answer all the questions, since you're really only worried about pci.o, just make sure that pci support is on]

'make dep'

'make bzImage'

This will create the .o files.  Give yourself some time.
It can take a while, my AMD K6-450 takes 20 minutes.

If you don't need to update your kernel, you're done.

(if you want to run the new kernel there are some more steps. . .)

My distrib. (RedHat 5.2, upgraded to the 2.2.9 kernel) shows it in /usr/src/linux-2.2.9/drivers/pci


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
s_turner99Author Commented:
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 look for another question for about 50 points or so very soon.
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

s_turner99Author Commented:
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.
s_turner99Author Commented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.