Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Feb 2019 15:39:17 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        =?utf-8?Q?T=C4=B3l?= Coosemans <tijl@FreeBSD.org>
Cc:        FreeBSD Ports ML <freebsd-ports@freebsd.org>
Subject:   Re: FreeCAD 0.17 && /lib//libgcc_s.so.1
Message-ID:  <20190222133917.GZ2420@kib.kiev.ua>
In-Reply-To: <20190222140407.2145c11e@kalimero.tijl.coosemans.org>
References:  <a2102b4e-7d7a-7d5b-2ba1-b9a14f8574f6@pinyon.org> <f6a45ec9-7ae4-d9ba-f71c-f2ef8c235039@grosbein.net> <416689e6-37f9-17ec-54d8-0d224c26f30f@pinyon.org> <20190217151604.GB68620@night.db.net> <20190221180515.39c79ce6@kalimero.tijl.coosemans.org> <092b17f0-6fbf-662e-1061-403442248abd@pinyon.org> <20190222140407.2145c11e@kalimero.tijl.coosemans.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Feb 22, 2019 at 02:04:07PM +0100, Tijl Coosemans wrote:
> On Thu, 21 Feb 2019 10:53:00 -0700 "Russell L. Carter"
> <rcarter@pinyon.org> wrote:
> > On 2/21/19 10:05 AM, Tijl Coosemans wrote:
> >> On Sun, 17 Feb 2019 10:16:04 -0500 Diane Bruce <db@db.net> wrote:  
> >>> On Sat, Feb 16, 2019 at 06:35:52PM -0700, Russell L. Carter wrote:  
> >>>> So I must dig deeper.  Perhaps with rpaths interacting with the system
> >>>> paths?  
> >>>
> >>> You got it. ;)
> >>> Except python doesn't have an rpath which is why this keeps coming
> >>> up over and over again.  
> >> 
> >> Maybe we should just add the gcc rpaths to the python ports LDFLAGS
> >> without depending on gcc.  Then python should use gcc libgcc_s when
> >> it exists and fall back to base system libgcc_s when it doesn't.
> >> 
> >> Maybe we should compile *all* ports with gcc rpaths without depending
> >> on gcc, just like we already compile everything with -fstack-protector
> >> in LDFLAGS.
> > 
> > I would like to briefly present the perspective from a user's POV.
> > There is a large world wide population of scientific custom code
> > users/coders who run on linux boxes in a wide variety of
> > configurations.  Almost none of that code will ever have a chance of
> > ending up in /usr/ports, although there is nothing technically
> > challenging about almost any of it (the porting process that is).  So
> > anytime any of those users wants to try running their non-ported
> > scientific code, a large fraction of which contains python and/or
> > gfortan code, they are going to hit the libgcc_s issue.  Only a few of
> > those people understand rpaths as well as I do (and I'm no expert),
> > because it's never been their job.  They probably struggle to figure
> > out what question to ask, because, "libgcc_s?  WTF?, this is python!"
> > In addition, oftentimes people have sometimes big pipelines of
> > different programs executing.  So writing a shell script wrapper
> > around each and every one of those custom programs... not going to
> > happen.  libmap.conf(5)?  Not going to happen.  Linux works out of the
> > box.
> > 
> > People like Steve Kargl and me are... puzzled at why FreeBSD would
> > do this to itself.  Having people writing and running custom
> > opensource software on a performant opensource OS is **good**.  We
> > should be enabling them.
> 
> If I were the lang/gcc maintainer this -rpath problem would be my number
> one priority.  The current maintainer has never proposed any solutions
> and when I submit patches he always resists.  I'm done wasting my time
> fighting him.
> 
> Then threads like this appear every few months.  It's always the same
> people that respond with the same wrong ideas and wrong solutions and
> never providing patches.  I always politely point out what's wrong with
> their ideas and provide patches that do work.  Then they respond with
> the same wrong ideas without even trying my patches.  You can see that
> in this very thread.  Rinse, repeat.
> 
> It's a people problem, not a technical problem.  My patches solve the
> technical problem.  I can't help it if people don't pick up the patches.
Yes, we absolutely must avoid situation where two similar libraries
(i.e. providing some subset of symbols from other) are linked into the
same executing process.

I think your patches would be a definitive improvement, esp. the part
which makes libgfortran linking only as needed.

For the other part, which makes the ports dso a priority over the base
dso, I would exercise some more causion. For ports we know only about
libgcc_s.so.1 which has the same name in base and in ports, other
libraries in base should have libprivate suffix to not conflict, right ?
What about openssl libraries ?

I think such setup makes it easier for user to accidentaly break the system.
She could install something manually (not from ports), or copy some file
into /usr/local/lib, which conflicts with base and cause troubles.

Do you agree that the ultimate and proper solution is to add missed symbols
and versions to the base libgcc_s.so.1 ?  IMO it is, and this thread started
to show some work which might finally solve that.
(But about as-needed for libgfortran see above).

> 
> As for Linux, note that in theory the same problem also exists there.
> It's just that most Linux distribution only provide one version of gcc.
> FreeBSD provides multiple versions of multiple compilers and we allow
> code compiled with different compilers to be linked together.  Still,
> with my patches it should all just work without -rpath.
> 
> I can only recommend that you try the patches.  Your Fortran/Python
> pipeline will just work like it does on Linux.  I've attached them once
> more for your convenience.

> Index: libexec/rc/rc.conf
> ===================================================================
> --- libexec/rc/rc.conf	(revision 343935)
> +++ libexec/rc/rc.conf	(working copy)
> @@ -636,14 +636,14 @@ linux_enable="NO"	# Linux binary compatibility loaded 
>  clear_tmp_enable="NO"	# Clear /tmp at startup.
>  clear_tmp_X="YES" 	# Clear and recreate X11-related directories in /tmp
>  ldconfig_insecure="NO"	# Set to YES to disable ldconfig security checks
> -ldconfig_paths="/usr/lib/compat /usr/local/lib /usr/local/lib/compat/pkg"
> +ldconfig_paths="/usr/local/lib /usr/local/lib/compat/pkg /usr/lib /usr/lib/compat /lib"
>  			# shared library search paths
>  ldconfig32_paths="/usr/lib32 /usr/lib32/compat"
>  			# 32-bit compatibility shared library search paths
> -ldconfigsoft_paths="/usr/libsoft /usr/libsoft/compat /usr/local/libsoft"
> +ldconfigsoft_paths="/usr/local/libsoft /usr/libsoft /usr/libsoft/compat"
>  			# soft float compatibility shared library search paths
>  			# Note: temporarily with extra stuff for transition
> -ldconfig_paths_aout="/usr/lib/compat/aout /usr/local/lib/aout"
> +ldconfig_paths_aout="/usr/local/lib/aout /usr/lib/aout /usr/lib/compat/aout"
>  			# a.out shared library search paths
>  ldconfig_local_dirs="/usr/local/libdata/ldconfig"
>  			# Local directories with ldconfig configuration files.
> Index: libexec/rc/rc.d/ldconfig
> ===================================================================
> --- libexec/rc/rc.d/ldconfig	(revision 343935)
> +++ libexec/rc/rc.d/ldconfig	(working copy)
> @@ -17,22 +17,23 @@ stop_cmd=":"
>  
>  ldconfig_start()
>  {
> -	local _files _ins
> +	local _files _ins _paths _LDC
>  
>  	_ins=
>  	ldconfig=${ldconfig_command}
>  	checkyesno ldconfig_insecure && _ins="-i"
>  	if [ -x "${ldconfig_command}" ]; then
> -		_LDC="/lib /usr/lib"
> +		_paths=""
>  		for i in ${ldconfig_local_dirs}; do
>  			if [ -d "${i}" ]; then
>  				_files=`find ${i} -type f`
>  				if [ -n "${_files}" ]; then
> -					ldconfig_paths="${ldconfig_paths} `cat ${_files} | sort -u`"
> +					_paths="${_paths} `cat ${_files} | sort -Vru`"
>  				fi
>  			fi
>  		done
> -		for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do
> +		_LDC=""
> +		for i in ${_paths} ${ldconfig_paths} /etc/ld-elf.so.conf; do
>  			if [ -r "${i}" ]; then
>  				_LDC="${_LDC} ${i}"
>  			fi
> @@ -42,16 +43,17 @@ ldconfig_start()
>  
>  		case `sysctl -n hw.machine_arch` in
>  		amd64|mips64|powerpc64)
> +			_paths=""
>  			for i in ${ldconfig_local32_dirs}; do
>  				if [ -d "${i}" ]; then
>  					_files=`find ${i} -type f`
>  					if [ -n "${_files}" ]; then
> -						ldconfig32_paths="${ldconfig32_paths} `cat ${_files} | sort -u`"
> +						_paths="${_paths} `cat ${_files} | sort -Vru`"
>  					fi
>  				fi
>  			done
>  			_LDC=""
> -			for i in ${ldconfig32_paths}; do
> +			for i in ${_paths} ${ldconfig32_paths}; do
>  				if [ -r "${i}" ]; then
>  					_LDC="${_LDC} ${i}"
>  				fi
> @@ -64,16 +66,17 @@ ldconfig_start()
>  
>  		case `sysctl -n hw.machine_arch` in
>  		armv[67])
> +			_paths=""
>  			for i in ${ldconfig_localsoft_dirs}; do
>  				if [ -d "${i}" ]; then
>  					_files=`find ${i} -type f`
>  					if [ -n "${_files}" ]; then
> -						ldconfigsoft_paths="${ldconfigsoft_paths} `cat ${_files} | sort -u`"
> +						_paths="${_paths} `cat ${_files} | sort -Vru`"
>  					fi
>  				fi
>  			done
>  			_LDC=""
> -			for i in ${ldconfigsoft_paths}; do
> +			for i in ${_paths} ${ldconfigsoft_paths}; do
>  				if [ -r "${i}" ]; then
>  					_LDC="${_LDC} ${i}"
>  				fi
> @@ -87,10 +90,8 @@ ldconfig_start()
>  		# Legacy aout support for i386 only
>  		case `sysctl -n hw.machine_arch` in
>  		i386)
> -			# Default the a.out ldconfig path.
> -			: ${ldconfig_paths_aout=${ldconfig_paths}}
>  			_LDC=""
> -			for i in /usr/lib/aout ${ldconfig_paths_aout} /etc/ld.so.conf; do
> +			for i in ${ldconfig_paths_aout} /etc/ld.so.conf; do
>  				if [ -r "${i}" ]; then
>  					_LDC="${_LDC} ${i}"
>  				fi

> Index: lang/gcc8/files/patch-gcc_fortran_gfortranspec.c
> ===================================================================
> --- lang/gcc8/files/patch-gcc_fortran_gfortranspec.c	(nonexistent)
> +++ lang/gcc8/files/patch-gcc_fortran_gfortranspec.c	(working copy)
> @@ -0,0 +1,11 @@
> +--- gcc/fortran/gfortranspec.c.orig	2018-01-03 10:03:58 UTC
> ++++ gcc/fortran/gfortranspec.c
> +@@ -404,7 +404,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR 
> + 	}
> +     }
> + 
> +-#ifdef ENABLE_SHARED_LIBGCC
> ++#if 0
> +   if (library)
> +     {
> +       unsigned int i;
> 
> Property changes on: lang/gcc8/files/patch-gcc_fortran_gfortranspec.c
> ___________________________________________________________________
> Added: fbsd:nokeywords
> ## -0,0 +1 ##
> +yes
> \ No newline at end of property
> Added: svn:eol-style
> ## -0,0 +1 ##
> +native
> \ No newline at end of property
> Added: svn:mime-type
> ## -0,0 +1 ##
> +text/plain
> \ No newline at end of property
> Index: lang/gcc8/files/patch-libgfortran_Makefile.in
> ===================================================================
> --- lang/gcc8/files/patch-libgfortran_Makefile.in	(nonexistent)
> +++ lang/gcc8/files/patch-libgfortran_Makefile.in	(working copy)
> @@ -0,0 +1,11 @@
> +--- libgfortran/Makefile.in.orig	2018-07-26 09:48:58 UTC
> ++++ libgfortran/Makefile.in
> +@@ -625,7 +625,7 @@ libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' 
> + 	$(LTLDFLAGS) $(LIBQUADLIB) ../libbacktrace/libbacktrace.la \
> + 	$(HWCAP_LDFLAGS) \
> + 	-lm $(extra_ldflags_libgfortran) \
> +-	$(version_arg) -Wc,-shared-libgcc
> ++	$(version_arg)
> + 
> + libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP)
> + cafexeclib_LTLIBRARIES = libcaf_single.la
> 
> Property changes on: lang/gcc8/files/patch-libgfortran_Makefile.in
> ___________________________________________________________________
> Added: fbsd:nokeywords
> ## -0,0 +1 ##
> +yes
> \ No newline at end of property
> Added: svn:eol-style
> ## -0,0 +1 ##
> +native
> \ No newline at end of property
> Added: svn:mime-type
> ## -0,0 +1 ##
> +text/plain
> \ No newline at end of property

> _______________________________________________
> freebsd-ports@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-ports
> To unsubscribe, send any mail to "freebsd-ports-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190222133917.GZ2420>