LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 01-12-2011, 10:29 AM   #1
rhf417
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Rep: Reputation: 0
insmod error: unresolved symbol


I am learning how to write linux device driver and wrote a simple usb driver for my Microchip PIC 32 usb starter board.

In the "probe" and "disconnect" function of my kernel module code, several usb functions (interface_to_usbdev, usb_get_intfdata, usb_get_dev, usb_set_intfdata, usb_put_dev) are used.

Compiling succeeded (there are some warnings though). However, when I tried to load the module with "insmod mydriver.o", I got the following error messages:

mydriver.o: unresolved symbol interface_to_usbdev
mydriver.o: unresolved symbol usb_get_intfdata
mydriver.o: unresolved symbol usb_get_dev
mydriver.o: unresolved symbol usb_set_intfdata
mydriver.o: unresolved symbol usb_put_dev

I googled for a while without any luck. Somebody said kernel source should be installed. But I already had kernel-source-2.4.20-8.i386.rpm installed. I am using redhat9 with kernel 2.4.20-8.

I also checked the loaded modules and made sure that usbcore module has been loaded.

Below is my Makefile:

------------------------------------------------------
TARGET := mydriver
WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
INCLUDE := -isystem /lib/modules/`uname -r`/build/include
CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE}
CC := gcc

${TARGET}.o: ${TARGET}.c

.PHONY: clean

clean:
rm -rf ${TARGET}.o
----------------------------------------------------------


Anybody has an idea of how to solve this problem? Thanks in advance.
 
Old 01-12-2011, 12:10 PM   #2
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,305

Rep: Reputation: 552Reputation: 552Reputation: 552Reputation: 552Reputation: 552Reputation: 552
Quote:
I am using redhat9 with kernel 2.4.20-8.
A lot of the advice you will see/read will presume kernel-2.6x - you are aware of that?

Quote:
unresolved symbol <blah>
These errors show because these names come up as possibly needed (e.g. a library) and your box hasn't a clue where you stuffed it.

Try compiling a static (=self contained) version.
 
Old 01-12-2011, 12:52 PM   #3
rhf417
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by business_kid View Post
A lot of the advice you will see/read will presume kernel-2.6x - you are aware of that?

Thanks for your message. I may upgrade the kernel later. For now, I just want to make my first linux device driver work correctly in the system that I have.

These errors show because these names come up as possibly needed (e.g. a library) and your box hasn't a clue where you stuffed it.

Try compiling a static (=self contained) version.
I am new to linux programming. Could you please show me how to compile a static version?
 
Old 01-13-2011, 03:58 AM   #4
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,305

Rep: Reputation: 552Reputation: 552Reputation: 552Reputation: 552Reputation: 552Reputation: 552
The standard setup for linux programming is:
gcc - compiler
kernel headers - include functions
glibc - = all the main pc basic stuff (cfopy, write, print, etc) &
ld - the linker. also utilities to see what libs are missing. Try ldd </path/to/your_program>

That lot form your toolchain, upon which the integrity of your program depends. Now add
Makefiles - in every directory
./configure script - to check for all needed parts and twead the Makefiles

There's a HOWTO on tldp.org for programming in linux. Grab that.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
ndiswrapper trouble. insmod: unresolved symbol ethtools themrrobert Linux - Wireless Networking 1 02-26-2007 12:34 PM
"unresolved symbol" when insmod adore-ng.o in RHEL3 sailershen Programming 1 04-03-2006 04:10 AM
Insmod "unresolved symbol" errors smith847be Linux - General 1 12-19-2003 10:58 PM
unresolved symbol when I insmod nfs jimieee Linux - Networking 3 10-14-2003 07:34 AM
What causes insmod: unresolved symbol errors frankietomatoes Linux - General 1 12-06-2002 11:11 AM


All times are GMT -5. The time now is 07:21 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration