Sunday, December 30, 2018

powerpc lang/gcc/6 can't build devel/llvm

loopy.cpp: In function 'int f(Thing)':
loopy.cpp:8:35: error: no match for call to '(std::_Mem_fn<int (Thing::*)() const>) (Thing&)'
return std::mem_fn(&Thing::get)(t);
^
In file included from loopy.cpp:1:0:
/usr/local/include/c++/6.5.0/functional:625:2: note: candidate: template<class _Tp> decltype (std::__invoke(((const std::_Mem_fn_base<_MemObjPtr, false>*)this)->std::_Mem_fn_base<_MemObjPtr, false>::_M_pm, forward<_Tp>(__obj))) std::_Mem_fn_base<_MemObjPtr, false>::operator()(_Tp&&) const [with _Tp = _Tp; _MemObjPtr = int (Thing::*)() const]
operator()(_Tp&& __obj) const
^~~~~~~~
/usr/local/include/c++/6.5.0/functional:625:2: note: template argument deduction/substitution failed:
/usr/local/include/c++/6.5.0/functional: In substitution of 'template<class _Tp> decltype (std::__invoke(((const std::_Mem_fn_base<_MemObjPtr, false>*)this)->std::_Mem_fn_base<_MemObjPtr, false>::_M_pm, forward<_Tp>(__obj))) std::_Mem_fn_base<_MemObjPtr, false>::operator()(_Tp&&) const [with _Tp = Thing&]':
loopy.cpp:8:35: required from here
/usr/local/include/c++/6.5.0/functional:627:27: error: no matching function for call to '__invoke(int (Thing::* const&)() const, Thing&)'
-> decltype(std::__invoke(_M_pm, std::forward<_Tp>(__obj)))
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/6.5.0/functional:245:5: note: candidate: template<class _Callable, class ... _Args> typename std::result_of<_Callable&&(_Args&& ...)>::type std::__invoke(_Callable&&, _Args&& ...)
__invoke(_Callable&& __fn, _Args&&... __args)
^~~~~~~~
/usr/local/include/c++/6.5.0/functional:245:5: note: template argument deduction/substitution failed:
/usr/local/include/c++/6.5.0/functional: In substitution of 'template<class _Callable, class ... _Args> typename std::result_of<_Callable&&(_Args&& ...)>::type std::__invoke(_Callable&&, _Args&& ...) [with _Callable = int (Thing::* const&)() const; _Args = {Thing&}]':
/usr/local/include/c++/6.5.0/functional:627:27: required by substitution of 'template<class _Tp> decltype (std::__invoke(((const std::_Mem_fn_base<_MemObjPtr, false>*)this)->std::_Mem_fn_base<_MemObjPtr, false>::_M_pm, forward<_Tp>(__obj))) std::_Mem_fn_base<_MemObjPtr, false>::operator()(_Tp&&) const [with _Tp = Thing&]'
loopy.cpp:8:35: required from here
/usr/local/include/c++/6.5.0/functional:245:5: error: no type named 'type' in 'class std::result_of<int (Thing::* const&(Thing&))() const>'
Index: infrastructure/mk/fortran.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/fortran.port.mk,v
retrieving revision 1.14
diff -u -p -u -r1.14 fortran.port.mk
--- infrastructure/mk/fortran.port.mk 2 Sep 2016 13:02:24 -0000 1.14
+++ infrastructure/mk/fortran.port.mk 30 Dec 2018 21:10:58 -0000
@@ -14,9 +14,9 @@ MODFORTRAN_WANTLIB += g2c
MODULES += gcc4
MODGCC4_ARCHS ?= *
MODGCC4_LANGS += fortran
-MODFORTRAN_BUILD_DEPENDS += lang/gcc/4.9,-f95>=4.9.4p0,<4.10
+MODFORTRAN_BUILD_DEPENDS += lang/gcc/6,-f95>=6,<7
MODFORTRAN_LIB_DEPENDS += ${MODGCC4_CPPLIBDEP}
-MODFORTRAN_WANTLIB += gfortran>=3
+MODFORTRAN_WANTLIB += gfortran>=7
. if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
MODFORTRAN_WANTLIB += quadmath
. endif
Index: infrastructure/mk/gcc4.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/gcc4.port.mk,v
retrieving revision 1.12
diff -u -p -u -r1.12 gcc4.port.mk
--- infrastructure/mk/gcc4.port.mk 8 Mar 2016 16:46:05 -0000 1.12
+++ infrastructure/mk/gcc4.port.mk 30 Dec 2018 21:10:58 -0000
@@ -1,2 +1,2 @@
-MODGCC4_VERSION?=4.9
+MODGCC4_VERSION?=6
.include "${PORTSDIR}/lang/gcc/${MODGCC4_VERSION}/gcc4.port.mk"
Index: lang/gcc/Makefile
===================================================================
RCS file: /cvs/ports/lang/gcc/Makefile,v
retrieving revision 1.15
diff -u -p -u -r1.15 Makefile
--- lang/gcc/Makefile 19 Oct 2018 09:19:40 -0000 1.15
+++ lang/gcc/Makefile 30 Dec 2018 21:10:58 -0000
@@ -1,6 +1,6 @@
# $OpenBSD: Makefile,v 1.15 2018/10/19 09:19:40 sthen Exp $

SUBDIR =
- SUBDIR += 4.9
+ SUBDIR += 6

.include <bsd.port.subdir.mk>
Hello OpenBSD ports list!

I want to report a problem with lang/gcc/6 on powerpc, where it can't
build devel/llvm. I have reproduced the problem in a small C++ file
that errors when the powerpc option -mlongcall is passed to eg++.

$ cat loopy.cpp
#include <functional>

struct Thing {
int get() const { return 0; }
};

int f(Thing t) {
return std::mem_fn(&Thing::get)(t);
}
$ eg++ --version
eg++ (GCC) 6.5.0
...
$ eg++ -mlongcall -c loopy.cpp
...
(see attached loopy-error.txt)

The error goes away if I do any _one_ of the following:
- remove -mlongcall
- remove const in `int get() const`
- change `std::mem_fn(&Thing::get)(t)` to `(t.*(&Thing::get))()`

The default ports-gcc is lang/gcc/4.9; I am using a diff (attached
as gcc-6-2.diff) to switch ports-gcc to lang/gcc/6. This diff was
from https://marc.info/?l=openbsd-ports&m=154165621429861&w=2 but
I removed the chunk that disables Ada.

I also edited devel/llvm/Makefile to change GCC_VER from 4.9.0 to
6.4.0; this was before I built gcc-6.5.0p0.

My OpenBSD/macppc kernel has the powerpc swap fix from Mark Kettenis
in https://marc.info/?l=openbsd-bugs&m=154559013731861&w=2 so programs
don't crash while I am building devel/llvm. With the swap fix,
lang/gcc/6 can build much of devel/llvm but can't build
LoopLoadElimination.cpp where that file uses std::mem_fn.

devel/llvm uses -mlongcall because its port Makefile adds -mlongcall
to CFLAGS and CXXFLAGS for powerpc. -mlongcall also seems to cause
a bunch of "warning: ignoring attributes on template argument '...'`.
(I guess that -mlongcall sets an attribute on everything, but some
template parameters ignore the attribute?) I got the error from
LoopLoadElimination.cpp with gcc-6.4.0; then I used loopy.cpp to
reproduce the error in both 6.4.0 and gcc-6.5.0p0.

--
George Koehler <kernigh@gmail.com>

No comments:

Post a Comment