NetBSD Problem Report #54501

From www@netbsd.org  Thu Aug 29 07:04: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 653777A14B
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 29 Aug 2019 07:04:10 +0000 (UTC)
Message-Id: <20190829070409.8012A7A1D7@mollari.NetBSD.org>
Date: Thu, 29 Aug 2019 07:04:09 +0000 (UTC)
From: clement.bouvier.europe@gmail.com
Reply-To: clement.bouvier.europe@gmail.com
To: gnats-bugs@NetBSD.org
Subject: devel/lua-bitlib broken on macOS patch
X-Send-Pr-Version: www-1.0

>Number:         54501
>Category:       pkg
>Synopsis:       devel/lua-bitlib broken on macOS patch
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    macos-pkg-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 29 07:05:00 +0000 2019
>Closed-Date:    Thu Sep 05 18:55:46 +0000 2019
>Last-Modified:  Thu Sep 05 18:55:46 +0000 2019
>Originator:     clement bouvier
>Release:        current
>Organization:
>Environment:
macosx mojave 10.14.6
>Description:
The linker does not recognize flags like -fPIC and -shared.

===> Building for lua51-bitlib-5.3.0
clang -O2 -pipe -I/Users/cbouvier/pkg/include/lua-5.1 -fPIC -c -I /Users/cbouvier/prj/pkgsrc/devel/lua-bitlib/work/lua-compat-5.2-bitlib-5.3.0/c-api /Users/cbouvier/prj/pkgsrc/devel/lua-bitlib/work/lua-compat-5.2-bitlib-5.3.0/lbitlib.c -o /Users/cbouvier/prj/pkgsrc/devel/lua-bitlib/work/lua-compat-5.2-bitlib-5.3.0/bit32.o
ld    -L/Users/cbouvier/pkg/lib -L/usr/lib -shared /Users/cbouvier/prj/pkgsrc/devel/lua-bitlib/work/lua-compat-5.2-bitlib-5.3.0/bit32.o -o /Users/cbouvier/prj/pkgsrc/devel/lua-bitlib/work/lua-compat-5.2-bitlib-5.3.0/bit32.so
ld: unknown option: -shared

===> Building for lua51-bitlib-5.3.0
clang -O2 -pipe -I/Users/cbouvier/pkg/include/lua-5.1 -fPIC -c -I /Users/cbouvier/prj/pkgsrc/devel/lua-bitlib/work/lua-compat-5.2-bitlib-5.3.0/c-api /Users/cbouvier/prj/pkgsrc/devel/lua-bitlib/work/lua-compat-5.2-bitlib-5.3.0/lbitlib.c -o /Users/cbouvier/prj/pkgsrc/devel/lua-bitlib/work/lua-compat-5.2-bitlib-5.3.0/bit32.o
ld    -L/Users/cbouvier/pkg/lib -L/usr/lib -fPIC -shared /Users/cbouvier/prj/pkgsrc/devel/lua-bitlib/work/lua-compat-5.2-bitlib-5.3.0/bit32.o -o /Users/cbouvier/prj/pkgsrc/devel/lua-bitlib/work/lua-compat-5.2-bitlib-5.3.0/bit32.so
ld: unknown option: -fPIC
>How-To-Repeat:
build the package
>Fix:
The following patch:

* Use libtool for compiling, linking and installing the package.
* Change ${LUA_CDIR}/bit32 into ${LUA_CDIR} (Maybe I am wrong but I don't understand why it is not LUA_CDIR directly).

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/devel/lua-bitlib/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- Makefile	20 Nov 2018 17:26:20 -0000	1.1
+++ Makefile	29 Aug 2019 07:02:16 -0000
@@ -16,17 +16,16 @@
 LUA_VERSIONS_ACCEPTED=	51

 NO_CONFIGURE=		yes
+USE_LIBTOOL=		yes

-INSTALLATION_DIRS+=	${LUA_CDIR}/bit32
-
-.include "../../lang/lua/module.mk"
+INSTALLATION_DIRS+=	${LUA_CDIR}

 do-build:
-	${CC} ${CFLAGS} -fPIC -c -I ${WRKSRC}/c-api ${WRKSRC}/lbitlib.c -o ${WRKSRC}/bit32.o
-	${LD} ${LDFLAGS} -fPIC -shared ${WRKSRC}/bit32.o -o ${WRKSRC}/bit32.so
+	${LIBTOOL} --tag=CC --mode=compile ${CC} ${CFLAGS} -fPIC -I ${WRKSRC}/c-api -c -o ${WRKSRC}/bit32.lo ${WRKSRC}/lbitlib.c
+	${LIBTOOL} --tag=CC --mode=link ${CC} ${LDFLAGS} -rpath ${PREFIX}/${LUA_CDIR} -shared -module -avoid-version -export-dynamic -o ${WRKSRC}/bit32.la ${WRKSRC}/bit32.lo

 do-install:
-	${INSTALL_SCRIPT} ${WRKSRC}/bit32.so \
-	                ${DESTDIR}${PREFIX}/${LUA_CDIR}
+	${LIBTOOL} --mode=install ${INSTALL_DATA} ${WRKSRC}/bit32.la ${DESTDIR}${PREFIX}/${LUA_CDIR}

+.include "../../lang/lua/module.mk"
 .include "../../mk/bsd.pkg.mk"
Index: PLIST
===================================================================
RCS file: /cvsroot/pkgsrc/devel/lua-bitlib/PLIST,v
retrieving revision 1.1
diff -u -r1.1 PLIST
--- PLIST	20 Nov 2018 17:26:20 -0000	1.1
+++ PLIST	29 Aug 2019 07:02:16 -0000
@@ -1,2 +1,2 @@
 @comment $NetBSD: PLIST,v 1.1 2018/11/20 17:26:20 maya Exp $
-${LUA_CDIR}/bit32.so
+${LUA_CDIR}/bit32.la

>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:17 +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/54501: devel/lua-bitlib broken on macOS patch
Date: Thu, 29 Aug 2019 20:28:39 +0100

 clement.bouvier.europe@gmail.com wrote:
 > >Number:         54501
 > >Category:       pkg
 > >Synopsis:       devel/lua-bitlib broken on macOS patch
 > >Confidential:   no
 > >Severity:       serious
 > >Priority:       medium
 > >Responsible:    pkg-manager
 > >State:          open
 > >Class:          sw-bug
 > >Submitter-Id:   net
 > >Arrival-Date:   Thu Aug 29 07:05:00 +0000 2019
 > >Originator:     clement bouvier
 > >Release:        current
 > >Organization:
 > >Environment:
 > macosx mojave 10.14.6
 > >Description:
 > The linker does not recognize flags like -fPIC and -shared.

 Can you try building it with LuaRocks? Our rocks package is a bit
 outdated but it may still work.

 If this package is buildable with rocks, we should consider adding
 rocks.mk integration to pkgsrc.

 -- 
 Alex

From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54501 CVS commit: pkgsrc/devel/lua-bitlib
Date: Thu, 5 Sep 2019 18:54:37 +0000

 Module Name:	pkgsrc
 Committed By:	maya
 Date:		Thu Sep  5 18:54:37 UTC 2019

 Modified Files:
 	pkgsrc/devel/lua-bitlib: Makefile PLIST

 Log Message:
 lua-bitlib: fix build on OS X by using libtool.

 it will use the portable variants of arguments for us.
 bump PKGREVISION.

 From clement bouvier in PR pkg/54501


 To generate a diff of this commit:
 cvs rdiff -u -r1.1 -r1.2 pkgsrc/devel/lua-bitlib/Makefile \
     pkgsrc/devel/lua-bitlib/PLIST

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Thu, 05 Sep 2019 18:55:46 +0000
State-Changed-Why:
sorry to butt in and commit the patch - a luarocks integration seems non-trivial and this is a build fix, it's best not to leave it hanging.
thanks for the patch!



>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.