https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=16790
Bug ID: 16790
Summary: CMake: options for static build fail with make and
ninja
Product: Wireshark
Version: 3.2.0
Hardware: x86-64
OS: Linux
Status: UNCONFIRMED
Severity: Normal
Priority: Low
Component: Build process
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Build Information:
I tried the same process on Ubuntu 18.04 and Debian 10.
Linux ubuntu 5.4.0-42-generic #46~18.04.1-Ubuntu SMP Fri Jul 10 07:21:24 UTC
2020 x86_64 x86_64 x86_64 GNU/Linux
Linux debian 4.19.0-10-amd64 #1 SMP Debian 4.19.132-1 (2020-07-24) x86_64
GNU/Linux
Compiler version for Ubuntu 18.04:
cc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Compiler version for Debian 10:
cc (Debian 8.3.0-6) 8.3.0
CMake version for Ubuntu 18.04:
cmake version 3.10.2
CMake version for Debian 10:
cmake version 3.13.4
Ninja version for Ubuntu 18.04:
1.8.2
Ninja version for Debian 10:
1.8.2
--
I'm trying to build a completely static Wireshark and TShark on Debian. I
realize the resulting binaries will be enormous. The CMakeOptions.txt file
(https://github.com/wireshark/wireshark/blob/wireshark-3.2.0/CMakeOptions.txt)
lists several options related to static linking:
option(ENABLE_STATIC "Build Wireshark libraries statically" OFF)
option(USE_STATIC "Always link statically with external libraries" OFF)
Using '-DENABLE_STATIC=ON' works for statically-linked Wireshark libraries only
so I still have to ensure all the external, shared objects are available on the
host (which isn't always the case). Only using '-DUSE_STATIC=ON' doesn't work
at all (see below exemplars for similar error output). I need both of these
options to work (unless I'm missing an option somehow?).
I tried to omit all CMake options and plugins EXCEPT for Wireshark which didn't
work with '-DUSE_STATIC=ON', either. I assume it's something wrong with CMake
and not make or ninja, but I'm a bit out of my depth. Help?
====================================================
Ubuntu 18.04 with cmake and make:
$ cmake -DENABLE_STATIC=ON -DUSE_STATIC=ON ../wireshark-3.2.0
. . .
-- The following OPTIONAL packages have been found:
* Git
* GMODULE2
* Gettext
* PCAP
* MaxMindDB, C library for the MaxMind DB file format,
<https://github.com/maxmind/libmaxminddb>
Support for GeoIP lookup
* CARES (required version >= 1.5.0), Library for asynchronous DNS requests,
<https://c-ares.haxx.se/>
DNS name resolution for captures
* ZLIB
* SETCAP
-- The following REQUIRED packages have been found:
* GLIB2 (required version >= 2.32.0)
* GTHREAD2
* GCRYPT (required version >= 1.4.2)
* LEX
* YACC
* Perl
* PythonInterp (required version >= 3.4)
* M
* Qt5Core
* Qt5LinguistTools
* Qt5Network (required version >= 5.9.5)
* Qt5Gui (required version >= 5.9.5)
* Qt5Multimedia
* Qt5PrintSupport
* Qt5Svg
* Qt5Widgets
* POD
. . .
$ make
. . .
[ 5%] Linking C executable run/dumpcap
/usr/lib/x86_64-linux-gnu/libgmodule-2.0.a(libgmodule_2_0_la-gmodule.o): In
function `_g_module_close.isra.0.part.1':
(.text+0x5): undefined reference to `dlerror'
/usr/lib/x86_64-linux-gnu/libgmodule-2.0.a(libgmodule_2_0_la-gmodule.o): In
function `g_module_close':
(.text+0x132): undefined reference to `dlclose'
/usr/lib/x86_64-linux-gnu/libgmodule-2.0.a(libgmodule_2_0_la-gmodule.o): In
function `g_module_symbol':
(.text+0x29f): undefined reference to `dlerror'
(.text+0x2aa): undefined reference to `dlsym'
(.text+0x2b2): undefined reference to `dlerror'
/usr/lib/x86_64-linux-gnu/libgmodule-2.0.a(libgmodule_2_0_la-gmodule.o): In
function `g_module_open':
(.text+0x4f5): undefined reference to `dlopen'
(.text+0x8a9): undefined reference to `dlclose'
(.text+0x908): undefined reference to `dlopen'
(.text+0xbab): undefined reference to `dlerror'
(.text+0xbe2): undefined reference to `dlerror'
collect2: error: ld returned 1 exit status
CMakeFiles/dumpcap.dir/build.make:169: recipe for target 'run/dumpcap' failed
make[2]: *** [run/dumpcap] Error 1
CMakeFiles/Makefile2:210: recipe for target 'CMakeFiles/dumpcap.dir/all' failed
make[1]: *** [CMakeFiles/dumpcap.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
====================================================
Ubuntu 18.04 with cmake and ninja:
cmake -G Ninja -DENABLE_STATIC=ON -DUSE_STATIC=ON ../wireshark-3.2.0
. . .
-- The following OPTIONAL packages have been found:
* Git
* GMODULE2
* Gettext
* PCAP
* MaxMindDB, C library for the MaxMind DB file format,
<https://github.com/maxmind/libmaxminddb>
Support for GeoIP lookup
* CARES (required version >= 1.5.0), Library for asynchronous DNS requests,
<https://c-ares.haxx.se/>
DNS name resolution for captures
* ZLIB
* SETCAP
-- The following REQUIRED packages have been found:
* GLIB2 (required version >= 2.32.0)
* GTHREAD2
* GCRYPT (required version >= 1.4.2)
* LEX
* YACC
* Perl
* PythonInterp (required version >= 3.4)
* M
* Qt5Core
* Qt5LinguistTools
* Qt5Network (required version >= 5.9.5)
* Qt5Gui (required version >= 5.9.5)
* Qt5Multimedia
* Qt5PrintSupport
* Qt5Svg
* Qt5Widgets
* POD
. . .
$ ninja
. . .
[1710/2371] Linking C executable run/text2pcap
FAILED: run/text2pcap
: && /usr/bin/cc -fvisibility=hidden -fexcess-precision=fast -Wall -Wextra
-Wendif-labels -Wpointer-arith -Wformat-security -fwrapv -fno-strict-overflow
-Wvla -Waddress -Wattributes -Wdiv-by-zero -Wignored-qualifiers -Wpragmas
-Wno-overlength-strings -Wno-long-long -Wframe-larger-than=32768 -Wc++-compat
-Wunused-const-variable -Wshadow -Wold-style-definition -Wstrict-prototypes
-Wlogical-op -Wjump-misses-init -Werror=implicit -Wno-pointer-sign -std=gnu99
-O2 -g -DNDEBUG -pie -Wl,--as-needed CMakeFiles/cli_main.dir/cli_main.c.o
CMakeFiles/version_info.dir/version_info.c.o
CMakeFiles/text2pcap.dir/text2pcap.c.o
CMakeFiles/text2pcap.dir/text2pcap-scanner.c.o -o run/text2pcap
run/libwritecap.a run/libwsutil.a -lm /usr/lib/x86_64-linux-gnu/libz.a -ldl
/usr/lib/x86_64-linux-gnu/libgmodule-2.0.a
/usr/lib/x86_64-linux-gnu/libglib-2.0.a -pthread
/usr/lib/x86_64-linux-gnu/libpcre.a /usr/lib/x86_64-linux-gnu/libgcrypt.a
/usr/lib/x86_64-linux-gnu/libgpg-error.a -lm && :
/usr/lib/x86_64-linux-gnu/libgmodule-2.0.a(libgmodule_2_0_la-gmodule.o): In
function `_g_module_close.isra.0.part.1':
(.text+0x5): undefined reference to `dlerror'
/usr/lib/x86_64-linux-gnu/libgmodule-2.0.a(libgmodule_2_0_la-gmodule.o): In
function `g_module_close':
(.text+0x132): undefined reference to `dlclose'
/usr/lib/x86_64-linux-gnu/libgmodule-2.0.a(libgmodule_2_0_la-gmodule.o): In
function `g_module_symbol':
(.text+0x29f): undefined reference to `dlerror'
(.text+0x2aa): undefined reference to `dlsym'
(.text+0x2b2): undefined reference to `dlerror'
/usr/lib/x86_64-linux-gnu/libgmodule-2.0.a(libgmodule_2_0_la-gmodule.o): In
function `g_module_open':
(.text+0x4f5): undefined reference to `dlopen'
(.text+0x8a9): undefined reference to `dlclose'
(.text+0x908): undefined reference to `dlopen'
(.text+0xbab): undefined reference to `dlerror'
(.text+0xbe2): undefined reference to `dlerror'
collect2: error: ld returned 1 exit status
[1715/2371] Automatic MOC, UIC and RCC for target qtui
ninja: build stopped: subcommand failed.
====================================================
Debian 10 with cmake and make:
$ cmake -DENABLE_STATIC=ON -DUSE_STATIC=ON ../wireshark-3.2.0
. . .
-- The following OPTIONAL packages have been found:
* Git
* GMODULE2
* PCAP
* MaxMindDB, C library for the MaxMind DB file format,
<https://github.com/maxmind/libmaxminddb>
Support for GeoIP lookup
* ZLIB
* SETCAP
-- The following REQUIRED packages have been found:
* GLIB2 (required version >= 2.32.0)
* GTHREAD2
* GCRYPT (required version >= 1.4.2)
* LEX
* YACC
* Perl
* Python3 (required version >= 3.4)
* M
* Qt5Core
* Qt5LinguistTools
* Qt5Network (required version >= 5.11.3)
* Qt5Gui (required version >= 5.11.3)
* Qt5Multimedia
* Qt5PrintSupport
* Qt5Svg
* Qt5Widgets
* POD
. . .
$ make
. . .
[ 4%] Linking C executable run/dumpcap
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgmodule-2.0.a(gmodule.c.o): in
function `_g_module_close.isra.0.part.1':
(.text+0x5): undefined reference to `dlerror'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgmodule-2.0.a(gmodule.c.o): in
function `g_module_close':
(.text+0x175): undefined reference to `dlclose'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgmodule-2.0.a(gmodule.c.o): in
function `g_module_symbol':
(.text+0x28f): undefined reference to `dlerror'
/usr/bin/ld: (.text+0x29a): undefined reference to `dlsym'
/usr/bin/ld: (.text+0x2a2): undefined reference to `dlerror'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgmodule-2.0.a(gmodule.c.o): in
function `g_module_open':
(.text+0x6ee): undefined reference to `dlopen'
/usr/bin/ld: (.text+0x747): undefined reference to `dlclose'
/usr/bin/ld: (.text+0xaf8): undefined reference to `dlopen'
/usr/bin/ld: (.text+0xbb5): undefined reference to `dlerror'
/usr/bin/ld: (.text+0xc11): undefined reference to `dlerror'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/dumpcap.dir/build.make:137: run/dumpcap] Error 1
make[1]: *** [CMakeFiles/Makefile2:216: CMakeFiles/dumpcap.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
====================================================
Debian 10 with cmake and ninja:
$ cmake -G Ninja -DENABLE_STATIC=ON -DUSE_STATIC=ON ../wireshark-3.2.0
. . .
-- The following OPTIONAL packages have been found:
* Git
* GMODULE2
* PCAP
* MaxMindDB, C library for the MaxMind DB file format,
<https://github.com/maxmind/libmaxminddb>
Support for GeoIP lookup
* ZLIB
* SETCAP
-- The following REQUIRED packages have been found:
* GLIB2 (required version >= 2.32.0)
* GTHREAD2
* GCRYPT (required version >= 1.4.2)
* LEX
* YACC
* Perl
* Python3 (required version >= 3.4)
* M
* Qt5Core
* Qt5LinguistTools
* Qt5Network (required version >= 5.11.3)
* Qt5Gui (required version >= 5.11.3)
* Qt5Multimedia
* Qt5PrintSupport
* Qt5Svg
* Qt5Widgets
* POD
. . .
$ ninja
. . .
[1701/2377] Linking C executable run/text2pcap
FAILED: run/text2pcap
: && /usr/bin/cc -fvisibility=hidden -fexcess-precision=fast -Wall -Wextra
-Wendif-labels -Wpointer-arith -Wformat-security -fwrapv -fno-strict-overflow
-Wvla -Waddress -Wattributes -Wdiv-by-zero -Wignored-qualifiers -Wpragmas
-Wno-overlength-strings -Wno-long-long -Wframe-larger-than=32768 -Wc++-compat
-Wunused-const-variable -Wshadow -Wold-style-definition -Wstrict-prototypes
-Wlogical-op -Wjump-misses-init -Werror=implicit -Wno-pointer-sign -std=gnu99
-fmacro-prefix-map=/home/user/wireshark-3.2.0/=
-fmacro-prefix-map=/home/user/build/= -O2 -g -DNDEBUG -pie
-Wl,--as-needed CMakeFiles/cli_main.dir/cli_main.c.o
CMakeFiles/version_info.dir/version_info.c.o
CMakeFiles/text2pcap.dir/text2pcap.c.o
CMakeFiles/text2pcap.dir/text2pcap-scanner.c.o -o run/text2pcap
run/libwritecap.a run/libwsutil.a -lm /usr/lib/x86_64-linux-gnu/libz.a -ldl
/usr/lib/x86_64-linux-gnu/libgmodule-2.0.a
/usr/lib/x86_64-linux-gnu/libglib-2.0.a -pthread
/usr/lib/x86_64-linux-gnu/libpcre.a /usr/lib/x86_64-linux-gnu/libgcrypt.a
/usr/lib/x86_64-linux-gnu/libgpg-error.a -lm && :
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgmodule-2.0.a(gmodule.c.o): in
function `_g_module_close.isra.0.part.1':
(.text+0x5): undefined reference to `dlerror'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgmodule-2.0.a(gmodule.c.o): in
function `g_module_close':
(.text+0x175): undefined reference to `dlclose'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgmodule-2.0.a(gmodule.c.o): in
function `g_module_symbol':
(.text+0x28f): undefined reference to `dlerror'
/usr/bin/ld: (.text+0x29a): undefined reference to `dlsym'
/usr/bin/ld: (.text+0x2a2): undefined reference to `dlerror'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgmodule-2.0.a(gmodule.c.o): in
function `g_module_open':
(.text+0x6ee): undefined reference to `dlopen'
/usr/bin/ld: (.text+0x747): undefined reference to `dlclose'
/usr/bin/ld: (.text+0xaf8): undefined reference to `dlopen'
/usr/bin/ld: (.text+0xbb5): undefined reference to `dlerror'
/usr/bin/ld: (.text+0xc11): undefined reference to `dlerror'
collect2: error: ld returned 1 exit status
[1702/2377] Building C object CMakeFiles/dumpcap.dir/dumpcap.c.o
ninja: build stopped: subcommand failed.
--
You are receiving this mail because:
You are watching all bug changes.___________________________________________________________________________
Sent via: Wireshark-bugs mailing list <[email protected]>
Archives: https://www.wireshark.org/lists/wireshark-bugs
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-bugs
mailto:[email protected]?subject=unsubscribe