Bug 236332 - [net/wireshark] Wireshark 3.0.0 build with lua fails
Summary: [net/wireshark] Wireshark 3.0.0 build with lua fails
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Joe Marcus Clarke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-06 18:17 UTC by Stephen Wall
Modified: 2019-03-14 12:19 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (marcus)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen Wall 2019-03-06 18:17:22 UTC
The %%LUA%% tag in the pkg-plist is not being handled.

```
===>  Building package for wireshark-3.0.0
pkg-static: Unable to access file /wrkdirs/usr/ports/net/wireshark/work/stage/usr/local/share/wireshark/console.lua:No such file or directory
pkg-static: Unable to access file /wrkdirs/usr/ports/net/wireshark/work/stage/usr/local/share/wireshark/dtd_gen.lua:No such file or directory
pkg-static: Unable to access file /wrkdirs/usr/ports/net/wireshark/work/stage/usr/local/share/wireshark/init.lua:No such file or directory
*** Error code 1
```

Need to add `LUA` to `PLIST_SUB`.


```
Index: Makefile
===================================================================
--- Makefile    (revision 50774)
+++ Makefile    (working copy)
@@ -154,6 +154,12 @@
 PLIST_SUB+=    GUI=""
 .endif

+.if empty(PORT_OPTIONS:MLUA)
+PLIST_SUB+=    LUA="@comment "
+.else
+PLIST_SUB+=    LUA=""
+.endif
+
 .if !defined(LITE)
 .if ${PORT_OPTIONS:MANDROIDDUMP}
 PLIST_SUB+=    ANDROIDDUMP_LIB="" \
```
Comment 1 Martin MATO 2019-03-07 07:31:00 UTC
It fails to compile even with lua installed.

I have this message:

ld: error: unable to find library -llua-5.2
cc: error: linker command failed with exit code 1 (use -v to see invocation)
[1929/2322] cd /usr/ports/net/wireshark/work/.build/ui/qt && /usr/local/bin/cmake -E cmake_autogen /usr/ports/net/wireshark/work/.build/ui/qt/CMakeFiles/qtui_autogen.dir/AutogenInfo.cmake Release
ninja: build stopped: subcommand failed.
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1


i really don't understand why because lua 5.2 is installed
pkg info -Ix lua
lua52-5.2.4                    Small, compilable scripting language providing easy access to C code
lua52-lgi-0.9.2                Lua bindings to libraries using GObject-Introspection

i tried reinstalling lua5.2 but got the same results.
other packages depending on this seems not affected though.


uname -a
FreeBSD ninjaaaa.humanidyne.net 13.0-CURRENT FreeBSD 13.0-CURRENT r342811 NINJA  amd64

hope this helps.
Comment 2 Stephen Wall 2019-03-07 13:54:30 UTC
I also had to add 

LDFLAGS+=       -L/usr/local/lib

to the Makefile.  Martin, give that a try, I'd wager it gets you going.
Comment 3 Martin MATO 2019-03-07 16:05:11 UTC
It's almost does the trick,compiling flawlessly.
But when:

make install
===>  Installing for wireshark-3.0.0
===>  Checking if wireshark is already installed
===>   Registering installation for wireshark-3.0.0
pkg-static: Unable to access file /usr/ports/net/wireshark/work/stage/usr/local/share/wireshark/console.lua:No such file or directory
pkg-static: Unable to access file /usr/ports/net/wireshark/work/stage/usr/local/share/wireshark/dtd_gen.lua:No such file or directory
pkg-static: Unable to access file /usr/ports/net/wireshark/work/stage/usr/local/share/wireshark/init.lua:No such file or directory
*** Error code 74

Stop.
make[1]: stopped in /usr/ports/net/wireshark
*** Error code 1

Stop.
make: stopped in /usr/ports/net/wireshark
Comment 4 Stephen Wall 2019-03-08 18:33:22 UTC
It appears I've made an error - the failures I saw were when running poudriere, which I now believe was using a different config that included LUA, even though I had done a `make config` and turned LUA off.  So the problem I saw is the same as Martin's - the three lua files are not being staged when LUA is enabled.
Comment 5 VVD 2019-03-08 22:14:01 UTC
(In reply to Stephen Wall from comment #2)
> LDFLAGS+=       -L/usr/local/lib

--- net/wireshark.orig/Makefile
+++ net/wireshark/Makefile
@@ -83,6 +83,7 @@
 GUI_USE=       qt=core,gui,multimedia,widgets,printsupport,svg,buildtools_build,linguisttools_build,qmake_build
 
 LUA_USES=              lua:5[1-2]
+LUA_LDFLAGS=           -L${LOCALBASE}/lib
 KRB_BASE_USES=         gssapi
 KRB_HEIMDAL_USES=      gssapi:heimdal
 KRB_MIT_USES=          gssapi:mit
Comment 6 Stephen Wall 2019-03-08 22:15:42 UTC
(In reply to VVD from comment #5)
Actually, I've discovered you can use `USES += localbase:ldflags` instead of setting LDFLAGS directly.
Comment 7 VVD 2019-03-08 22:19:21 UTC
(In reply to Stephen Wall from comment #4)
> the three lua files are not being staged when LUA is enabled

Yes:
$ find /usr/ports/net/wireshark/work/ -name 'console.lua'
/usr/ports/net/wireshark/work/wireshark-3.0.0/epan/wslua/console.lua
$ cd /usr/ports/net/wireshark/work/wireshark-3.0.0/epan/wslua
$ ls -l *.lua
-rw-r--r--  1 root  wheel  2424 Feb 28 20:56 console.lua
-rw-r--r--  1 root  wheel  7697 Feb 28 20:56 dtd_gen.lua
-rw-r--r--  1 root  wheel  3530 Feb 28 20:56 template-init.lua
Comment 8 VVD 2019-03-08 22:45:53 UTC
(In reply to Stephen Wall from comment #6)
> Actually, I've discovered you can use `USES += localbase:ldflags` instead of setting LDFLAGS directly.

This don't work:
@@ -83,6 +83,7 @@
 GUI_USE=       qt=core,gui,multimedia,widgets,printsupport,svg,buildtools_build,linguisttools_build,qmake_build
 
 LUA_USES=              lua:5[1-2]
+USES+=                 localbase:ldflags
 KRB_BASE_USES=         gssapi
 KRB_HEIMDAL_USES=      gssapi:heimdal
 KRB_MIT_USES=          gssapi:mit

This don't work too:
-LUA_USES=              lua:5[1-2]
+LUA_USES=              lua:5[1-2] localbase:ldflags
Comment 9 Martin MATO 2019-03-09 11:48:14 UTC
It does not work for me. :(
Same error as first encountered
ld: error: unable to find library -llua-5.2
cc: error: linker command failed with exit code 1 (use -v to see invocation)
[1929/2322] cd /usr/ports/net/wireshark/work/.build/ui/qt && /usr/local/bin/cmake -E cmake_autogen /usr/ports/net/wireshark/work/.build/ui/qt/CMakeFiles/qtui_autogen.dir/AutogenInfo.cmake Release
ninja: build stopped: subcommand failed.
===> Compilation failed unexpectedly.

I tried with

-LUA_USES=               lua:5[1-2]
+LUA_USES=               lua:52


to no avail.
compilation lead to the same error: unable to find library -llua-5.2

This Declaration  seems to be ignored or overriden at some level.
Comment 10 Martin MATO 2019-03-09 12:02:49 UTC
found this int the term output


-- Checking for one of the modules 'lua5.2;lua-5.2;lua52;lua5.1;lua-5.1;lua51'
-- Could NOT find LUA (missing: LUA_LIBRARY) (found suitable version "502", minimum required is "5.1")


seem finding lua from BASE and actually ignoring LUA_USES


hope this helps
(In reply to martin.mato from comment #9)
Comment 11 Martin MATO 2019-03-09 12:15:02 UTC
(In reply to martin.mato from comment #10)
silly me. there is no lua in BASE, right ? only in src/contrib.

perhaps a misinterpretation of the version number? Because i do not find any version 5.02 in my system.
Comment 12 Stephen Wall 2019-03-11 22:13:38 UTC
Use the existing `USES localbase` rather than creating a new one.

--- ports-merge/ports/net/wireshark/Makefile
+++ ports-merge/ports/net/wireshark/Makefile
@@ -25,7 +25,7 @@
 DATADIR=       ${PREFIX}/share/${DATADIR_NAME}

 USES=          alias cmake cpe compiler:c++11-lang gettext-runtime \
-               libtool localbase pathfix \
+               libtool localbase:ldflags pathfix \
                perl5 pkgconfig python:3.4+ ssl tar:xz
 USE_PERL5=     build
 USE_GNOME=     glib20 libxml2
Comment 13 VVD 2019-03-12 02:09:55 UTC
(In reply to Stephen Wall from comment #12)
It's work.

But we have one more error:
===>  Installing for wireshark-3.0.0
===>  Checking if wireshark is already installed
===>   Registering installation for wireshark-3.0.0
pkg-static: Unable to access file /usr/ports/net/wireshark/work/stage/usr/local/share/wireshark/console.lua:No such file or directory
pkg-static: Unable to access file /usr/ports/net/wireshark/work/stage/usr/local/share/wireshark/dtd_gen.lua:No such file or directory
pkg-static: Unable to access file /usr/ports/net/wireshark/work/stage/usr/local/share/wireshark/init.lua:No such file or directory
*** Error code 74
Comment 14 Lucas Nali de Magalhães (rollingbits) 2019-03-12 15:27:04 UTC
(In reply to Stephen Wall from comment #0)

Hi. I also have this issue. If I compile with the patch mentioned in the above comment the installation still didn't concludes successfully. The error is:

-- Installing: /usr/ports/net/wireshark/work/stage/usr/local/lib/wireshark/plugins/3.0/epan/wimaxmacphy.so
-- Set runtime path of "/usr/ports/net/wireshark/work/stage/usr/local/lib/wireshark/plugins/3.0/epan/wimaxmacphy.so" to ""
-- Installing: /usr/ports/net/wireshark/work/stage/usr/local/lib/wireshark/plugins/3.0/wiretap/usbdump.so
-- Set runtime path of "/usr/ports/net/wireshark/work/stage/usr/local/lib/wireshark/plugins/3.0/wiretap/usbdump.so" to ""
-- Installing: /usr/ports/net/wireshark/work/stage/usr/local/lib/wireshark/plugins/3.0/codecs/l16mono.so
-- Set runtime path of "/usr/ports/net/wireshark/work/stage/usr/local/lib/wireshark/plugins/3.0/codecs/l16mono.so" to ""
====> Compressing man pages (compress-man)
===>  Installing for wireshark-3.0.0
===>  Checking if wireshark is already installed
===>   Registering installation for wireshark-3.0.0
pkg-static: Unable to access file /usr/ports/net/wireshark/work/stage/usr/local/share/wireshark/console.lua:No such file or directory
pkg-static: Unable to access file /usr/ports/net/wireshark/work/stage/usr/local/share/wireshark/dtd_gen.lua:No such file or directory
pkg-static: Unable to access file /usr/ports/net/wireshark/work/stage/usr/local/share/wireshark/init.lua:No such file or directory
*** Error code 74

Stop.
make[1]: stopped in /usr/ports/net/wireshark
*** Error code 1

Stop.
make: stopped in /usr/ports/net/wireshark

===>>> Installation of wireshark-3.0.0 (net/wireshark) failed
===>>> Aborting update

and I don't find any .lua files in the stage directory. My Makefile has the additional patch to make the port compile:


--- Makefile    (revision 495009)
+++ Makefile    (working copy)
@@ -119,6 +119,7 @@
 CISCODUMP_CMAKE_OFF=-DBUILD_ciscodump=OFF
 
 LUA_CPPFLAGS=          -I${LUA_INCDIR}
+LUA_LDFLAGS=           -L${LUA_LIBDIR}
 
 GUI_CONFIGURE_ENV=     PATH="${PATH}:${QT_BINDIR}"
 GUI_MAKE_ENV=          PATH="${PATH}:${QT_BINDIR}"

$ make showconfig
===> The following configuration options are available for wireshark-3.0.0:
     ANDROIDDUMP=on: Build androiddump extcap tool
     CARES=off: Enable support for asynchronous DNS via c-ares
     CISCODUMP=on: Build ciscodump extcap tool
     DECRYPT=on: Decryption support for SSL and IPSec
     GUI=off: Enable Qt 5 based Wireshark GUI
     LUA=on: Lua scripting language support
     MAXMIND=on: Enable MaxMindDB-based GeoIP geolocation support
     RTP=on: Enable support for playing back RTP streams
     SNMP=on: SNMP network protocol support
     SSHDUMP=on: Build sshdump extcap tool
====> Kerberos dissection support: you have to select exactly one of them
     KRB_BASE=on: Kerberos support via base system
     KRB_HEIMDAL=off: Kerberos support via security/heimdal
     KRB_MIT=off: Kerberos support via security/krb5
     KRB_NONE=off: Disable Kerberos support
===> Use 'make config' to modify these settings
Comment 15 commit-hook freebsd_committer 2019-03-13 20:47:46 UTC
A commit references this bug:

Author: marcus
Date: Wed Mar 13 20:47:20 UTC 2019
New revision: 495662
URL: https://svnweb.freebsd.org/changeset/ports/495662

Log:
  Various fixes.

  * Fix detection of the LUA library
  * Unconditionally package libwscodecs
  * Add CONFLICTS_INSTALL throughout

  PR:		236332 (for LUA)
  		236468 (for conflicts)

Changes:
  head/net/tshark/Makefile
  head/net/tshark-lite/Makefile
  head/net/wireshark/Makefile
  head/net/wireshark/pkg-plist
  head/net/wireshark-lite/Makefile
Comment 16 Joe Marcus Clarke freebsd_committer 2019-03-13 20:48:24 UTC
This should be fixed now.  I tested a LUA 5.2 build and the files were installed.
Comment 17 VVD 2019-03-13 23:40:44 UTC
Work fine for me too on 12.0 amd64 and i386!
Comment 18 Lucas Nali de Magalhães (rollingbits) 2019-03-14 12:19:00 UTC
(In reply to Joe Marcus Clarke from comment #16)
Thank you very much.