Fix -pthread issue on lang/gcc3[34]

Gerald Pfeifer gerald at pfeifer.com
Sun Jan 9 14:58:13 PST 2005


Thanks for the patch!

I know that David had a look into these issues and updated GCC mainline
(with his changes now being in the current lang/gcc40 port), so I would
like him and Loren who is also taking care of FreeBSD in GCC-land to have
a look at this patch, so I'm Cc:ing both and providing a full quote.

If possible in any way, I really would like to keep the port as close to
the upstream versions as possible, not the least because this will avoid
problems for users who want or even need to use these versions.

David, Loren, how shall we proceed?  I believe David raised issues wrt.
cross-compilation which would render the #ifdefs unsuitable for upstream.
Would a configure option, which is then used by the FreeBSD ports, be an
option?

Gerald


On Sun, 9 Jan 2005, Norikatsu Shigemura wrote:
> Hi Gerald!
> 
> 	I have a patch to fix -pthread issue on lang/gcc3[34].
> 
> 	BEFORE: on 5.2.1 or after
> 	$ gcc3? -pthread FILE of 'int main(void) { return 0; }'.
> 	$ ldd a.out
> 	a.out:
> 		libc_r.so.1 => /usr/lib/libc_r.so.5 (0x68076000)
> 		libc.so.6 => /lib/libc.so.6 (0x6809d000)
> 
> 	AFTER: on 5.2.1 or after
> 	$ gcc3? -pthread FILE of 'int main(void) { return 0; }'.
> 	$ ldd a.out
> 	a.out:
> 		libpthread.so.1 => /usr/lib/libpthread.so.1 (0x68076000)
> 		libc.so.6 => /lib/libc.so.6 (0x6809d000)
> 
> # Inspired by lang/gcc32, lang/gcc-ooo.
> 
> 	May I commit this OK?
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> Index: gcc33/Makefile
> ===================================================================
> RCS file: /home/ncvs/ports/lang/gcc33/Makefile,v
> retrieving revision 1.189
> diff -u -r1.189 Makefile
> --- gcc33/Makefile	17 Dec 2004 19:08:19 -0000	1.189
> +++ gcc33/Makefile	8 Jan 2005 16:45:32 -0000
> @@ -8,7 +8,7 @@
>  
>  PORTNAME=	gcc
>  PORTVERSION=	3.3.6
> -PORTREVISION=	20041215
> +PORTREVISION=	20041215.1
>  CATEGORIES=	lang java
>  VERSIONSTRING=	3.3-${PORTREVISION}
>  MASTER_SITES=	${MASTER_SITE_GCC}
> Index: gcc33/files/patch-gcc,config,freebsd-spec.h
> ===================================================================
> RCS file: gcc33/files/patch-gcc,config,freebsd-spec.h
> diff -N gcc33/files/patch-gcc,config,freebsd-spec.h
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ gcc33/files/patch-gcc,config,freebsd-spec.h	8 Jan 2005 16:40:51 -0000
> @@ -0,0 +1,23 @@
> +--- gcc/config/freebsd-spec.h.orig	Wed Mar 12 11:38:01 2003
> ++++ gcc/config/freebsd-spec.h	Sun Jan  9 01:39:09 2005
> +@@ -131,11 +131,20 @@
> +   }"
> + #else
> + #if FBSD_MAJOR >= 5
> ++#include <sys/param.h>
> ++#if __FreeBSD_version < 502102 /* upto FreeBSD 5.2.1 */
> + #define FBSD_LIB_SPEC "							\
> +   %{!shared:								\
> +     %{!pg: %{pthread:-lc_r} -lc}					\
> +     %{pg:  %{pthread:-lc_r_p} -lc_p}					\
> +   }"
> ++#else
> ++#define FBSD_LIB_SPEC "							\
> ++  %{!shared:								\
> ++    %{!pg: %{pthread:-lpthread} -lc}					\
> ++    %{pg:  %{pthread:-lpthread_p} -lc_p}				\
> ++  }"
> ++#endif /* deal with FreeBSD 5.0 - 5.2.1 */
> + #else
> + #define FBSD_LIB_SPEC "							\
> +   %{!shared:								\
> Index: gcc34/Makefile
> ===================================================================
> RCS file: /home/ncvs/ports/lang/gcc34/Makefile,v
> retrieving revision 1.191
> diff -u -r1.191 Makefile
> --- gcc34/Makefile	25 Dec 2004 13:41:58 -0000	1.191
> +++ gcc34/Makefile	8 Jan 2005 16:45:43 -0000
> @@ -8,7 +8,7 @@
>  
>  PORTNAME=	gcc
>  PORTVERSION=	3.4.4
> -PORTREVISION=	20041224
> +PORTREVISION=	20041224.1
>  CATEGORIES=	lang java
>  VERSIONSTRING=	3.4-${PORTREVISION}
>  MASTER_SITES=	${MASTER_SITE_GCC} \
> Index: gcc34/files/patch-gcc,config,freebsd-spec.h
> ===================================================================
> RCS file: gcc34/files/patch-gcc,config,freebsd-spec.h
> diff -N gcc34/files/patch-gcc,config,freebsd-spec.h
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ gcc34/files/patch-gcc,config,freebsd-spec.h	8 Jan 2005 16:44:08 -0000
> @@ -0,0 +1,22 @@
> +--- gcc/config/freebsd-spec.h.orig	Wed Dec 22 03:00:24 2004
> ++++ gcc/config/freebsd-spec.h	Sat Jan  8 02:00:23 2005
> +@@ -130,11 +130,19 @@
> +   }"
> + #else
> + #if FBSD_MAJOR >= 5
> ++#if __FreeBSD_version < 502102 /* upto FreeBSD 5.2.1 */
> ++#define FBSD_LIB_SPEC "							\
> ++  %{!shared:								\
> ++    %{!pg: %{pthread:-lc_r} -lc}					\
> ++    %{pg:  %{pthread:-lc_r_p} -lc_p}				\
> ++  }"
> ++#else
> + #define FBSD_LIB_SPEC "							\
> +   %{!shared:								\
> +     %{!pg: %{pthread:-lpthread} -lc}					\
> +     %{pg:  %{pthread:-lpthread_p} -lc_p}				\
> +   }"
> ++#endif /* deal with FreeBSD 5.0 - 5.2.1 */
> + #else
> + #define FBSD_LIB_SPEC "							\
> +   %{!shared:								\
> 


More information about the freebsd-ports mailing list