(Untitled)

May 24, 2007 15:11

So I'm compiling this module for work.

And I'm getting this error when I attempt to load the module into memory:

undefined symbol: sem_wait

Any programmers/linux people know why that would happen? I believe the offending code snippet is this:

#include #define lock_get(lock) sem_wait(lock ( Read more... )

Leave a comment

Comments 15

bryguypgh May 24 2007, 19:47:53 UTC
I don't know if I can help, but can you tell me what module and what version of the kernel? My kernel has 14 different versions of the semaphore.h file, albeit for different architectures; are you certain your path includes the right one?

Reply

__fooliuscaesar May 24 2007, 20:00:46 UTC
First off...thanks for taking the time to help.
Second, I'm pretty sure it is in the correct path, but I'll double check. The module is a custom module that I am writing; the linux kernel is Slackware 2.4.33.3
The version of semaphore.h that I am attempting to use is in /usr/include, which is in the gcc search path.

I've waded through a sea of errors on custom header files and C-files and now I'm being halted by an installed system header...lol.

Thanks again man.

Reply

bryguypgh May 24 2007, 20:08:01 UTC
I am not sure of the answer, but a very good place to ask for help is on irc, there's a server called irc.freenode.net. I fire up xchat (but you can use mirc, or whatever irc client you like) and

/join #c
/join #slackware
/join #linux

Someone in one of those channels can probably help you if you ask nicely. Good luck!

Reply

__fooliuscaesar May 24 2007, 20:09:13 UTC
Cool. Thanks man. Appreciate the lead.

Reply


_aesthetic_ May 25 2007, 20:08:48 UTC
Sorry, I was a slacker yesterday and didn't check LJ, lol.

Where is sem_wait defined? It -should- be w/ the other semaphore stuff, but maybe it's not.

If you don't get an error directly from the #include about the file not found, it's finding it in pulling it in. The problem is

#define lock_get(lock) sem_wait(lock)

only makes every reference to lock_get change to sem_wait in a very text-based manner. sem_wait doesn't even have to be declared for the preprocessor to happily replace all instances of the token lock_get with sem_wait.

After all of the lock_gets are changed to sem_waits, sem_wait is what needs defined. Is there a

struct sem_wait {};

or

typedef struct {} sem_wait;

anywhere?

Reply

__fooliuscaesar May 29 2007, 13:40:19 UTC
Not that I can see. Should there be?

Reply

_aesthetic_ May 29 2007, 13:43:50 UTC
If it's referred to, it has to be defined. Otherwise you end up with your undefined symbol error.

Search for sem_wait in your headers. I'll poke around the net and see which includes are needed. You may have to #define something to pull it in.

Reply

_aesthetic_ May 29 2007, 13:45:33 UTC
Oh wait, dur dur dur. You said this is on load, not on build. Sec...

Reply


Leave a comment

Up