Bug 223279

Summary: devel/boost-libs fails to build on powerpc64 since update to 1.65.1
Product: Ports & Packages Reporter: Justin Hibbits <jhibbits>
Component: Individual Port(s)Assignee: FreeBSD Office Team <office>
Status: Closed FIXED    
Severity: Affects Only Me CC: andreast, gerald
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
poudriere build log
none
config.log
none
Proposed fix none

Description Justin Hibbits freebsd_committer 2017-10-27 14:26:35 UTC
Created attachment 187520 [details]
poudriere build log

boost-libs 1.65.1 introduces the stacktrace-addr2line library, which for some reason does not build on powerpc64 (no indication why).  The build succeeds, but the package fails because the library does not exist.  Log is attached.
Comment 1 Jan Beich freebsd_committer 2017-10-27 14:35:13 UTC
Comment on attachment 187520 [details]
poudriere build log

>    - addr2line builds         : no

Can you attach bin.v2/config.log located under WRKSRC?
Comment 2 Justin Hibbits freebsd_committer 2017-10-27 16:35:33 UTC
Created attachment 187527 [details]
config.log

Scanning the log for addr2line, I came across the following giveaway:

gcc.compile.c++ bin.v2/libs/stacktrace/build/gcc-6.4.0/debug/has_addr2line.o

    "g++6"   -O0 -fno-inline -Wall -g -fPIC -m64 -pipe -DLIBICONV_PLUG -Wl,-rpath=/usr/local/lib/gcc6 -fno-strict-aliasing -DLIBICONV_PLUG -Wl,-rpath=/usr/local/lib/gcc6 -std=gnu++11 -pipe -DLIBICONV_PLUG -Wl,-rpath=/usr/local/lib/gcc6 -fno-strict-aliasing -DBOOST_ALL_NO_LIB=1  -I"." -c -o "bin.v2/libs/stacktrace/build/gcc-6.4.0/debug/has_addr2line.o" "libs/stacktrace/build/has_addr2line.cpp"

gcc.link bin.v2/libs/stacktrace/build/gcc-6.4.0/debug/addr2line_exe

    "g++6"    -o "bin.v2/libs/stacktrace/build/gcc-6.4.0/debug/addr2line_exe" -Wl,--start-group "bin.v2/libs/stacktrace/build/gcc-6.4.0/debug/has_addr2line.o"  -Wl,-Bstatic  -Wl,-Bdynamic  -Wl,--end-group -g -m64 

Jamfile</wrkdirs/usr/ports/devel/boost-libs/work/boost_1_65_1/libs/stacktrace/build>.mp_simple_run_action bin.v2/libs/stacktrace/build/gcc-6.4.0/debug/addr2line.output

      bin.v2/libs/stacktrace/build/gcc-6.4.0/debug/addr2line_exe > bin.v2/libs/stacktrace/build/gcc-6.4.0/debug/addr2line.output

/usr/lib/libstdc++.so.6: version GLIBCXX_3.4.21 required by /wrkdirs/usr/ports/devel/boost-libs/work/boost_1_65_1/bin.v2/libs/stacktrace/build/gcc-6.4.0/debug/addr2line_exe not found
...failed Jamfile</wrkdirs/usr/ports/devel/boost-libs/work/boost_1_65_1/libs/stacktrace/build>.mp_simple_run_action bin.v2/libs/stacktrace/build/gcc-6.4.0/debug/addr2line.output...


So, looks like it needs a -rpath somewhere...
Comment 3 Justin Hibbits freebsd_committer 2017-12-09 20:42:24 UTC
Created attachment 188669 [details]
Proposed fix

This is not the nicest patch.  It touches Mk/bsd.gcc.mk (adds RPATH variable), but it does fix the build.  Probably needs an exprun at the minimum.
Comment 4 Justin Hibbits freebsd_committer 2017-12-09 22:05:45 UTC
Adding Gerald since the patch touches bsd.gcc.mk
Comment 5 Jan Beich freebsd_committer 2017-12-10 03:24:40 UTC
Comment on attachment 188669 [details]
Proposed fix

> +MAKE_ARGS+=	xdll-path=${RPATH}

Why not use ${_GCC_RUNTIME} directly? make(1) usually postpones variable expansion unless it's used in .if/.for conditionals or target dependencies.
Comment 6 Jan Beich freebsd_committer 2017-12-10 03:28:45 UTC
Comment on attachment 188669 [details]
Proposed fix

> +.if ${COMPILER_TYPE}==gcc

This should be CHOSEN_COMPILER_PATH in case USES=compiler switches from Clang to GCC or vice versa. Maybe also avoid .if conditional to get rid of immediate variable expansion e.g.,


  MAKE_ARGS+=	${MAKE_ARGS_${CHOSEN_COMPILER_PATH}}
  MAKE_ARGS_gcc=	xdll-path=${_GCC_RUNTIME}

After that .include line changes will no longer be required.
Comment 7 Jan Beich freebsd_committer 2017-12-10 03:34:04 UTC
(In reply to Jan Beich from comment #6)
Err, s/CHOSEN_COMPILER_PATH/CHOSEN_COMPILER_TYPE/ ;)
Comment 8 Justin Hibbits freebsd_committer 2017-12-10 04:28:08 UTC
(In reply to Jan Beich from comment #5)

I was operating under the assumption that _-prefixed variables are intended to be private to the include file.  If that's not the general case, I'll gladly change it.
Comment 9 Jan Beich freebsd_committer 2017-12-10 17:57:44 UTC
A number of ports already uses ${_GCC_RUNTIME}. While the use of internal variable is discouraged it's not forbidden given lack of better alternative. For one, USES=fortran has ${LOCALBASE}/lib/gcc${_GCC_VER} which is just as ugly.
Comment 10 commit-hook freebsd_committer 2017-12-10 18:41:42 UTC
A commit references this bug:

Author: jbeich
Date: Sun Dec 10 18:40:51 UTC 2017
New revision: 455905
URL: https://svnweb.freebsd.org/changeset/ports/455905

Log:
  devel/boost-libs: pass RPATH when building with GCC

    "g++6"    -o "bin.v2/libs/stacktrace/build/gcc-6.4.0/debug/addr2line_exe" -Wl,--start-group "bin.v2/libs/stacktrace/build/gcc-6.4.0/debug/has_addr2line.o"  -Wl,-Bstatic  -Wl,-Bdynamic  -Wl,--end-group -g -m64
    /usr/lib/libstdc++.so.6: version GLIBCXX_3.4.21 required by /wrkdirs/usr/ports/devel/boost-libs/work/boost_1_65_1/bin.v2/libs/stacktrace/build/gcc-6.4.0/debug/addr2line_exe not found
    [...]
    Error: Missing: lib/libboost_stacktrace_addr2line.a
    Error: Missing: lib/libboost_stacktrace_addr2line.so
    Error: Missing: lib/libboost_stacktrace_addr2line.so.%%BOOST_SHARED_LIB_VER%%

  PR:		223279
  Submitted by:	jhibbits (based on)

Changes:
  head/devel/boost-libs/Makefile
Comment 11 Justin Hibbits freebsd_committer 2017-12-10 20:17:20 UTC
Thanks, Jan!
Comment 12 Gerald Pfeifer freebsd_committer 2017-12-10 22:32:05 UTC
(In reply to Justin Hibbits from comment #8)
> I was operating under the assumption that _-prefixed variables are
> intended to be private to the include file. 

And you're right.  Using ${_GCC_RUNTIME} in individual ports is a
mistake (though introducing another variable that just mirrors that,
if apparently necessary like here, probably is a cure worse than the
disease?)

Could we avoid all of this is bug #200171 was addressed and the
rpath included by the gcc, g++,... drivers?
Comment 13 commit-hook freebsd_committer 2017-12-11 00:08:19 UTC
A commit references this bug:

Author: jbeich
Date: Mon Dec 11 00:07:17 UTC 2017
New revision: 455916
URL: https://svnweb.freebsd.org/changeset/ports/455916

Log:
  MFH: r455905

  devel/boost-libs: pass RPATH when building with GCC

    "g++6"    -o "bin.v2/libs/stacktrace/build/gcc-6.4.0/debug/addr2line_exe" -Wl,--start-group "bin.v2/libs/stacktrace/build/gcc-6.4.0/debug/has_addr2line.o"  -Wl,-Bstatic  -Wl,-Bdynamic  -Wl,--end-group -g -m64
    /usr/lib/libstdc++.so.6: version GLIBCXX_3.4.21 required by /wrkdirs/usr/ports/devel/boost-libs/work/boost_1_65_1/bin.v2/libs/stacktrace/build/gcc-6.4.0/debug/addr2line_exe not found
    [...]
    Error: Missing: lib/libboost_stacktrace_addr2line.a
    Error: Missing: lib/libboost_stacktrace_addr2line.so
    Error: Missing: lib/libboost_stacktrace_addr2line.so.%%BOOST_SHARED_LIB_VER%%

  PR:		223279
  Submitted by:	jhibbits (based on)
  Approved by:	ports-secteam blanket

Changes:
_U  branches/2017Q4/
  branches/2017Q4/devel/boost-libs/Makefile
Comment 14 Justin Hibbits freebsd_committer 2017-12-11 02:00:27 UTC
(In reply to Gerald Pfeifer from comment #12)

Forcing the gcc ports to include the rpath themselves would likely solve this problem, yes.  It would also fix other ports, including libreoffice.