Re: threading and dlopen()

2007-12-18 Thread Markus Hoenicka
Heiko Wundram (Beenic) writes:
 > Have you tried compiling your program with
 > 
 > gcc -fpic -pthread ...
 > 
 > ? I don't have any more insight into this problem, at least as I'm not using 
 > dbi and as such am not able to reproduce it, but I'd guess that if your 
 > program doesn't conform to the platform's required thread semantics (which 
 > are turned on by -fpic -pthread) but uses code that does require this, 
 > you're 

Thanks for the hint, but that didn't help. I've changed the appropriate
acinclude.m4, Makefile.am, and configure.in files of both libdbi and
libdbi-drivers to make sure that:

- libdbi.so (the lib that dlopen()s the drivers) is built with -fpic -pthread
- libdbifirebird.so (the firebird driver) is built with -fpic -pthread
- test_dbi (linked against libdbi.so) is built with -fpic -pthread

Still no luck, and the test app crashes at the very same point. Any
other suggestions?

regards,
Markus

-- 
Markus Hoenicka
[EMAIL PROTECTED]
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: threading and dlopen()

2007-12-18 Thread Heiko Wundram (Beenic)
Am Dienstag, 18. Dezember 2007 21:34:33 schrieb Markus Hoenicka:
> My (limited) analysis makes me think this is some sort of a threading
> issue aggravated by the fact that the code is dlopen()ed (remember the
> same code works ok if compiled into a standalone app). BTW the
> firebird client library is the only library supported by libdbi which
> uses threads. All other drivers do not use threads and work ok.

Have you tried compiling your program with

gcc -fpic -pthread ...

? I don't have any more insight into this problem, at least as I'm not using 
dbi and as such am not able to reproduce it, but I'd guess that if your 
program doesn't conform to the platform's required thread semantics (which 
are turned on by -fpic -pthread) but uses code that does require this, you're 
bound for trouble.

-- 
Heiko Wundram
Product & Application Development
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


threading and dlopen()

2007-12-18 Thread Markus Hoenicka
Hi,

please bear with me if the issue below sounds familiar[1]. I've done some
more experiments to find out why the firebird client library crashes
on my box. If you're familiar with threads and dynamic linking, please
read on.

I'm trying to fix the libdbi driver for the firebird database engine
on FreeBSD. libdbi is a C library that your application can link
to. libdbi dlopen()s drivers which are shared objects themselves and
provide the specific code to talk to the database client
libraries. libdbi works across several platforms and supports a
variety of database engines - with the notable exception of firebird
on FreeBSD.

I can create and access firebird databases using the isql command line
tool. I can build and run a simple test program which creates a
firebird database, opens it, and closes it again. Now, if I use pretty
much the same code, compile it into a shared object, and dlopen() it,
the firebird client library invariably crashes with the following
gdb output:

#0  0x28535b36 in ThreadData::restoreSpecific() from 
/usr/local/lib/libfbclient.so.2
#1  0x2852ceb4 in return_success () from /usr/local/lib/libfbclient.so.2
#2  0x28525179 in REM_attach_database () from /usr/local/lib/libfbclient.so.2
#3  0x2851386a in isc_attach_database () from /usr/local/lib/libfbclient.so.2
#4  0x284ece8e in _dbd_real_connect ()
   from /usr/local/lib/dbd/libdbdfirebird.so
#5  0x284eba19 in dbd_connect () from /usr/local/lib/dbd/libdbdfirebird.so
#6  0x2808011d in dbi_conn_connect () from /usr/local/lib/libdbi.so.0
#7  0x0804982a in main (argc=1, argv=0xbfbfea2c) at test_dbi.c:91

My (limited) analysis makes me think this is some sort of a threading
issue aggravated by the fact that the code is dlopen()ed (remember the
same code works ok if compiled into a standalone app). BTW the
firebird client library is the only library supported by libdbi which
uses threads. All other drivers do not use threads and work ok.

The firebird driver works ok on a variety of other platforms,
including Linux and as weird ones as Windows. It somehow hurts my
pride that it fails on FreeBSD.

Does anyone out there have an idea how to fix this odd problem?

System is 6.1-RELEASE, firebird2-client 2.0.3_1 was built as a port,
libdbi and libdbi-drivers (both current cvs versions) were built from
the sources (not as ports).

regards,
Markus

[1] 
http://lists.freebsd.org/pipermail/freebsd-questions/2007-December/164571.html

-- 
Markus Hoenicka
[EMAIL PROTECTED]
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"