NetBSD Problem Report #54500
From www@netbsd.org Thu Aug 29 05:38:10 2019
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 7E0837A19F
for <gnats-bugs@gnats.NetBSD.org>; Thu, 29 Aug 2019 05:38:10 +0000 (UTC)
Message-Id: <20190829053809.91AA67A1C4@mollari.NetBSD.org>
Date: Thu, 29 Aug 2019 05:38:09 +0000 (UTC)
From: clement.bouvier.europe@gmail.com
Reply-To: clement.bouvier.europe@gmail.com
To: gnats-bugs@NetBSD.org
Subject: devel/lua-Bitop broken on macOS patch
X-Send-Pr-Version: www-1.0
>Number: 54500
>Category: pkg
>Synopsis: devel/lua-Bitop broken on macOS patch
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: macos-pkg-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Aug 29 05:40:00 +0000 2019
>Last-Modified: Fri Aug 30 19:35:01 +0000 2019
>Originator: clement bouvier
>Release: current
>Organization:
>Environment:
macOS mojave 10.14.6
>Description:
===> Building for lua52-BitOp-1.0.2nb1
/Applications/Xcode.app/Contents/Developer/usr/bin/gnumake all "SOCC=MACOSX_DEPLOYMENT_TARGET=10.4 gcc -dynamiclib -single_module -undefined dynamic_lookup"
gcc -fPIC -O2 -fomit-frame-pointer -Wall -O2 -pipe -I/Users/cbouvier/pkg/include/lua-5.2 -c -o bit.o bit.c
MACOSX_DEPLOYMENT_TARGET=10.4 gcc -dynamiclib -single_module -undefined dynamic_lookup -fPIC -L/Users/cbouvier/pkg/lib -L/usr/lib -o bit.so bit.o
ld: library not found for -lgcc_s.10.4
>How-To-Repeat:
build the package
>Fix:
The target macosx provided claims MACOSX_DEPLOYMENT_TARGET=10.4 and uses gcc as compiler.
Recent version of macos cannot build the package, MACOSX_DEPLOYMENT_TARGET=10.4 is too old and native toolchain has moved to clang/LLVM.
The patch :
* Remove a make variable unused
* Use the common target to build under macosx (and remove the specific part in the pkg Makefile)
* Use libtool to build and link on the common target.
test Target are passed.
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/devel/lua-BitOp/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- Makefile 16 Sep 2017 19:53:50 -0000 1.6
+++ Makefile 29 Aug 2019 05:36:06 -0000
@@ -14,17 +14,11 @@
LUA_VERSIONS_INCOMPATIBLE= 53
NO_CONFIGURE= yes
+USE_LIBTOOL= yes
USE_TOOLS+= gmake
MAKE_FLAGS+= LUA_CDIR=${LUA_CDIR}
MAKE_FLAGS+= LUA_DOCDIR=${LUA_DOCDIR}
MAKE_FLAGS+= _LUA_DOT_VERSION=${_LUA_DOT_VERSION}
-MAKE_FLAGS+= INSTALLPATH=${DESTDIR}${PREFIX}/${LUA_CDIR}
-
-.include "../../mk/bsd.prefs.mk"
-
-.if ${OPSYS} == "Darwin"
-BUILD_TARGET= macosx
-.endif
INSTALLATION_DIRS+= ${LUA_CDIR} ${LUA_DOCDIR}
Index: PLIST
===================================================================
RCS file: /cvsroot/pkgsrc/devel/lua-BitOp/PLIST,v
retrieving revision 1.1
diff -u -r1.1 PLIST
--- PLIST 3 May 2014 13:02:38 -0000 1.1
+++ PLIST 29 Aug 2019 05:36:06 -0000
@@ -1,5 +1,5 @@
@comment $NetBSD: PLIST,v 1.1 2014/05/03 13:02:38 alnsn Exp $
-${LUA_CDIR}/bit.so
+${LUA_CDIR}/bit.la
${LUA_DOCDIR}/api.html
${LUA_DOCDIR}/bluequad-print.css
${LUA_DOCDIR}/bluequad.css
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/devel/lua-BitOp/distinfo,v
retrieving revision 1.4
diff -u -r1.4 distinfo
--- distinfo 20 Aug 2016 12:43:40 -0000 1.4
+++ distinfo 29 Aug 2019 05:36:06 -0000
@@ -4,4 +4,4 @@
RMD160 (LuaBitOp-1.0.2.tar.gz) = 6b5a44515022ed1f4edb9d966b8ea3aa9c38a892
SHA512 (LuaBitOp-1.0.2.tar.gz) = a652050ea5c6fbeb8a28b05e2bc4a3550c854cc45f7f42c8c1b0a81f5b76773cdf061e6a839cdb339614118169e578b6e3efa5a3efbe59a2f01874b2fa2b4f2e
Size (LuaBitOp-1.0.2.tar.gz) = 23127 bytes
-SHA1 (patch-Makefile) = 5b484bdbaa2cc94b1b73177f3eeb0a686f7e897d
+SHA1 (patch-Makefile) = 662f40d7b09d1f47a1f5976ecebd4bad7e960009
Index: patches/patch-Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/devel/lua-BitOp/patches/patch-Makefile,v
retrieving revision 1.3
diff -u -r1.3 patch-Makefile
--- patches/patch-Makefile 20 Aug 2016 12:43:40 -0000 1.3
+++ patches/patch-Makefile 29 Aug 2019 05:36:06 -0000
@@ -1,6 +1,7 @@
$NetBSD: patch-Makefile,v 1.3 2016/08/20 12:43:40 alnsn Exp $
Install tweaks.
+Use Libtool
--- Makefile.orig 2012-05-08 19:15:00.000000000 +0000
+++ Makefile
@@ -13,21 +14,32 @@
DEFINES=
# Use this for the old ARM ABI with swapped FPA doubles.
-@@ -11,7 +11,7 @@ DEFINES=
+@@ -11,9 +11,9 @@ DEFINES=
#DEFINES= -DSWAPPED_DOUBLE
# Lua executable name. Used to find the install path and for testing.
-LUA= lua
+LUA= lua${_LUA_DOT_VERSION}
- CC= gcc
+-CC= gcc
++#CC= gcc
CCOPT= -O2 -fomit-frame-pointer
-@@ -39,7 +39,8 @@ $(MODSO): $(MODNAME).o
- $(SOCC) $(SOLDFLAGS) -o $@ $<
+ CCWARN= -Wall
+ SOCC= $(CC) -shared
+@@ -33,13 +33,14 @@ macosx:
+ $(MAKE) all "SOCC=MACOSX_DEPLOYMENT_TARGET=10.4 $(CC) -dynamiclib -single_module -undefined dynamic_lookup"
+
+ $(MODNAME).o: $(MODNAME).c
+- $(CC) $(SOCFLAGS) -c -o $@ $<
++ ${LIBTOOL} --tag=CC --mode=compile $(CC) $(SOCFLAGS) -c -o ${@:.o=.lo} $<
+
+ $(MODSO): $(MODNAME).o
+- $(SOCC) $(SOLDFLAGS) -o $@ $<
++ ${LIBTOOL} --tag=CC --mode=link $(CC) $(SOLDFLAGS) -o ${@:.so=.la} ${<:.o=.lo} -rpath ${PREFIX}/${LUA_CDIR} -shared -module -avoid-version -export-dynamic
install: $(MODSO)
- $(INSTALL) $< `$(INSTALLPATH) $(MODNAME)`
-+ ${BSD_INSTALL_LIB} ${MODSO} ${DESTDIR}${PREFIX}/${LUA_CDIR}
++ ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} $(MODSO:.so=.la) ${DESTDIR}${PREFIX}/${LUA_CDIR}
+ cp -r doc/* ${DESTDIR}${PREFIX}/${LUA_DOCDIR}
test: $(MODSO)
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->macos-pkg-people
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Thu, 29 Aug 2019 07:12:04 +0000
Responsible-Changed-Why:
macOS problem
From: Alexander Nasonov <alnsn@yandex.ru>
To: gnats-bugs@netbsd.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/54500: devel/lua-Bitop broken on macOS patch
Date: Thu, 29 Aug 2019 21:56:51 +0100
clement.bouvier.europe@gmail.com wrote:
> -${LUA_CDIR}/bit.so
> +${LUA_CDIR}/bit.la
We only want bit.so installed because it isn't a library but a Lua
module.
--
Alex
From: =?utf-8?Q?cl=C3=A9ment_bouvier?= <clement.bouvier.europe@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/54500: devel/lua-Bitop broken on macOS patch
Date: Fri, 30 Aug 2019 20:45:43 +0400
Hi Alexander,
> clement.bouvier.europe@gmail.com wrote:
>> -${LUA_CDIR}/bit.so
>> +${LUA_CDIR}/bit.la
>=20
> We only want bit.so installed because it isn't a library but a Lua
> module.
I think I don't understand your comment ; maybe something would escape =
me...
Yes and libtool directive inside the rule to build the module is =
building a Lua module (Intrinsically lua use dlopen, dlsym to load a C =
module, doesn't it?) and not a library.
(-shared -module -void-version -export-dynamic libtool flags)
${LIBTOOL} --tag=3DCC --mode=3Dlink $(CC) $(SOLDFLAGS) -o ${@:.so=3D.la} =
${<:.o=3D.lo} -rpath ${PREFIX}/${LUA_CDIR} -shared -module =
-avoid-version -export-dynamic
The binary object is BUNDLE type meaning in apple language (Mach-O =
specification) a plugin loading at runtime (Sorry for the macos example =
but I have only that under my hand currently ; but I can check with the =
ELF format).
If it was a library shared, the filetype would be DYLIB.
$otool -hv ~/pkg/lib/lua/5.2/bit.so
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds =
flags
MH_MAGIC_64 X86_64 ALL 0x00 BUNDLE 12 1408 =
NOUNDEFS DYLDLINK TWOLEVEL
vs (with neettle library)
$otool -hv ~/pkg/lib/libnettle.dylib
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds =
flags
MH_MAGIC_64 X86_64 ALL 0x00 DYLIB 13 1400 =
NOUNDEFS DYLDLINK TWOLEVEL NO_REEXPORTED_DYLIBS
The pkgsrc developper guide recommends to use *.la in the PLIST if you =
migrate the package to libtool.
https://www.netbsd.org/docs/pkgsrc/fixes.html#fixes.configure
In 21.3.1. Shared libraries - libtool:
4: When linking shared object (.so) files, i.e. files that are loaded =
via dlopen(3), NOT shared libraries, use =E2=80=9C-module =
-avoid-version=E2=80=9D to prevent them getting version tacked on.
The PLIST file gets the foo.so entry.
7: In your PLIST, include only the .la file (this is a change from =
previous behaviour).
The documentation could be ambiguous ("the PLIST file gets the foo.so =
entry" and the rule 7).
Moreover if only *.so is added, then you obtain an error at install:
=3D> Checking file-check results for lua52-BitOp-1.0.2nb1
ERROR: ************************************************************
ERROR: The following files are in =
/Users/cbouvier/prj/pkgsrc/devel/lua-BitOp/work/.destdir/Users/cbouvier/pk=
g but not in the PLIST:
ERROR: =
/Users/cbouvier/prj/pkgsrc/devel/lua-BitOp/work/.destdir/Users/cbouvier/pk=
g/lib/lua/5.2/bit.la
Yes pkgsrc is installing a text libtool archive (.la) with the module =
(plugin) .so but not any static or dynamic library.
You may know something that I don't know about pkgsrc ; Any pointer if =
it is the case?
Clement.
From: Alexander Nasonov <alnsn@yandex.ru>
To: gnats-bugs@netbsd.org
Cc: macos-pkg-people@netbsd.org, gnats-admin@netbsd.org,
pkgsrc-bugs@netbsd.org, clement.bouvier.europe@gmail.com
Subject: Re: pkg/54500: devel/lua-Bitop broken on macOS patch
Date: Fri, 30 Aug 2019 20:30:19 +0100
cl?ment bouvier wrote:
> The following reply was made to PR pkg/54500; it has been noted by GNATS.
>
> From: =?utf-8?Q?cl=C3=A9ment_bouvier?= <clement.bouvier.europe@gmail.com>
> To: gnats-bugs@netbsd.org
> Cc:
> Subject: Re: pkg/54500: devel/lua-Bitop broken on macOS patch
> Date: Fri, 30 Aug 2019 20:45:43 +0400
>
> Hi Alexander,
>
> > clement.bouvier.europe@gmail.com wrote:
> >> -${LUA_CDIR}/bit.so
> >> +${LUA_CDIR}/bit.la
> >=20
> > We only want bit.so installed because it isn't a library but a Lua
> > module.
>
> I think I don't understand your comment ; maybe something would escape =
> me...
LUA_CDIR is a directory for Lua modules and it would be confusing
to see .la and .a files in there.
--
Alex
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.