Code Comments
Programming Forum and web based access to our favorite programming groups.hey all, I'm trying to build an application which has a threading component, and am having a damn hard time making it work.. Here's my inline call: use Inline ( 'C++' => 'DATA', LIBS => '-L. -L/homes/edp/tmp/ipworksssl-6.2/lib -lipworksssl -lhttpwrap -lssl -lcrypto -lcrypt', CC => '/tmp/gcc/bin/g++', CCFLAGS => '-pthread -static -static-libgcc', 'LDDLFLAGS' => '-pthread -shared -static-libgcc' ); I've compiled g++ with --enable-threads, but still no luck, I get at runtime: Can't load _Inline/lib/auto/aab_p_6230/aab_p_6230.so' for module aab_p_6230: lib/libipworksssl.so.6: Undefined symbol "pthread_mutex_lock" at /opt/tools/generic/dev/i686/FreeBSD/lib/perl5/5.8.8/i386-freebsd-64int/DynaL oader.pm line 232. Any ideas? Has anybody built a Inline call that used something that had thread support in it (not that I'm using the threads, I'm just trying to wrap the package as simple as I can.. Ed
Post Follow-up to this message
----- Original Message -----
From: "Edward Peschko" <horos11@gmail.com>
.
.
> Can't load
>
> _Inline/lib/auto/aab_p_6230/aab_p_6230.so' for module aab_p_6230:
> lib/libipworksssl.so.6: Undefined symbol "pthread_mutex_lock" at
>
If you reckon that you won't actually need the genuine pthread_mutex_lock,
you could just code one up yourself and put it (eg) at the beginning of your
C/C++ code:
void pthread_mutex_lock() {}
I've had success resolving undefined symbols using hacks like that in the
past (though I've not actually tried it with Inline).
Other than that, I guess you'll have to find the library that defines the
symbol "pthread_mutex_lock" and specifically link that library in.
Cheers,
Rob
Post Follow-up to this messageOn May 5, 2008, at 3:17 AM, Sisyphus wrote:
>
> ----- Original Message ----- From: "Edward Peschko"
> <horos11@gmail.com>
> .
> .
>
> If you reckon that you won't actually need the genuine
> pthread_mutex_lock, you could just code one up yourself and put it
> (eg) at the beginning of your C/C++ code:
>
> void pthread_mutex_lock() {}
>
> I've had success resolving undefined symbols using hacks like that
> in the past (though I've not actually tried it with Inline).
>
> Other than that, I guess you'll have to find the library that
> defines the symbol "pthread_mutex_lock" and specifically link that
> library in.
That library would be libpthread. The issue with defining a bogus
mutex lock is that eventually you'll hit that concurrent access that
corrupts your memory and causes very weird action at a distance
issues. I recommend linking with -lpthread and sparing yourself the
headache :) These days on linux the pthread library is frequently in /
lib/. You can inspect the symbols via "nm /lib/libpthread.so.<version>".
That being said, I would have expected the -pthread or -pthreads
option in gcc to take care of that for you. What version of gcc and OS
are you using?
For what it's worth, I wrote a simple CORBA client library that used
threads internally and created C wrappers for embedding it into perl.
It worked out fine, but I did have to link to the appropriate
threading library to get it working.
--
J.
Another hour, another mile, one more year
Your older self may whisper in your ear
The effort is illusion
But later hold you in their arms with the gratitude
Of a person who lived without regret.
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.