[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#211054: fails to link libraries with -pthread on powerpc



On Wed, Sep 17, 2003 at 09:44:40AM -0400, Daniel Jacobowitz wrote:
> On Mon, Sep 15, 2003 at 05:33:36PM +0200, Marcin Owsiany wrote:
> > Package: gcc-3.3
> > Version: 1:3.3.2-0pre3
> > Severity: important
> > 
> > I use -Wl,-z,defs as sugegsted by the Policy.
> > 
> > porridge@bruckner:~$ uname -a
> > Linux bruckner 2.4.21 #1 Don Aug 28 15:18:52 CEST 2003 ppc GNU/Linux
> > porridge@bruckner:~$ cat a.c
> > main(){pthread_create();}
> > porridge@bruckner:~$ cc -shared -Wl,-z,defs -Wl,-soname,libgadu.so.2 -o a a.c -pthread
> > /tmp/ccUN9fRZ.o(.text+0x14): In function `main':
> > : undefined reference to `pthread_create'
> > collect2: ld returned 1 exit status
> > porridge@bruckner:~$ dpkg -l libc6-dev gcc-3.3 binutils|grep ^ii
> > ii  libc6-dev      2.3.2-6        GNU C Library: Development Libraries and Hea
> > ii  gcc-3.3        3.3.2-0pre3    The GNU C compiler
> > ii  binutils       2.14.90.0.5-0. The GNU assembler, linker and binary utiliti
> > porridge@bruckner:~$
> > 
> > The same toolchain versions do work for example on mipsel.
> > http://buildd.debian.org/fetch.php?&pkg=ekg&ver=1%3A1.2-1&arch=mipsel&stamp=1063300927&file=log&as=raw
> > vs
> > http://buildd.debian.org/fetch.php?&pkg=ekg&ver=1%3A1.2-1&arch=powerpc&stamp=1063289370&file=log&as=raw
> 
> You can use -lpthread in the meantime.  But here's a patch, also
> submitted upstream.
> 
> 2003-09-17  Daniel Jacobowitz  <drow@mvista.com>
> 
> 	* config/rs6000/sysv4.h (LIB_LINUX_SPEC): Make -pthread apply
> 	to shared libraries.
> 
> Index: sysv4.h
> ===================================================================
> RCS file: /big/fsf/rsync/gcc-cvs/gcc/gcc/config/rs6000/sysv4.h,v
> retrieving revision 1.113.4.4
> diff -u -p -r1.113.4.4 sysv4.h
> --- gcc-3.3.1/gcc/config/rs6000/sysv4.h	17 Jun 2003 15:59:10 -0000	1.113.4.4
> +++ gcc-3.3.1/gcc/config/rs6000/sysv4.h	17 Sep 2003 13:40:06 -0000
> @@ -1122,7 +1122,7 @@ do {						\
>  %{!mnewlib: -lc }"
>  #else
>  #define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
> -%{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \
> +%{!mnewlib: %{shared:-lc} %{pthread:-lpthread} %{!shared: \
>  %{profile:-lc_p} %{!profile:-lc}}}"
>  #endif

This patch shouldn't be used as-is; move -lpthread before -lc.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



Reply to: