• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 200
  • Last Modified:

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?
0
s_turner99
Asked:
s_turner99
  • 3
  • 2
1 Solution
 
mpassCommented:
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.
0
 
rwenzlaCommented:
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

0
 
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 getting...so look for another question for about 50 points or so very soon.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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.
0
 
rwenzlaCommented:
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.
0
 
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.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now