Wednesday, January 02, 2019

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

On Wed, Jan 02 2019, George Koehler <kernigh@gmail.com> wrote:
> On Mon, 31 Dec 2018 14:26:10 +0100
> Jeremie Courreges-Anglas <jca@wxcvbn.org> wrote:
>
>> If you remove CFLAGS/CXXFLAGS = -mlongcall and restart the build from
>> scratch, are clang and friends properly linked? Do you get a working
>> llvm package?
>
> This actually worked! I cleaned the build, removed the -mlongcall,
> and built llvm with gcc 6.5.0. The build of llvm took about 28 hours
> 40 minutes with my PowerBook G4 at half speed = 666 MHz. (gcc had
> taken about 28 h 30 m.) The removal of -mlongcall also removed most
> or all compiler warnings from the log. The build succeeded. I can
> now use clang++ to compile and run a simple C++ program.

Cool. Now if someone with a powerpc box could also try building llvm
with gcc-4.9 and the diff below, that would be great. (REVISION bump
not included.)

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/llvm/Makefile,v
retrieving revision 1.202
diff -u -p -r1.202 Makefile
--- Makefile 15 Dec 2018 15:21:48 -0000 1.202
+++ Makefile 2 Jan 2019 16:51:19 -0000
@@ -83,8 +83,6 @@ CONFIGURE_ARGS = -DLLVM_ENABLE_FFI:Bool=

# Workaround relocation overflow
.if ${MACHINE_ARCH} == "powerpc"
-CFLAGS += -mlongcall
-CXXFLAGS += -mlongcall
# As a workaround for the size only build the PowerPC backend
CONFIGURE_ARGS += -DLLVM_TARGETS_TO_BUILD="PowerPC"
.elif ${MACHINE_ARCH} == "arm"


> I used the below diff in devel/llvm/Makefile. I also used
> gcc-6-2.diff from my earlier mail to switch ports-gcc to lang/gcc/6.
>
> (Pascal Stumpf recently posted lang/gcc/8, but I'm keeping 6.5.0 for
> now because I want to try building other packages.)
>
> Now that I can run clang++, I can show the dependency problem from
> my mail "Re: powerpc bulk build report" to ports [1]:
>
> ghostborough$ cat loopy.cpp
> #include <functional>
>
> struct Thing {
> int get() const { return 0; }
> };
>
> int f(Thing t) {
> return std::mem_fn(&Thing::get)(t);
> }
> ghostborough$ clang++ -c loopy.cpp
> ghostborough$ doas pkg_delete g++
> doas (kernigh@ghostborough.my.domain) password:
> g++-6.5.0p0: ok
> Read shared items: ok
> ghostborough$ clang++ -c loopy.cpp
> loopy.cpp:8:14: error: no member named 'mem_fn' in namespace 'std'
> return std::mem_fn(&Thing::get)(t);
> ~~~~~^
> 1 error generated.
>
> clang++ in the llvm package uses the headers from the g++ package,
> but llvm has no dependency on g++. After I pkg_delete g++, then
> clang++ seems to find the old headers from base-gcc, but those
> headers don't have C++11 features like std::mem_fn.

Noted, I'll take a look.

> [1] https://marc.info/?l=openbsd-ports&m=154629731512667&w=2
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/llvm/Makefile,v
> retrieving revision 1.202
> diff -u -p -r1.202 Makefile
> --- Makefile 15 Dec 2018 15:21:48 -0000 1.202
> +++ Makefile 31 Dec 2018 19:26:26 -0000
> @@ -83,8 +83,8 @@ CONFIGURE_ARGS = -DLLVM_ENABLE_FFI:Bool=
>
> # Workaround relocation overflow
> .if ${MACHINE_ARCH} == "powerpc"
> -CFLAGS += -mlongcall
> -CXXFLAGS += -mlongcall
> +#CFLAGS += -mlongcall
> +#CXXFLAGS += -mlongcall
> # As a workaround for the size only build the PowerPC backend
> CONFIGURE_ARGS += -DLLVM_TARGETS_TO_BUILD="PowerPC"
> .elif ${MACHINE_ARCH} == "arm"
> @@ -101,7 +101,7 @@ PKG_ARGS += -Dpowerpc=0
> TEST_TARGET = check
>
> # XXX sync
> -GCC_VER = 4.9.4
> +GCC_VER = 6.5.0
> .if ${MACHINE_ARCH} == "amd64"
> GCC_CONFIG = x86_64-unknown-openbsd${OSREV}
> .else

--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE

No comments:

Post a Comment