Bug 231447 - devel/liborcus: add USES=c++17-lang, USE_CXXSTD=c++17
Summary: devel/liborcus: add USES=c++17-lang, USE_CXXSTD=c++17
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Mark Linimon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-18 12:25 UTC by Piotr Kubaj
Modified: 2018-11-07 03:14 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (office)


Attachments
patch (642 bytes, patch)
2018-09-18 12:25 UTC, Piotr Kubaj
no flags Details | Diff
v2 (480 bytes, patch)
2018-11-06 09:34 UTC, Piotr Kubaj
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Kubaj freebsd_committer freebsd_triage 2018-09-18 12:25:48 UTC
Created attachment 197192 [details]
patch

This patch takes care of two things:
1) it sets USES=localbase:ldflags, instead of manually specifying CPPFLAGS and LDFLAGS,
2) it adds USE_CXXSTD, which fixes build on arches using GCC.

Tested on amd64 and powerpc64.
Comment 1 commit-hook freebsd_committer freebsd_triage 2018-11-05 17:15:54 UTC
A commit references this bug:

Author: linimon
Date: Mon Nov  5 17:15:34 UTC 2018
New revision: 484203
URL: https://svnweb.freebsd.org/changeset/ports/484203

Log:
  Add USE_CXXSTD to fixes build on arches using GCC.

  Set USES=localbase:ldflags, instead of manually specifying CPPFLAGS
  and LDFLAGS.

  Tested on powerpc64 (just this port), amd64 (this port plus libreoffice).

  PR:		231447
  Submitted by:	Piotr Kubaj
  Approved by:	portmgr (tier-2 blanket)

Changes:
  head/devel/liborcus/Makefile
Comment 2 Jan Beich freebsd_committer freebsd_triage 2018-11-05 18:36:27 UTC
Why USE_CXXSTD line is necessary? GCC defaults to C++14 since r449590.
Comment 3 Piotr Kubaj freebsd_committer freebsd_triage 2018-11-06 09:34:24 UTC
Created attachment 199004 [details]
v2

It depends on what -std= is Boost compiled with. Now that it switched to c++17, so has to liborcus (probably also other ports).

I tested that it doesn't build on powerpc64 with both c++11 and c++14, but does build with c++17.
Comment 4 Piotr Kubaj freebsd_committer freebsd_triage 2018-11-06 09:35:48 UTC
Opening again.
Comment 5 Jan Beich freebsd_committer freebsd_triage 2018-11-06 09:51:13 UTC
(In reply to Piotr Kubaj from comment #3)
> It depends on what -std= is Boost compiled with.

Can you show the error when USE_CXXSTD is omitted? libstdc++ ABI is supposed to be compatible across standards, assuming the same libstdc++ version is used.

https://stackoverflow.com/questions/46746878/is-it-safe-to-link-c17-c14-and-c11-objects
Comment 6 Piotr Kubaj freebsd_committer freebsd_triage 2018-11-06 09:57:38 UTC
(In reply to Jan Beich from comment #5)
Sure, I have the same problem with other ports dependent on Boost and changing USE_CXXSTD actually helps.

When running configure target:
checking boost/system/error_code.hpp usability... yes
checking boost/system/error_code.hpp presence... yes
checking for boost/system/error_code.hpp... yes
checking for the Boost system library... no
configure: error: cannot find the flags to link with Boost system
===>  Script "configure" failed unexpectedly.

In config.log there is:
conftest.o:(.toc+0x0): undefined reference to `boost::system::detail::generic_category_instance'
conftest.o:(.toc+0x8): undefined reference to `boost::system::detail::generic_category_instance'
Comment 7 Jan Beich freebsd_committer freebsd_triage 2018-11-06 10:05:44 UTC
(In reply to Piotr Kubaj from comment #6)
> In config.log there is:
> conftest.o:(.toc+0x0): undefined reference to `boost::system::detail::generic_category_instance'
> conftest.o:(.toc+0x8): undefined reference to `boost::system::detail::generic_category_instance'

Looks like https://github.com/boostorg/system/issues/24 Compiling with C++14 should be enough. USE_GCC already defaults to C++14 since bug 219275, so USE_CXXSTD line is not required. And if you mean to support GCC < 7 (non-default) as well then C++17 is out of scope.
Comment 8 Piotr Kubaj freebsd_committer freebsd_triage 2018-11-06 10:10:23 UTC
(In reply to Jan Beich from comment #7)
Nope, it doesn't compile with c++14.
root@talos:$/usr/ports/devel/liborcus$ make -V USE_CXXSTD
c++14
From make configure:
checking boost/system/error_code.hpp usability... yes
checking boost/system/error_code.hpp presence... yes
checking for boost/system/error_code.hpp... yes
checking for the Boost system library... no
configure: error: cannot find the flags to link with Boost system
===>  Script "configure" failed unexpectedly.

And from config.log:
configure:18087: g++7 -o conftest -fvisibility=hidden -O2 -pipe  -Wl,-rpath=/usr/local/lib/gcc7  -Wl,-rpath=/usr/local/lib/gcc7 -isystem /usr/local/i
nclude -std=c++14  -Wall -pthread -isystem /usr/local/include -I/usr/local/include  -Wl,-rpath=/usr/local/lib/gcc7 -L/usr/local/lib/gcc7 -L/usr/local
/lib  -L/usr/local/lib conftest.o -lboost_system  >&5
conftest.o:(.toc+0x0): undefined reference to `boost::system::detail::generic_category_instance'
conftest.o:(.toc+0x8): undefined reference to `boost::system::detail::generic_category_instance'
collect2: error: ld returned 1 exit status
Comment 9 Jan Beich freebsd_committer freebsd_triage 2018-11-06 10:19:59 UTC
(In reply to Jan Beich from comment #7)
> Compiling with C++14 should be enough.

Err, compiling devel/boost-libs only. That issue doesn't affect consumers. I've tried to reproduce on amd64 by building both devel/boost-libs and devel/liborcus with USE_GCC but those built fine.


(In reply to Piotr Kubaj from comment #8)
> Nope, it doesn't compile with c++14.

When was the last time you've rebuilt devel/boost-libs? I hope it's sometime after bug 222542 landed.

I just don't understand how changing C++14 to C++17 is going to fix your issue.
Comment 10 Piotr Kubaj freebsd_committer freebsd_triage 2018-11-06 10:30:59 UTC
(In reply to Jan Beich from comment #9)
It's actually a newly installed FreeBSD.
root@talos:$~$ pkg info boost-libs-1.68.0_2
boost-libs-1.68.0_2
Name           : boost-libs
Version        : 1.68.0_2
Installed on   : Tue Nov  6 09:11:55 2018 CET

I'm not a Boost expert, so I can't explain it. It might be a Boost bug after all. But the fact is that it just doesn't build with c++14 (or c++11), but builds with c++17.
Comment 11 Jan Beich freebsd_committer freebsd_triage 2018-11-06 10:36:55 UTC
Can you check devel/boost-libs actually builds in C++14 or C++17 mode or upload build log somewhere (e.g., via a pastebin service)? Maybe something fails on powerpc* which reintroduces the regression appeared since Boost 1.68.

Fixing consumers to follow Boost C++ version doesn't look correct. Not every consumer is compatible with C++11, let alone C++17. Only USES=compiler:c++11-lib is really required to force the same libstdc++ version.
Comment 12 Jan Beich freebsd_committer freebsd_triage 2018-11-06 10:38:56 UTC
Also, the next Boost version (bug 232525) will make System library header-only which eliminates all linking issues it can cause.
Comment 13 Piotr Kubaj freebsd_committer freebsd_triage 2018-11-06 16:56:05 UTC
boost-libs compiles in c++17, just as it should (according to devel/boost-all/compiled.mk):
https://talos.anongoth.pl/data/powerpc64-default/2018-11-06_16h38m24s/logs/boost-libs-1.68.0_2.log
Comment 14 commit-hook freebsd_committer freebsd_triage 2018-11-07 02:48:29 UTC
A commit references this bug:

Author: jbeich
Date: Wed Nov  7 02:47:39 UTC 2018
New revision: 484377
URL: https://svnweb.freebsd.org/changeset/ports/484377

Log:
  devel/boost-libs: unbreak some C++14 consumers with GCC after r479222

  Boost 1.68 changed System ABI[1] for C++14 but due to a GCC bug it's
  disabled for C++ >= 17. As our Boost package is built in C++17
  consumers cannot use C++14. So, disable the new ABI for the affected
  GCC versions regardless of C++ standard.

  [1] https://github.com/boostorg/system/commit/7b6dcf6ac668

  PR:		231447
  Reported by:	Piotr Kubaj

Changes:
  head/devel/boost-libs/Makefile
  head/devel/boost-libs/files/patch-boost_system_error__code.hpp
Comment 15 commit-hook freebsd_committer freebsd_triage 2018-11-07 03:05:44 UTC
A commit references this bug:

Author: jbeich
Date: Wed Nov  7 03:04:44 UTC 2018
New revision: 484378
URL: https://svnweb.freebsd.org/changeset/ports/484378

Log:
  devel/liborcus: drop USE_CXXSTD after r484377

  PR:		231447

Changes:
  head/devel/liborcus/Makefile
Comment 16 Jan Beich freebsd_committer freebsd_triage 2018-11-07 03:06:52 UTC
Thank you for the feedback. I was able to reproduce:
- devel/boost-libs had to be 1.68 (because 1.69 is header-only)
- devel/boost-libs had to be built in C++17 (but GCC >= 6 default is C++14)
- lang/gcc7 had to be less than 7.4.0
- devel/liborcus had to not set -std= and rely on compiler default
Comment 17 Jan Beich freebsd_committer freebsd_triage 2018-11-07 03:14:11 UTC
Forgot in comment 16:
- GCC_DEFAULT had to be 7 (GCC < 7 has poor C++17 support while GCC >= 8 isn't affected)

Once lang/gcc7 is upgraded to 7.4.0 but neither bug 231590 nor bug 232525 landed yet PORTREVISION in devel/boost-libs needs to be bumped or System wouldn't expose the new ABI.