NetBSD Problem Report #49377

From www@NetBSD.org  Sat Nov  8 19:13:53 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 01FE7A663B
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  8 Nov 2014 19:13:53 +0000 (UTC)
Message-Id: <20141108191351.B5924A665C@mollari.NetBSD.org>
Date: Sat,  8 Nov 2014 19:13:51 +0000 (UTC)
From: jonthn+pkgsrc@pinacea.com
Reply-To: jonthn+pkgsrc@pinacea.com
To: gnats-bugs@NetBSD.org
Subject: Fix build lua-lpeg on OSX
X-Send-Pr-Version: www-1.0

>Number:         49377
>Category:       pkg
>Synopsis:       Fix build lua-lpeg on OSX
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 08 19:15:00 +0000 2014
>Closed-Date:    Sat Nov 08 20:12:52 +0000 2014
>Last-Modified:  Sat Nov 08 20:12:52 +0000 2014
>Originator:     Jonathan Buschmann
>Release:        CURRENT / 2014Q3
>Organization:
>Environment:
>Description:
The package devel/lua-lpeg doesn't build on OSX

Currently you get something like :


types  -O2 -ansi -I/usr/include/lua5.1/ -fPIC -I/Volumes/adiunxi/jonthn/.pkgs/include/lua-5.2 -I/usr/include  -c -o lpprint.o lpprint.c
env gcc -shared -fPIC lpvm.o lpcap.o lptree.o lpcode.o lpprint.o -o lpeg.so
Undefined symbols for architecture x86_64:
  "_luaL_addlstring", referenced from:
      _stringcap in lpcap.o
      _substcap in lpcap.o
  "_luaL_addvalue", referenced from:
      _addonestring in lpcap.o
  "_luaL_argerror", referenced from:
      _lp_behind in lptree.o
      _lp_V in lptree.o
      _lp_argcapture in lptree.o
      _lp_range in lptree.o
      _getpatt in lptree.o
      _lp_divcapture in lptree.o
  "_luaL_buffinit", referenced from:
      _pushcapture in lpcap.o
  "_luaL_checkany", reference
    ......


The diff below fix the problem. Not sure if there is a more clean/correct way to fix but using the test.lua it seems work for me.
>How-To-Repeat:

>Fix:
diff --git a/devel/lua-lpeg/Makefile b/devel/lua-lpeg/Makefile
index 92dcd69..dc78718 100644
--- a/devel/lua-lpeg/Makefile
+++ b/devel/lua-lpeg/Makefile
@@ -15,9 +15,15 @@ LICENSE=	mit
 NO_CONFIGURE=	yes
 USE_TOOLS+=	gmake
 MAKE_FILE=	makefile
-BUILD_TARGET=	linux
 TEST_TARGET=	test

+.include "../../mk/bsd.prefs.mk"
+.if ${OPSYS} == "Darwin"
+BUILD_TARGET=	macosx
+.else
+BUILD_TARGET=	linux
+.endif
+
 REPLACE_LUA+=	test.lua

 INSTALLATION_DIRS+=	${LUA_CDIR} ${LUA_LDIR} ${LUA_DOCDIR}

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: alnsn@NetBSD.org
State-Changed-When: Sat, 08 Nov 2014 20:12:52 +0000
State-Changed-Why:
Patch (slightly modified) is applied. With thanks to Jonathan Buschmann.


>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.