Bug 214654 - www/chromium: fails to build with libc++ 3.9
Summary: www/chromium: fails to build with libc++ 3.9
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: freebsd-chromium mailing list
URL: https://github.com/llvm-mirror/libcxx...
Keywords: patch, patch-ready
Depends on:
Blocks: 212343
  Show dependency treegraph
 
Reported: 2016-11-19 02:27 UTC by Jan Beich
Modified: 2017-01-12 17:23 UTC (History)
9 users (show)

See Also:
bugzilla: maintainer-feedback? (chromium)
cpm: merge-quarterly?


Attachments
Use different method to enable trivial pair copy constructors for newer libc++ (4.12 KB, patch)
2016-12-04 14:52 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2016-11-19 02:27:48 UTC
In file included from ../../services/ui/ws/window_manager_state.cc:5:
In file included from ../../services/ui/ws/window_manager_state.h:10:
In file included from /usr/include/c++/v1/memory:599:
/usr/include/c++/v1/__config:58:2: error: "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported.     use _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead
#error "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported. \
 ^
1 error generated.

http://package18.nyi.freebsd.org/data/headi386PR212343-default/2016-09-11_07h04m19s/logs/errors/chromium-52.0.2743.116.log
http://package18.nyi.freebsd.org/data/headamd64PR212343-default/2016-09-13_07h18m01s/logs/errors/chromium-52.0.2743.116.log
Comment 1 Jan Beich freebsd_committer 2016-11-19 05:22:11 UTC
Adding the following to www/chromium/Makefile.local unbreaks build for 52.*

  BUILD_DEPENDS+=	${LOCALBASE}/include/c++/v1/__config:devel/libc++
  CXXFLAGS+=	-nostdinc++ -isystem ${LOCALBASE}/include/c++/v1

but not for 54.* (see review D8517) which no longer respects CXXFLAGS.
Comment 2 clutton 2016-11-20 03:00:33 UTC
It looks wise using devel/libc++ for me.
-isystem flag has it's place in GN system and now it's time to use it, probably.
Comment 3 clutton 2016-11-20 17:28:30 UTC
(In reply to Jan Beich (mail not working) from comment #1)


Could you try removing _LIBCPP_TRIVIAL_PAIR_COPY_CTOR completely from build system?
If I understand it right libc++ from ports has expected behaviour, and would work without hacks, is it?


Here:
https://github.com/gliaskos/freebsd-chromium/blob/master/www/chromium/files/patch-services_ui_ws_BUILD.gn

Or just remove the patch and build it again.

Jan would you prefer to finish this by yourself or do you need help, etc?
I could do it also, but I want you to finish this, since you have started and idea is your.
Comment 4 Jan Beich freebsd_committer 2016-11-21 11:21:46 UTC
(In reply to clutton from comment #3)
> Could you try removing _LIBCPP_TRIVIAL_PAIR_COPY_CTOR completely
> from build system?

Chromium 52 builds fine then.

> Or just remove the patch and build it again.

Chromium 54 fails with

  In file included from ../../services/ui/ws/user_activity_monitor.cc:5:
  In file included from ../../services/ui/ws/user_activity_monitor.h:8:
  In file included from ../../base/time/tick_clock.h:9:
  In file included from ../../base/time/time.h:60:
  In file included from ../../base/numerics/safe_math.h:13:
  In file included from ../../base/logging.h:12:
  In file included from /usr/include/c++/v1/sstream:174:
  In file included from /usr/include/c++/v1/ostream:138:
  In file included from /usr/include/c++/v1/ios:216:
  In file included from /usr/include/c++/v1/__locale:15:
  In file included from /usr/include/c++/v1/string:442:
  In file included from /usr/include/c++/v1/algorithm:633:
  /usr/include/c++/v1/utility:316:11: error: call to deleted constructor of 'mojo::InterfacePtr<ui::mojom::UserActivityObserver>'
	    second(__p.second)
	    ^      ~~~~~~~~~~
  /usr/include/c++/v1/memory:1747:31: note: in instantiation of member function 'std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> >::pair' requested here
	      ::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...);
				^
  /usr/include/c++/v1/memory:1658:18: note: in instantiation of function template specialization 'std::__1::allocator<std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> > >::construct<std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> >, const std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> > &>' requested here
	      {__a.construct(__p, _VSTD::forward<_Args>(__args)...);}
		   ^
  /usr/include/c++/v1/memory:1504:14: note: in instantiation of function template specialization 'std::__1::allocator_traits<std::__1::allocator<std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> > > >::__construct<std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> >, const std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> > &>' requested here
	      {__construct(__has_construct<allocator_type, _Tp*, _Args...>(),
	       ^
  /usr/include/c++/v1/memory:1620:17: note: in instantiation of function template specialization 'std::__1::allocator_traits<std::__1::allocator<std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> > > >::construct<std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> >, const std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> > &>' requested here
		  construct(__a, _VSTD::__to_raw_pointer(__end2-1), _VSTD::move_if_noexcept(*--__end1));
		  ^
  /usr/include/c++/v1/vector:892:21: note: in instantiation of function template specialization 'std::__1::allocator_traits<std::__1::allocator<std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> > > >::__construct_backward<std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> > *>' requested here
      __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, this->__end_, __v.__begin_);
		      ^
  /usr/include/c++/v1/vector:1577:5: note: in instantiation of member function 'std::__1::vector<std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> >, std::__1::allocator<std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> > > >::__swap_out_circular_buffer' requested here
      __swap_out_circular_buffer(__v);
      ^
  /usr/include/c++/v1/vector:1614:9: note: in instantiation of function template specialization 'std::__1::vector<std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> >, std::__1::allocator<std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> > > >::__push_back_slow_path<std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> > >' requested here
	  __push_back_slow_path(_VSTD::move(__x));
	  ^
  ../../services/ui/ws/user_activity_monitor.cc:62:23: note: in instantiation of member function 'std::__1::vector<std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> >, std::__1::allocator<std::__1::pair<ui::ws::UserActivityMonitor::ActivityObserverInfo, mojo::InterfacePtr<ui::mojom::UserActivityObserver> > > >::push_back' requested here
    activity_observers_.push_back(std::make_pair(info, std::move(observer)));
			^
  ../../mojo/public/cpp/bindings/interface_ptr.h:214:28: note: 'InterfacePtr' has been explicitly marked deleted here
    DISALLOW_COPY_AND_ASSIGN(InterfacePtr);
			     ^


  In file included from ../../services/ui/ws/user_activity_monitor.cc:5:
  In file included from ../../services/ui/ws/user_activity_monitor.h:8:
  In file included from ../../base/time/tick_clock.h:9:
  In file included from ../../base/time/time.h:60:
  In file included from ../../base/numerics/safe_math.h:13:
  In file included from ../../base/logging.h:12:
  In file included from /usr/include/c++/v1/sstream:174:
  In file included from /usr/include/c++/v1/ostream:138:
  In file included from /usr/include/c++/v1/ios:216:
  In file included from /usr/include/c++/v1/__locale:15:
  In file included from /usr/include/c++/v1/string:442:
  In file included from /usr/include/c++/v1/algorithm:633:
  /usr/include/c++/v1/utility:316:11: error: call to deleted constructor of 'mojo::InterfacePtr<ui::mojom::UserIdleObserver>'
	    second(__p.second)
	    ^      ~~~~~~~~~~
  /usr/include/c++/v1/memory:1747:31: note: in instantiation of member function 'std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> >::pair' requested here
	      ::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...);
				^
  /usr/include/c++/v1/memory:1658:18: note: in instantiation of function template specialization 'std::__1::allocator<std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> > >::construct<std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> >, const std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> > &>' requested here
	      {__a.construct(__p, _VSTD::forward<_Args>(__args)...);}
		   ^
  /usr/include/c++/v1/memory:1504:14: note: in instantiation of function template specialization 'std::__1::allocator_traits<std::__1::allocator<std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> > > >::__construct<std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> >, const std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> > &>' requested here
	      {__construct(__has_construct<allocator_type, _Tp*, _Args...>(),
	       ^
  /usr/include/c++/v1/memory:1620:17: note: in instantiation of function template specialization 'std::__1::allocator_traits<std::__1::allocator<std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> > > >::construct<std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> >, const std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> > &>' requested here
		  construct(__a, _VSTD::__to_raw_pointer(__end2-1), _VSTD::move_if_noexcept(*--__end1));
		  ^
  /usr/include/c++/v1/vector:892:21: note: in instantiation of function template specialization 'std::__1::allocator_traits<std::__1::allocator<std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> > > >::__construct_backward<std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> > *>' requested here
      __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, this->__end_, __v.__begin_);
		      ^
  /usr/include/c++/v1/vector:1577:5: note: in instantiation of member function 'std::__1::vector<std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> >, std::__1::allocator<std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> > > >::__swap_out_circular_buffer' requested here
      __swap_out_circular_buffer(__v);
      ^
  /usr/include/c++/v1/vector:1614:9: note: in instantiation of function template specialization 'std::__1::vector<std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> >, std::__1::allocator<std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> > > >::__push_back_slow_path<std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> > >' requested here
	  __push_back_slow_path(_VSTD::move(__x));
	  ^
  ../../services/ui/ws/user_activity_monitor.cc:80:19: note: in instantiation of member function 'std::__1::vector<std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> >, std::__1::allocator<std::__1::pair<ui::ws::UserActivityMonitor::IdleObserverInfo, mojo::InterfacePtr<ui::mojom::UserIdleObserver> > > >::push_back' requested here
    idle_observers_.push_back(std::make_pair(info, std::move(observer)));
		    ^
  ../../mojo/public/cpp/bindings/interface_ptr.h:214:28: note: 'InterfacePtr' has been explicitly marked deleted here
    DISALLOW_COPY_AND_ASSIGN(InterfacePtr);
			     ^
Comment 5 clutton 2016-11-21 13:24:20 UTC
(In reply to Jan Beich (mail not working) from comment #4)

Ok, nice to hear that we don't need LIBCPP_TRIVIAL_PAIR_COPY_CTOR with ports' libc++

I guess you wouldn't mine if I'll implement this in 54, would you?
Comment 6 clutton 2016-11-28 06:47:08 UTC
(In reply to clutton from comment #5)

It seems I've forgoten to reply, devel/libc++ is too old for chromium 54.
It can't be used.
Comment 7 clutton 2016-11-28 06:48:55 UTC
The bug can be closed.

libc++ wasn't updated for too long, and chromium needs newer implementation.
Comment 8 Jan Beich freebsd_committer 2016-11-28 09:10:44 UTC
Dimitry, do you plan to make _LIBCPP_TRIVIAL_PAIR_COPY_CTOR behavior default in 12.0 following devel/libc++ and OS X ? This issue is likely to haunt chromium@ on updates even if someone comes up with a fix.

(In reply to clutton from comment #7)
> libc++ wasn't updated for too long

devel/libc++ is locked down by ABI of the oldest supported FreeBSD release with libc++ by default. Another reason is compatibility with lang/gcc. If chromium 54.* builds fine on 10.3 then the fix may be available in a month, once 10.1 and 10.2 reach EOL.
Comment 9 clutton 2016-11-28 12:21:33 UTC
(In reply to Jan Beich (mail not working) from comment #8)

Yes, it builds fine on 10.3 and 10.2, but fails on 10.1
Comment 10 Dimitry Andric freebsd_committer 2016-11-28 20:29:23 UTC
(In reply to clutton from comment #9)
> (In reply to Jan Beich (mail not working) from comment #8)
> 
> Yes, it builds fine on 10.3 and 10.2, but fails on 10.1

Hm, you could also use _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead, as it indicates.  But this would only work on new enough versions of FreeBSD, so you'd have to check __FreeBSD_version.
Comment 11 Rene Ladan freebsd_committer 2016-11-28 20:32:42 UTC
Hi Dimitry,

do you know which versions of FreeBSD are new enough?
Comment 12 Jan Beich freebsd_committer 2016-11-28 20:57:57 UTC
(In reply to Dimitry Andric from comment #10)
> could also use _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead

That macro has inverse logic. And -U won't cancel regular #define.
Comment 13 Dimitry Andric freebsd_committer 2016-11-29 07:59:50 UTC
(In reply to Rene Ladan from comment #11)
> do you know which versions of FreeBSD are new enough?

I imported libc++ 3.9.0 together with clang 3.9.0, and __FreeBSD_version was then bumped to 1200017.

(In reply to Jan Beich (mail not working) from comment #12)
> (In reply to Dimitry Andric from comment #10)
> > could also use _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead
> 
> That macro has inverse logic. And -U won't cancel regular #define.

Hm, I see that now, it's rather unfortunate.  I will check with upstream if we can make this configurable using =0 and =1 instead.
Comment 14 Dimitry Andric freebsd_committer 2016-12-04 14:52:51 UTC
Created attachment 177658 [details]
Use different method to enable trivial pair copy constructors for newer libc++

Here is a patch proposal that enables the trivial std::pair copy constructors for newer libc++, in a different way, namely defining _LIBCPP_ABI_UNSTABLE instead.  This was a suggestion from upstream.

Unfortunately we've patched up one of the BUILD.gn files to accomplish this, so I have now split this up in two separate EXTRA_PATCHES files.  If there is a nicer and cleaner way to do this, I'm all ears.

With this, chromium builds and runs just fine for me on head r309213 with clang and libc++ 3.9.0, under light testing.
Comment 15 clutton 2016-12-04 16:07:16 UTC
(In reply to Dimitry Andric from comment #14)

Unless devel/libc++ would be of llvm39 version this is the way to go.
Comment 16 Carlos J. Puga Medina freebsd_committer 2016-12-12 13:21:26 UTC
(In reply to Dimitry Andric from comment #14)

Using your patch, chromium builds fine on HEAD. Tested for amd64 and i386 archs.
Comment 17 clutton 2016-12-13 02:37:54 UTC
(In reply to Carlos J. Puga Medina from comment #16)

Carlos, could you apply the patch asap? The build is broken without it now.
Comment 18 Cy Schubert freebsd_committer 2016-12-14 13:50:26 UTC
The patch resolves the build failures under amd64 and i386.
Comment 19 Carlos J. Puga Medina freebsd_committer 2016-12-17 16:47:26 UTC
(In reply to clutton from comment #17)

I will keep the patch on hold until the next chromium update to 55.

chromium update to 55.0.2883.87 is coming.
Comment 20 Jonathan Chen 2017-01-11 02:45:42 UTC
Could you please add the patch onto chromium-54.0?
There is no visibility for when the update to chromium-55 will occur.
Comment 21 Lars Engels freebsd_committer 2017-01-11 09:13:31 UTC
Yes, please. For weeks I am forced to use Firefox on HEAD and it's a royal PITA.
Comment 22 commit-hook freebsd_committer 2017-01-11 10:27:23 UTC
A commit references this bug:

Author: cpm
Date: Wed Jan 11 10:26:34 UTC 2017
New revision: 431170
URL: https://svnweb.freebsd.org/changeset/ports/431170

Log:
  - Fix build on HEAD

  In file included from ../../services/ui/ws/window_manager_state.cc:5:
  In file included from ../../services/ui/ws/window_manager_state.h:10:
  In file included from /usr/include/c++/v1/memory:599:
  /usr/include/c++/v1/__config:58:2: error: "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported.     use _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead
  #error "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported. \
   ^
  1 error generated.

  PR:		214654
  Submitted by:	dim
  Reported by:	jbeich
  Reviewed by:	rene
  Approved by:	chromium (rene)
  MFH:		2017Q1

Changes:
  head/www/chromium/Makefile
  head/www/chromium/files/extra-patch-libc++-new
  head/www/chromium/files/extra-patch-libc++-old
Comment 23 commit-hook freebsd_committer 2017-01-11 15:05:08 UTC
A commit references this bug:

Author: cpm
Date: Wed Jan 11 15:04:03 UTC 2017
New revision: 431185
URL: https://svnweb.freebsd.org/changeset/ports/431185

Log:
  MFH: r431170

  - Fix build on HEAD

  In file included from ../../services/ui/ws/window_manager_state.cc:5:
  In file included from ../../services/ui/ws/window_manager_state.h:10:
  In file included from /usr/include/c++/v1/memory:599:
  /usr/include/c++/v1/__config:58:2: error: "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported.     use _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead
  #error "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported. \
   ^
  1 error generated.

  PR:		214654
  Submitted by:	dim
  Reported by:	jbeich
  Reviewed by:	rene
  Approved by:	chromium (rene)

  Approved by:	ports-secteam (feld)

Changes:
_U  branches/2017Q1/
  branches/2017Q1/www/chromium/Makefile
  branches/2017Q1/www/chromium/files/extra-patch-libc++-new
  branches/2017Q1/www/chromium/files/extra-patch-libc++-old
Comment 24 Carlos J. Puga Medina freebsd_committer 2017-01-11 15:12:39 UTC
Committed!

Thanks