Re: Problems with out libgcc_s.so in base

2016-08-18 Thread Steven G. Kargl
On Thu, Aug 18, 2016 at 05:43:04PM -0700, Steven G. Kargl wrote:
> 
> % cd ~/work/6/lib

Dang.  This should have been "cd /usr/local/lib/gcc6"

> % sed s/gcc_s/gcc_t/ < libgfortran.so.3 > zxc
> % mv zxc libgfortran.so.3 
> % elfdump -a libgfortran.so.3 | grep gcc_
> d_val: libgcc_t.so.1
> % ln -sf libgcc_s.so.1 libgcc_t.so.1

This magic can be done as a post-install step.

> % ldconfig -R
> % ldconfig -r | grep libgcc
> 6:-lgcc_s.1 => /lib/libgcc_s.so.1
> 735:-lgcc_s.1 => /usr/local/lib/gcc6/libgcc_s.so.1
> 745:-lgcc_t.1 => /usr/local/lib/gcc6/libgcc_t.so.1
> 
> % cd tmp
> % gfortran6 -o z foo.f90 && ./z
>  Hello
> 
> That is, the name clash in ldconfig can be avoided by editing
> libgfortran.so.3 to look for a symlinked libgcc_s.so.1.
> 
> -- 
> Steve
> http://troutmask.apl.washington.edu/~kargl/

-- 
Steve
http://troutmask.apl.washington.edu/~kargl/
___
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"


Re: Problems with out libgcc_s.so in base

2016-08-18 Thread Steve Kargl
On Thu, Aug 18, 2016 at 07:58:01PM -0400, Diane Bruce wrote:
> On Thu, Aug 18, 2016 at 04:50:49PM -0700, Steve Kargl wrote:
> > On Fri, Aug 19, 2016 at 01:14:32AM +0200, Tijl Coosemans wrote:
> > > > 
> > > > For example, on one of my systems, I now have these:
> > > > 
> 
> > entry: 5
> > d_tag: DT_RPATH
> > d_val: /usr/local/lib/gcc6
> > 
> > I don't know how ELF or the ldd work, but shouldn't the DT_RPATH
> > tell ldd to look for all of the above libraries in /usr/local/lib/gcc6
> > first.  If a library isn't present, it would then look in ldconfig's
> > hints file or fallback to /lib and /usr/lib/.  But, I suppose we 
> > still run into issues as libgfortran.so.3 needs its companion libgcc_s.s.1
> > from DT_RPATH and libc.so.7 expects the one from /lib (or perhaps
> > libcxxrt.so.1?).
> 
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=208120 
> 
> Anything compiled with cmake infrastructure loses the DT_RPATH.
> 

I know nothing about cmake, but it seems to be broken. :)

-- 
Steve
___
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"


Re: Problems with out libgcc_s.so in base

2016-08-18 Thread Steve Kargl
On Fri, Aug 19, 2016 at 01:14:32AM +0200, Tijl Coosemans wrote:
> > 
> > For example, on one of my systems, I now have these:
> > 
> > /usr/local/lib/gcc47/libgcc_s.so.1
> > /usr/local/lib/gcc48/libgcc_s.so.1
> > /usr/local/lib/gcc49/libgcc_s.so.1
> > /usr/local/lib/gcc5/libgcc_s.so.1
> > /usr/local/lib/gcc6/libgcc_s.so.1
> > /usr/local/lib/gcc7/libgcc_s.so.1
> > 
> > So which one are you going to put at the front of the path?  The gcc7
> > version?  If you are lucky that one is backwards compatible with all the
> > previous ones, but still I would like it much better if a program
> > compiled by, say, gcc5 was linked *explicitly* against the gcc5 version
> > of libgcc_s.so.
> > 
> > Steve's proposed scheme solves that quite nicely, in my opinion.  The
> > problem is only in the details, as usual.  There will be many configure
> > scripts and libtool-like utilities out there, that assume libgcc must be
> > linked using -lgcc_s, not -lgcc_s$VERSION.
> 
> I now noticed there is a FAQ about this at
> https://gcc.gnu.org/faq.html#rpath.  It gives some suggestions including
> creating wrapper scripts, but they wouldn't work when code is compiled
> with gfortran but linked with Clang cc/c++.  The only thing that works
> in this case is -Wl,-rpath.  Another option would be to create a port
> that installs a recent version of libgcc in /usr/local/lib and let the
> gcc ports use that instead of their own copy.

elfdump -a libgfortran.so.3 shows

dynamic:

entry: 0
d_tag: DT_NEEDED
d_val: libquadmath.so.0

entry: 1
d_tag: DT_NEEDED
d_val: libm.so.5

entry: 2
d_tag: DT_NEEDED
d_val: libgcc_s.so.1

entry: 3
d_tag: DT_NEEDED
d_val: libc.so.7

entry: 4
d_tag: DT_SONAME
d_val: libgfortran.so.3

entry: 5
d_tag: DT_RPATH
d_val: /usr/local/lib/gcc6

I don't know how ELF or the ldd work, but shouldn't the DT_RPATH
tell ldd to look for all of the above libraries in /usr/local/lib/gcc6
first.  If a library isn't present, it would then look in ldconfig's
hints file or fallback to /lib and /usr/lib/.  But, I suppose we 
still run into issues as libgfortran.so.3 needs its companion libgcc_s.s.1
from DT_RPATH and libc.so.7 expects the one from /lib (or perhaps
libcxxrt.so.1?).



-- 
Steve
___
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"


Re: Problems with out libgcc_s.so in base

2016-08-18 Thread Tijl Coosemans
On Thu, 18 Aug 2016 14:48:28 +0200 Dimitry Andric  wrote:
> On 18 Aug 2016, at 11:15, Tijl Coosemans  wrote: 
>> On Wed, 17 Aug 2016 14:17:10 -0700 Steve Kargl 
>>  wrote:
>>> % gfortran6 -o z foo.f90 && ./z
>>> /lib/libgcc_s.so.1: version GCC_4.6.0 required by \
>>> /usr/local/lib/gcc6/libgfortran.so.3 not found
>>> % ldconfig -r | grep libgcc
>>>6:-lgcc_s.1 => /lib/libgcc_s.so.1
>>>735:-lgcc_s.1 => /usr/local/lib/gcc6/libgcc_s.so.1
>>> 
>>> Clearly, ldd is looking for 735 but finds 6.  If the lang/gcc6 could
>>> be convinced to build, install, and use libgcc_s6.so.1, then the
>>> problem is solved without a wrapper.  
>> 
>> In this case the real cause of the problem is that compilers and linkers
>> search /lib and /usr/lib last and ldconfig searches them first.  Renaming
>> the library is just a hack around that.  
> 
> Well, even if you would adjust the compilers and linkers to look in
> /usr/local/lib first,

No, I wanted to change /etc/rc.d/ldconfig to put /lib and /usr/lib last.
That would match base ld(1) so anything that links successfully at
compile-time will also link successfully at run-time (if there are no
other search order mismatches leading to conflicts).

But, this means that in case of a name conflict between base and ports,
the ports provided library is assumed to be the right one.  I'm not 100%
sure this is smart.  Usually the ports version of a library is more
recent and if the name is the same it should be backward compatible, but
if that's not the case (older or not compatible) base utilities may fail
to run (like ./z in the example above) and that's maybe worse than ports
or locally built programs failing.

> how would you solve the problem of having
> multiple, possibly incompatible versions of the same library in
> different directories?
> 
> For example, on one of my systems, I now have these:
> 
> /usr/local/lib/gcc47/libgcc_s.so.1
> /usr/local/lib/gcc48/libgcc_s.so.1
> /usr/local/lib/gcc49/libgcc_s.so.1
> /usr/local/lib/gcc5/libgcc_s.so.1
> /usr/local/lib/gcc6/libgcc_s.so.1
> /usr/local/lib/gcc7/libgcc_s.so.1
> 
> So which one are you going to put at the front of the path?  The gcc7
> version?  If you are lucky that one is backwards compatible with all the
> previous ones, but still I would like it much better if a program
> compiled by, say, gcc5 was linked *explicitly* against the gcc5 version
> of libgcc_s.so.
> 
> Steve's proposed scheme solves that quite nicely, in my opinion.  The
> problem is only in the details, as usual.  There will be many configure
> scripts and libtool-like utilities out there, that assume libgcc must be
> linked using -lgcc_s, not -lgcc_s$VERSION.

This is a separate problem that has been discussed many times before.
The ports tree adds -Wl,-rpath to *FLAGS in several places to choose
a library.  I now noticed there is a FAQ about this at
https://gcc.gnu.org/faq.html#rpath.  It gives some suggestions including
creating wrapper scripts, but they wouldn't work when code is compiled
with gfortran but linked with Clang cc/c++.  The only thing that works
in this case is -Wl,-rpath.  Another option would be to create a port
that installs a recent version of libgcc in /usr/local/lib and let the
gcc ports use that instead of their own copy.
___
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"


[Bug 211864] LLVM is using AVX instructions for CPUTYPE=btver1 (AMD Bobcat)

2016-08-18 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211864

--- Comment #7 from Dimitry Andric  ---
(In reply to Michel Depeige from comment #6)
> Will this fix be in RC2 ?

I will merge it to stable/11 on August 20, when the timeout expires.  Then I
will contact the Release Engineering team for permission to merge it to the
11.0 release branch.

This is not really a showstopper though, since you can work around it
relatively easily by setting your CPUTYPE to something else.  It is up to the
Release Engineering team to decide.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"


[Bug 211864] LLVM is using AVX instructions for CPUTYPE=btver1 (AMD Bobcat)

2016-08-18 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211864

--- Comment #6 from Michel Depeige  ---
Hello,

the patch is working as expected : no more vzeroupper !
I have rebuild successfully all my ports, even kernel, everything is working
fine

Thanks for your help !

Will this fix be in RC2 ?

Regards

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"


Re: Problems with out libgcc_s.so in base

2016-08-18 Thread Steve Kargl
On Thu, Aug 18, 2016 at 02:48:28PM +0200, Dimitry Andric wrote:
> On 18 Aug 2016, at 11:15, Tijl Coosemans  wrote:
> > 
> > On Wed, 17 Aug 2016 14:17:10 -0700 Steve Kargl 
> >  wrote:
> ...
> >> % ldconfig -r | grep libgcc
> >>6:-lgcc_s.1 => /lib/libgcc_s.so.1
> >>735:-lgcc_s.1 => /usr/local/lib/gcc6/libgcc_s.so.1
> >> 
> >> Clearly, ldd is looking for 735 but finds 6.  If the lang/gcc6 could
> >> be convinced to build, install, and use libgcc_s6.so.1, then the
> >> problem is solved without a wrapper.
> > 
> > In this case the real cause of the problem is that compilers and linkers
> > search /lib and /usr/lib last and ldconfig searches them first.  Renaming
> > the library is just a hack around that.
> 
> Well, even if you would adjust the compilers and linkers to look in
> /usr/local/lib first, how would you solve the problem of having
> multiple, possibly incompatible versions of the same library in
> different directories?
> 
> For example, on one of my systems, I now have these:
> 
> /usr/local/lib/gcc47/libgcc_s.so.1
> /usr/local/lib/gcc48/libgcc_s.so.1
> /usr/local/lib/gcc49/libgcc_s.so.1
> /usr/local/lib/gcc5/libgcc_s.so.1
> /usr/local/lib/gcc6/libgcc_s.so.1
> /usr/local/lib/gcc7/libgcc_s.so.1
> 
> So which one are you going to put at the front of the path?  The gcc7
> version?  If you are lucky that one is backwards compatible with all the
> previous ones, but still I would like it much better if a program
> compiled by, say, gcc5 was linked *explicitly* against the gcc5 version
> of libgcc_s.so.
> 
> Steve's proposed scheme solves that quite nicely, in my opinion.  The
> problem is only in the details, as usual.  There will be many configure
> scripts and libtool-like utilities out there, that assume libgcc must be
> linked using -lgcc_s, not -lgcc_s$VERSION.


I asked on the g...@gcc.gnu.org if there is a configure option
to go the above, and unfortunately there isn't.  I was pointed
to --enable-version-specific-runtime-libs, but was then told
that whatever it does is broken for multilib installs.

I had not considered libtool-like utilities, so Dimitry is probably
right in that this may open a can of worms.

Another hack for the ports system would be to unilaterally include
an -Wl,-rpath option on the gfortran commmand line.  Currently, 
-Wl,-rpath is added to FFLAGS, FCFLAGS, and LDFLAGS in fortran.mk.
The problem is that some ports might reset FFLAGS after fortran.mk
has been included in Makefile.   This should do the trick (watch
for cut-n-paster whitespace corruption):

Index: fortran.mk
===
--- fortran.mk  (revision 419226)
+++ fortran.mk  (working copy)
@@ -26,9 +26,8 @@
 RUN_DEPENDS+=  gfortran${_GCC_VER}:lang/gcc${_GCC_VER}
 .endif
 USE_BINUTILS=  yes
-F77=   gfortran${_GCC_VER}
-FC=gfortran${_GCC_VER}
-FFLAGS+=   -Wl,-rpath=${LOCALBASE}/lib/gcc${_GCC_VER}
+F77=   gfortran${_GCC_VER} -Wl,-rpath=${LOCALBASE}/lib/gcc${_GCC_VER}
+FC=gfortran${_GCC_VER} -Wl,-rpath=${LOCALBASE}/lib/gcc${_GCC_VER}
 FCFLAGS+=  -Wl,-rpath=${LOCALBASE}/lib/gcc${_GCC_VER}
 LDFLAGS+=  -Wl,-rpath=${LOCALBASE}/lib/gcc${_GCC_VER} \
-L${LOCALBASE}/lib/gcc${_GCC_VER} -B${LOCALBASE}/bin

One potential issues may be mixed-language apps that use Fortran libraries,
but link with gcc or g++.

-- 
Steve
___
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"


Re: Problems with out libgcc_s.so in base

2016-08-18 Thread Dimitry Andric
On 18 Aug 2016, at 11:15, Tijl Coosemans  wrote:
> 
> On Wed, 17 Aug 2016 14:17:10 -0700 Steve Kargl 
>  wrote:
...
>> % ldconfig -r | grep libgcc
>>6:-lgcc_s.1 => /lib/libgcc_s.so.1
>>735:-lgcc_s.1 => /usr/local/lib/gcc6/libgcc_s.so.1
>> 
>> Clearly, ldd is looking for 735 but finds 6.  If the lang/gcc6 could
>> be convinced to build, install, and use libgcc_s6.so.1, then the
>> problem is solved without a wrapper.
> 
> In this case the real cause of the problem is that compilers and linkers
> search /lib and /usr/lib last and ldconfig searches them first.  Renaming
> the library is just a hack around that.

Well, even if you would adjust the compilers and linkers to look in
/usr/local/lib first, how would you solve the problem of having
multiple, possibly incompatible versions of the same library in
different directories?

For example, on one of my systems, I now have these:

/usr/local/lib/gcc47/libgcc_s.so.1
/usr/local/lib/gcc48/libgcc_s.so.1
/usr/local/lib/gcc49/libgcc_s.so.1
/usr/local/lib/gcc5/libgcc_s.so.1
/usr/local/lib/gcc6/libgcc_s.so.1
/usr/local/lib/gcc7/libgcc_s.so.1

So which one are you going to put at the front of the path?  The gcc7
version?  If you are lucky that one is backwards compatible with all the
previous ones, but still I would like it much better if a program
compiled by, say, gcc5 was linked *explicitly* against the gcc5 version
of libgcc_s.so.

Steve's proposed scheme solves that quite nicely, in my opinion.  The
problem is only in the details, as usual.  There will be many configure
scripts and libtool-like utilities out there, that assume libgcc must be
linked using -lgcc_s, not -lgcc_s$VERSION.

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Problems with out libgcc_s.so in base

2016-08-18 Thread Tijl Coosemans
On Wed, 17 Aug 2016 14:17:10 -0700 Steve Kargl 
 wrote:
> On Sun, Aug 14, 2016 at 07:34:30PM -0400, Diane Bruce wrote:
>> On Sun, Aug 14, 2016 at 04:03:51PM -0700, Steve Kargl wrote:  
>>> Freebsd-ports could also use a wrapper:
>>> % cat ~/bin/gfc7
>>> #! /bin/sh
>>> DIR=`id -P sgk | sed 's/\:/\ /g' | awk '{print $9}'`
>>> export DIR
>>> 
>>> LD_LIBRARY_PATH=$DIR/work/7/lib
>>> export LD_LIBRARY_PATH
>>> 
>>> LD_RUN_PATH=$DIR/work/7/lib
>>> export LD_RUN_PATH
>>> 
>>> $DIR/work/7/bin/gfortran -fno-backtrace $@  
>> 
>> Yes. I have also suggested we use a wrapper to the ports guys.
> 
> I thought about this a bit, and cleaner solution might be
> to add the program suffix to libgcc_s.so.1.  For example,
> 
> % cat foo.f90
> program foo
>print *, 'Hello'
> end program
> % gfortran6 -o z foo.f90 && ./z
> /lib/libgcc_s.so.1: version GCC_4.6.0 required by \
> /usr/local/lib/gcc6/libgfortran.so.3 not found
> % ldconfig -r | grep libgcc
> 6:-lgcc_s.1 => /lib/libgcc_s.so.1
> 735:-lgcc_s.1 => /usr/local/lib/gcc6/libgcc_s.so.1
> 
> Clearly, ldd is looking for 735 but finds 6.  If the lang/gcc6 could
> be convinced to build, install, and use libgcc_s6.so.1, then the
> problem is solved without a wrapper.

In this case the real cause of the problem is that compilers and linkers
search /lib and /usr/lib last and ldconfig searches them first.  Renaming
the library is just a hack around that.
___
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"