Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Jan 2013 08:18:05 GMT
From:      "Matthew X. Economou" <xenophon+freebsd@irtnog.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/174964: lang/lua should link liblua against libm
Message-ID:  <201301040818.r048I5nX023701@red.freebsd.org>
Resent-Message-ID: <201301040820.r048K0rw015280@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         174964
>Category:       ports
>Synopsis:       lang/lua should link liblua against libm
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 04 08:20:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Matthew X. Economou
>Release:        9.0-RELEASE
>Organization:
IRTNOG
>Environment:
FreeBSD cinep001bsdgw.irtnog.net 9.0-RELEASE-p4 FreeBSD 9.0-RELEASE-p4 #10 r242510M: Sat Nov  3 15:07:27 EDT 2012     root@cinep001bsdgw.irtnog.net:/usr/obj/usr/src/sys/FIREWALL  amd64

>Description:
Ports configured to use Lua (e.g., Wireshark) will throw an error during "make config" about being unable to link against liblua.  Upon review of the port's "config.log" file, one will see linker error messages similar to the following:

configure:25468: checking for luaL_register in -llua
configure:25493: cc -o conftest -O2 -pipe -funit-at-a-time -fno-strict-aliasing -Wall -W -Wextra -Wdeclaration-after-statement -Wendif-labels -Wpointer-arith -Wno-pointer-sign -Wcast-align -Wformat-security -Wold-style-definition -I/usr/local/include/gtk-2.0 -I/usr/local/include/gio-unix-2.0/ -I/usr/local/include/atk-1.0 -I/usr/local/include/cairo -I/usr/local/include/pixman-1 -I/usr/local/include/drm -D_THREAD_SAFE -I/usr/local/include/gdk-pixbuf-2.0 -I/usr/local/include/libpng15 -I/usr/local/include/pango-1.0 -D_REENTRANT -I/usr/local/include/glib-2.0 -I/usr/local/include/freetype2 -I/usr/local/include   -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -DGSEAL_ENABLE -DGTK_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES -D_FORTIFY_SOURCE=2 -D_U_="__attribute__((unused))"  -I/usr/local/include -I/usr/local/include -I/usr/include/pcap -I/usr/local/include/lua51  -L/usr/local/lib -Wl,-rpath=/usr/local/lib -Wl,--as-needed -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib conftest.c
  -llua  -lz  -pthread -pthread -L/usr/local/lib/lua51 -llua -lm  -lm >&5
conftest.c: In function 'main':
conftest.c:65: warning: old-style function definition
/usr/local/lib/lua51/liblua.so: undefined reference to `floor'
/usr/local/lib/lua51/liblua.so: undefined reference to `ceil'
/usr/local/lib/lua51/liblua.so: undefined reference to `cosh'
/usr/local/lib/lua51/liblua.so: undefined reference to `tan'
/usr/local/lib/lua51/liblua.so: undefined reference to `tanh'
/usr/local/lib/lua51/liblua.so: undefined reference to `asin'
/usr/local/lib/lua51/liblua.so: undefined reference to `log'
/usr/local/lib/lua51/liblua.so: undefined reference to `atan'
/usr/local/lib/lua51/liblua.so: undefined reference to `sinh'
/usr/local/lib/lua51/liblua.so: undefined reference to `fmod'
/usr/local/lib/lua51/liblua.so: undefined reference to `acos'
/usr/local/lib/lua51/liblua.so: undefined reference to `exp'
/usr/local/lib/lua51/liblua.so: undefined reference to `sin'
/usr/local/lib/lua51/liblua.so: undefined reference to `pow'
/usr/local/lib/lua51/liblua.so: undefined reference to `atan2'
/usr/local/lib/lua51/liblua.so: undefined reference to `cos'
/usr/local/lib/lua51/liblua.so: undefined reference to `log10'

This happens even though the configuration test program is being linked against libm (as shown in the arguments to the "cc" command above).  Liblua itself is not linked against libm, only libc:

cinep001bsdgw# ldd /usr/local/lib/lua51/liblua-5.1.so.1
lua51/liblua-5.1.so.1:
        libc.so.7 => /lib/libc.so.7 (0x80084a000)

>How-To-Repeat:
cd /usr/ports/lang/lua; make install
mkdir -p /var/db/ports/wireshark
echo "OPTIONS_FILE_SET+=LUA" > /var/db/ports/wireshark/options
cd /usr/ports/net/wireshark; make config BATCH=yes

>Fix:
Force the lang/lua port to link against libm by setting LDFLAGS.  For example:

portmaster -m LDFLAGS="-lm" lang/lua


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301040818.r048I5nX023701>