On Tue, Feb 17, 2009 at 09:03:18AM +0100, cnav wrote: > Jacob Meuser wrote: >> On Mon, Feb 16, 2009 at 09:06:25AM -0800, patrick keshishian wrote: >>> man cc >>> /-pthread >>> nn >>> >>> -pthreads >>> Add support for multithreading using the POSIX threads >>> library. This option sets flags for both the >>> preprocessor and linker. This option does not affect >>> the thread safety of object code produced by the >>> compiler or that of libraries supplied with it. >>> >> >> that doesn't answer the questions. >> >>> On Mon, Feb 16, 2009 at 5:32 AM, cnav <c...@talamasca.pl> wrote: >>>> Hi, >>>> >>>> I just applied following patch: >>>> http://cnav.pl/clamav-configure.patch >>>> >>>> to clamav sources. And after that libclamav seems to work with pthreads. >>>> ldd /usr/local/lib/libclamav.so.5.4 >>>> /usr/local/lib/libclamav.so.5.4: >>>> Start End Type Open Ref GrpRef Name >>>> 084ef000 28522000 dlib 1 0 0 /usr/local/lib/libclamav.so.5.4 >>>> 0d4b9000 2d4bd000 rlib 0 1 0 >>>> /usr/local/lib/libclamunrar_iface.so.5.4 >>>> 010a0000 210a5000 rlib 0 2 0 /usr/local/lib/libclamunrar.so.5.4 >>>> 06d89000 26d8d000 rlib 0 1 0 /usr/local/lib/libbz2.so.10.4 >>>> 091a8000 291af000 rlib 0 1 0 /usr/local/lib/libgmp.so.7.1 >>>> 0a04b000 2a12a000 rlib 0 1 0 /usr/local/lib/libiconv.so.5.0 >>>> 02484000 2248d000 rlib 0 1 0 /usr/lib/libpthread.so.11.0 >>>> 05a7c000 25a84000 rlib 0 3 0 /usr/lib/libz.so.4.1 >>>> >>>> Manuals says to use -pthread. >>>> http://www.openbsd.org/cgi-bin/man.cgi?query=pthreads&sektion=3 >>>> >>>> My question are: >>>> What is the difference between those two libs ? >>>> And why with -lpthread it's working and without not? >> >> -pthread won't link libpthread into shared objects, while -lpthread >> will. use -pthread when linking the executables that will load >> libclamav. >> > Thanks, > > The only one reason why i did it, is that i want to use perl module > mail-clamav witch is depending pthreads libraries. > > When i am compiling libclamav with -pthread instead of -lpthread: > The following error exists: > > Mail-ClamAV-0.22# make test > PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" > "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t > t/Mail-ClamAV..../usr/bin/perl:/usr/local/lib/libclamav.so.5.4: > undefined symbol 'pthread_create' > /usr/bin/perl:/usr/local/lib/libclamav.so.5.4: undefined symbol > 'pthread_getspecific' > /usr/bin/perl:/usr/local/lib/libclamav.so.5.4: undefined symbol > 'pthread_key_delete' > /usr/bin/perl:/usr/local/lib/libclamav.so.5.4: undefined symbol > 'pthread_once' > /usr/bin/perl:/usr/local/lib/libclamav.so.5.4: undefined symbol > 'pthread_key_create' > /usr/bin/perl:/usr/local/lib/libclamav.so.5.4: undefined symbol > 'pthread_mutex_unlock' > /usr/bin/perl:/usr/local/lib/libclamav.so.5.4: undefined symbol > 'pthread_mutex_lock' > /usr/bin/perl:/usr/local/lib/libclamav.so.5.4: undefined symbol > 'pthread_join' > /usr/bin/perl:/usr/local/lib/libclamav.so.5.4: undefined symbol > 'pthread_setspecific' > > I am aware that you maybe not familiar with mail-clamav, but libclamav > at least should work fine with pthreads (-pthread) correctly ?
no, because libclmav is a shared object, so -pthread doesn't pull in libpthread. > Please, if any of you can help me understand it, it will be much > helpful. (Or at least can you give me some directions where to search > to.) I *think* you need to change ClamAV.pm to have -pthread in LIBS like use Inline C => Config => VERSION => $VERSION, PREFIX => 'clamav_perl', NAME => "Maile::ClamAV", LIBS => "-lclamav -pthread"; but I honestly don't know much about how perl modules are supposed to be built. -- jake...@sdf.lonestar.org SDF Public Access UNIX System - http://sdf.lonestar.org