[oi-dev] gcc 5.3 testing

Thomas Wagner tom-oi-dev at tom.bn-ulm.de
Thu May 12 12:48:08 UTC 2016


You probably want what SFE does and OpenCSW and a few others
builing ontop of a OS-distro. That is: Make the runtime loaded 
from the private directory.

Snipped from SFE patch gcc-05-LINK_LIBGCC_SPEC-49.diff
gcc/config/sol2.h

+#undef LINK_LIBGCC_SPEC
+#define LINK_LIBGCC_SPEC "%{m64:" "-R /usr/gcc/4.8/lib/ÄRCH64_SUBDIR":/usr/gcc/lib/ÄRCH64_SUBDIR" %D" "}%{!m64:" "-R /usr/gcc/4.8/lib:/usr/gcc/lib %D" "}"

Described in very much detail (be strong when reading) some time ago,
but still valid: http://tom.blog.in-ulm.de/GNU_gcc_spec_file
and http://tom.blog.in-ulm.de/gcc_cookbook_for_a_distribution

What is to avoid is: Really don't specify in the software which 
is to be compiled:
"-L/usr/lib" or "-L/lib", "-R/usr/lib" and "-R/lib"

So you might have rare occurence of a F/OSS build system that
is so stupid to specify the _default_ searchpath of /usr/lib:/lib.
The runtime linker does search these directories in any case as last
resort (-L|-R as written in RPATH comes first!), so there is never
a need for specifying this (on Solaris).

As this might still lead to finding gcc-runtime in /usr/lib before the
really wanted runtime from the correct gcc version is found in the
private directory.

So, SFE is really happy since years with the private gcc runtime,
that means a distro should be safe a well, if the distro:
 - either compiles all with static gcc runtime
or
 - keeps /usr/lib clean of libgcc_s.so and libstdc++.so.6 and
   run a compiler which searches _for_the_gcc_runtime first in 
   the private directory, for instance /usr/gcc/5.3/lib/<libgcc_s.so|libstdc++.so.6>


So the newer gcc versions removed LINK_LIBGCC_SPEC because they thought with
"unwind" they would have solved that runtime problem. They didn't. So I patched
back in the LINK_LIBGCC_SPEC defines for SFE in the more recent gcc versions.
OI should as well use this define and not *ARCH32* and such.

Regards,
Thomas



On Thu, May 12, 2016 at 01:40:52PM +0300, Alexander Pyhalov wrote:
>  On 05/12/2016 00:01, Aurélien Larcher wrote:
> > I thought that -Y and -R that I added to the arch spec would take care of 
> > that. Is -L also needed ?
> >
> 
>  Seems so. Adding -L makes things better.
> 
> 
> 
> 
>  -- 
>  Best regards,
>  Alexander Pyhalov,
>  system administrator of Southern Federal University IT department

> --- ./gcc/config/sol2.h.orig	2016-05-08 21:13:10.810423614 +0200
> +++ ./gcc/config/sol2.h	2016-05-08 21:16:55.681535743 +0200
> @@ -195,8 +195,8 @@
>    "%{G:-G} \
>     %{YP,*} \
>     %{R*} \
> -   %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp%R/lib:%R/usr/lib} \
> -	   %{!p:%{!pg:-Y P,%R/lib:%R/usr/lib}}}"
> +   %{!YP,*:%{p|pg:-Y P,%R/usr/gcc/5.3/lib:%R/lib:%R/usr/lib -R %R/usr/gcc/5.3/lib -L %R/usr/gcc/5.3/lib} \
> +	   %{!p:%{!pg:-Y P,%R/usr/gcc/5.3/lib:%R/lib:%R/usr/lib -R %R/usr/gcc/5.3/lib -L %R/usr/gcc/5.3/lib}}}"
>  
>  #undef LINK_ARCH32_SPEC
>  #define LINK_ARCH32_SPEC LINK_ARCH32_SPEC_BASE
> @@ -208,8 +208,8 @@
>    "%{G:-G} \
>     %{YP,*} \
>     %{R*} \
> -   %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/" ARCH64_SUBDIR ":%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "}	\
> -	   %{!p:%{!pg:-Y P,%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "}}}"
> +   %{!YP,*:%{p|pg:-Y P,%R/usr/gcc/5.3/lib/" ARCH64_SUBDIR ":%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR " -R %R/usr/gcc/5.3/lib/" ARCH64_SUBDIR " -L %R/usr/gcc/5.3/lib/" ARCH64_SUBDIR "}	\
> +	   %{!p:%{!pg:-Y P,%R/usr/gcc/5.3/lib/" ARCH64_SUBDIR ":%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR " -R %R/usr/gcc/5.3/lib/" ARCH64_SUBDIR " -L %R/usr/gcc/5.3/lib/" ARCH64_SUBDIR "}}}"
>  
>  #undef LINK_ARCH64_SPEC
>  #ifndef USE_GLD

> _______________________________________________
> oi-dev mailing list
> oi-dev at openindiana.org
> http://openindiana.org/mailman/listinfo/oi-dev

-- 
-- 
Thomas Wagner

------------------------------------------------------------------------
Service rund um UNIX(TM),     Wagner Network Services, Thomas Wagner
Solaris(TM), Linux(TM)        Eschenweg 21, 89174 Altheim, Germany
Novell(TM), Windows(TM)       TEL: +49-731-9807799, FAX: +49-731-9807711
Telekommunikation, LAN,       MOBILE/CELL: +49-171-6135989
Internet-Service, Elektronik  EMAIL: wagner at wagner-net.com




More information about the oi-dev mailing list