Opened 2 years ago

Closed 2 years ago

#64853 closed defect (fixed)

luajit: blacklist gcc <4.3, remove ppc64, add a patch

Reported by: barracuda156 Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: powerpc, leopard, ppc64, haspatch Cc:
Port: luajit

Description

When trying to build luajit on 10.5.8 default gcc-4.2 compiler is chosen, but it is not supported:

lj_arch.h:453:2: error: #error "Need at least GCC 4.3 or newer"

Specifying a newer compiler, build for ppc64 fails:

lj_arch.h:313:2: error: #error "No support for PPC64"
 #error "No support for PPC64"
  ^~~~~
make[2]: Entering directory `/opt/local/var/macports/build/_opt_PPCLeopardPorts_lang_luajit/luajit/work/LuaJIT-LuaJIT-b4b2dce/src'
HOSTCC    host/minilua.o
/opt/local/bin/gcc-mp-7  -O2 -fomit-frame-pointer -Wall  -I/opt/local/include -Os -arch ppc64 -DLUAJIT_ENABLE_LUA52COMPAT -I. -DLJ_ARCH_ENDIAN=LUAJIT_BE -DLUAJIT_TARGET=LUAJIT_ARCH_ppc -DLJ_ARCH_HASFPU=1 -DLJ_ABI_SOFTFP=0  -c -o host/minilua.o host/minilua.c
HOSTCC    host/buildvm_asm.o
/opt/local/bin/gcc-mp-7  -O2 -fomit-frame-pointer -Wall  -I/opt/local/include -Os -arch ppc64 -DLUAJIT_ENABLE_LUA52COMPAT -I. -DLJ_ARCH_ENDIAN=LUAJIT_BE -DLUAJIT_TARGET=LUAJIT_ARCH_ppc -DLJ_ARCH_HASFPU=1 -DLJ_ABI_SOFTFP=0  -c -o host/buildvm_asm.o host/buildvm_asm.c
HOSTCC    host/buildvm_peobj.o
HOSTCC    host/buildvm_lib.o
/opt/local/bin/gcc-mp-7  -O2 -fomit-frame-pointer -Wall  -I/opt/local/include -Os -arch ppc64 -DLUAJIT_ENABLE_LUA52COMPAT -I. -DLJ_ARCH_ENDIAN=LUAJIT_BE -DLUAJIT_TARGET=LUAJIT_ARCH_ppc -DLJ_ARCH_HASFPU=1 -DLJ_ABI_SOFTFP=0  -c -o host/buildvm_lib.o host/buildvm_lib.c
/opt/local/bin/gcc-mp-7  -O2 -fomit-frame-pointer -Wall  -I/opt/local/include -Os -arch ppc64 -DLUAJIT_ENABLE_LUA52COMPAT -I. -DLJ_ARCH_ENDIAN=LUAJIT_BE -DLUAJIT_TARGET=LUAJIT_ARCH_ppc -DLJ_ARCH_HASFPU=1 -DLJ_ABI_SOFTFP=0  -c -o host/buildvm_peobj.o host/buildvm_peobj.c
In file included from host/buildvm.h:16:0,
                 from host/buildvm_asm.c:6:
./lj_arch.h:313:2: error: #error "No support for PPC64"
 #error "No support for PPC64"
  ^~~~~
In file included from host/buildvm.h:16:0,
                 from host/buildvm_peobj.c:9:
./lj_arch.h:313:2: error: #error "No support for PPC64"
 #error "No support for PPC64"
  ^~~~~
In file included from host/buildvm.h:16:0,
                 from host/buildvm_lib.c:6:
./lj_arch.h:313:2: error: #error "No support for PPC64"
 #error "No support for PPC64"
  ^~~~~
make[2]: *** [host/buildvm_peobj.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [host/buildvm_asm.o] Error 1
make[2]: *** [host/buildvm_lib.o] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCLeopardPorts_lang_luajit/luajit/work/LuaJIT-LuaJIT-b4b2dce/src'
make[1]: *** [amalg] Error 2

There is also a patch to be added for it to build for ppc: https://www.freelists.org/post/luajit/LuaJIT-on-OS-X-Leopard-PowerPC,3

--- src/host/buildvm.c.orig	2021-10-28 03:56:07.000000000 +0800
+++ src/host/buildvm.c	2022-03-20 01:06:32.000000000 +0800
@@ -113,7 +113,7 @@
       name[0] = name[1] == 'R' ? '_' : '@';  /* Just for _RtlUnwind@16. */
     else
       *p = '\0';
-#elif LJ_TARGET_PPC && !LJ_TARGET_CONSOLE
+#elif LJ_TARGET_PPC && !LJ_TARGET_CONSOLE && !LJ_TARGET_OSX
     /* Keep @plt etc. */
 #else
     *p = '\0';

After that it installs:

36-85:~ svacchanda$ port -v installed luajit
The following ports are currently installed:
  luajit @2.1.0-beta3_5 (active) requested_variants='' platform='darwin 9' archs='ppc' date='2022-03-20T02:25:28+0800'

It also works for 10.6 PPC with the same corrections and patch.

Change History (4)

comment:1 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch added
Owner: set to ryandesign
Status: newaccepted

Thanks.

comment:2 in reply to:  1 Changed 2 years ago by barracuda156

Replying to ryandesign:

Thanks.

Welcome. Besides, I noticed gegl portfile removes luajit support for ppc, if may be unnecessary now, at least for Leopard. (I am not sure gegl builds for ppc as such, initial attempt failed, but for unrelated reason.)

comment:3 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

We can leave that for another ticket. You can read comments in https://github.com/macports/macports-ports/pull/3776 to see why gegl states PowerPC doesn't work.

comment:4 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: acceptedclosed

In 8d0c37228c84665a2d27bec269a882c49e50f25a/macports-ports (master):

luajit: Fix PowerPC build

Blacklist gcc-4.2 which the build system says is incompatible and add a
patch to fix build failure.

Closes: #64853

Note: See TracTickets for help on using tickets.