gcc (linker) 2.95.4 / pthreads / samba-3.5.21 / i386-unknown-freebsd4.11

C.J. Adams-Collier KF7BMP cjac@colliertech.org
Sat Mar 23 04:53:00 GMT 2013

Thank you, Ian.  I figured that it was built in to libgcc, and it looks
like my figuring was right:

# strings /usr/lib/libgcc.a | grep pthread

but I couldn't get these symbols with -lgcc

So I'm trying configure with the --disable-shared argument.  I don't
really need to link against dynamic libsmb libraries.  I'm just looking
for the net and smbd bins.

and look: it worked:

root@bsd0:/usr/src/samba3/samba-3.5.21/source3# du -hs /usr/local/samba3/
242M	/usr/local/samba3/
root@bsd0:/usr/src/samba3/samba-3.5.21/source3# smbd -V
Version 3.5.21
root@bsd0:/usr/src/samba3/samba-3.5.21/source3# which net
root@bsd0:/usr/src/samba3/samba-3.5.21/source3# uname -a
FreeBSD bsd0.colliertech.org 4.11-RELEASE FreeBSD 4.11-RELEASE #0: Fri Jan 21 17:21:22 GMT 2005     root@perseus.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386

On Fri, 2013-03-22 at 17:46 -0700, Ian Lance Taylor wrote:
> On Fri, Mar 22, 2013 at 5:25 PM, C.J. Adams-Collier KF7BMP
> <cjac@colliertech.org> wrote:
> >
> > -L/usr/local/samba3/lib -L/usr/local/samba3/BerkeleyDB.4.4/lib -L/usr/local/samba3/lib -L/usr/local/samba3/lib -L/usr/local/samba3/BerkeleyDB.4.4/lib -L/usr/local/samba3/lib -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lldap -llber    -pthread \
> > -Wl,-soname,`basename bin/libsmbclient.so.0`
> > libsmb/libsmb_thread_posix.o: In function `smb_create_mutex_pthread':
> > libsmb/libsmb_thread_posix.o(.text+0x2e): undefined reference to `pthread_mutex_init'
> It appears that the thread library is not being linked in.  I note
> that the command line says -pthread but does not list any libraries.
> In current GCC using -pthread in the link command does some slightly
> complex library choosing on FreeBSD.  So, hypothesis: -pthread does
> not work correctly in the extremely ancient GCC 2.95.3 you are using.
> Unfortunately by my reading of the current GCC code I don't understand
> how -pthread is supposed to work when using FreeBSD before version 5.
> Normally using -pthread adds a thread library, but on FreeBSD before
> version 5 this only happens when not using -shared.  I'm not sure what
> is supposed to happen with -shared, as in your case.
> I suggest figuring out how to write a shared library that uses thread
> on your ancient platform, and then do that rather than assuming that
> -pthread does the right thing.
> Ian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20130323/0c7ee7ce/attachment.sig>

More information about the Gcc-help mailing list