Wireshark-dev: [Wireshark-dev] Error building from source: /usr/bin/ld: /usr/lib/x86_64-linux-g

From: "jorge.pinto.sousa" <jorge.pinto.sousa@xxxxxxxxx>
Date: Wed, 09 Nov 2022 19:39:11 +0000
Hello,

I'm trying to build from source, on this hash 99e93e24b89e13e9e1ccf6c3665814e61f59fa48 using the cmd line:

cmake -DUSE_qt6=off -DUSE_STATIC=on -DBUILD_wireshark=OFF -DBUILD_tshark=OFF   -DBUILD_editcap=OFF -DBUILD_capinfos=OFF  -DBUILD_captype=OFF -DBUILD_mergecap=OFF -DBUILD_reordercap=OFF -DBUILD_text2pcap=OFF -DBUILD_dftest=OFF -DBUILD_randpkt=OFF  -DBUILD_rawshark=OFF -G Ninja ..

(I just want to statically build dumpcap)


I'm getting the following error: 
[2/415] Linking C shared library run/libwsutil.so.0.0.0
FAILED: run/libwsutil.so.0.0.0
: && /usr/bin/gcc -fPIC -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 -Wredundant-decls -Wno-error=maybe-uninitialized -Wno-error=alloc-size-larger-than= -Wno-error=stringop-overflow= -Wno-format-truncation -Wno-error=deprecated-declarations -Werror=unused-but-set-variable -Wframe-larger-than=32768 -fdiagnostics-color=always -Wunused-const-variable -Wshadow -Wold-style-definition -Wstrict-prototypes -Wlogical-op -Wjump-misses-init -Werror=implicit -Wno-pointer-sign  -fmacro-prefix-map=/home/sousajo/etudes/wireshark/= -fmacro-prefix-map=/home/sousajo/etudes/wireshark/build/= -fmacro-prefix-map=../= -O2 -g -DNDEBUG  -Wl,--as-needed -shared -Wl,-soname,libwsutil.so.0 -o run/libwsutil.so.0.0.0 wsutil/wmem/CMakeFiles/wmem.dir/wmem_array.c.o wsutil/wmem/CMakeFiles/wmem.dir/wmem_core.c.o wsutil/wmem/CMakeFiles/wmem.dir/wmem_allocator_block.c.o wsutil/wmem/CMakeFiles/wmem.dir/wmem_allocator_block_fast.c.o wsutil/wmem/CMakeFiles/wmem.dir/wmem_allocator_simple.c.o wsutil/wmem/CMakeFiles/wmem.dir/wmem_allocator_strict.c.o wsutil/wmem/CMakeFiles/wmem.dir/wmem_interval_tree.c.o wsutil/wmem/CMakeFiles/wmem.dir/wmem_list.c.o wsutil/wmem/CMakeFiles/wmem.dir/wmem_map.c.o wsutil/wmem/CMakeFiles/wmem.dir/wmem_miscutl.c.o wsutil/wmem/CMakeFiles/wmem.dir/wmem_multimap.c.o wsutil/wmem/CMakeFiles/wmem.dir/wmem_stack.c.o wsutil/wmem/CMakeFiles/wmem.dir/wmem_strbuf.c.o wsutil/wmem/CMakeFiles/wmem.dir/wmem_strutl.c.o wsutil/wmem/CMakeFiles/wmem.dir/wmem_tree.c.o wsutil/wmem/CMakeFiles/wmem.dir/wmem_user_cb.c.o wsutil/CMakeFiles/wsutil.dir/802_11-utils.c.o wsutil/CMakeFiles/wsutil.dir/adler32.c.o wsutil/CMakeFiles/wsutil.dir/base32.c.o wsutil/CMakeFiles/wsutil.dir/bitswap.c.o wsutil/CMakeFiles/wsutil.dir/buffer.c.o wsutil/CMakeFiles/wsutil.dir/codecs.c.o wsutil/CMakeFiles/wsutil.dir/crash_info.c.o wsutil/CMakeFiles/wsutil.dir/crc10.c.o wsutil/CMakeFiles/wsutil.dir/crc16.c.o wsutil/CMakeFiles/wsutil.dir/crc16-plain.c.o wsutil/CMakeFiles/wsutil.dir/crc32.c.o wsutil/CMakeFiles/wsutil.dir/crc5.c.o wsutil/CMakeFiles/wsutil.dir/crc6.c.o wsutil/CMakeFiles/wsutil.dir/crc7.c.o wsutil/CMakeFiles/wsutil.dir/crc8.c.o wsutil/CMakeFiles/wsutil.dir/crc11.c.o wsutil/CMakeFiles/wsutil.dir/curve25519.c.o wsutil/CMakeFiles/wsutil.dir/dot11decrypt_wep.c.o wsutil/CMakeFiles/wsutil.dir/eax.c.o wsutil/CMakeFiles/wsutil.dir/feature_list.c.o wsutil/CMakeFiles/wsutil.dir/filesystem.c.o wsutil/CMakeFiles/wsutil.dir/g711.c.o wsutil/CMakeFiles/wsutil.dir/inet_addr.c.o wsutil/CMakeFiles/wsutil.dir/interface.c.o wsutil/CMakeFiles/wsutil.dir/introspection.c.o wsutil/CMakeFiles/wsutil.dir/jsmn.c.o wsutil/CMakeFiles/wsutil.dir/json_dumper.c.o wsutil/CMakeFiles/wsutil.dir/mpeg-audio.c.o wsutil/CMakeFiles/wsutil.dir/nstime.c.o wsutil/CMakeFiles/wsutil.dir/cpu_info.c.o wsutil/CMakeFiles/wsutil.dir/os_version_info.c.o wsutil/CMakeFiles/wsutil.dir/please_report_bug.c.o wsutil/CMakeFiles/wsutil.dir/privileges.c.o wsutil/CMakeFiles/wsutil.dir/regex.c.o wsutil/CMakeFiles/wsutil.dir/rsa.c.o wsutil/CMakeFiles/wsutil.dir/sober128.c.o wsutil/CMakeFiles/wsutil.dir/socket.c.o wsutil/CMakeFiles/wsutil.dir/strnatcmp.c.o wsutil/CMakeFiles/wsutil.dir/str_util.c.o wsutil/CMakeFiles/wsutil.dir/strtoi.c.o wsutil/CMakeFiles/wsutil.dir/report_message.c.o wsutil/CMakeFiles/wsutil.dir/tempfile.c.o wsutil/CMakeFiles/wsutil.dir/time_util.c.o wsutil/CMakeFiles/wsutil.dir/to_str.c.o wsutil/CMakeFiles/wsutil.dir/type_util.c.o wsutil/CMakeFiles/wsutil.dir/unicode-utils.c.o wsutil/CMakeFiles/wsutil.dir/ws_getopt.c.o wsutil/CMakeFiles/wsutil.dir/ws_mempbrk.c.o wsutil/CMakeFiles/wsutil.dir/ws_pipe.c.o wsutil/CMakeFiles/wsutil.dir/wsgcrypt.c.o wsutil/CMakeFiles/wsutil.dir/wsjson.c.o wsutil/CMakeFiles/wsutil.dir/wslog.c.o wsutil/CMakeFiles/wsutil.dir/xtea.c.o wsutil/CMakeFiles/wsutil.dir/plugins.c.o wsutil/CMakeFiles/wsutil.dir/ws_mempbrk_sse42.c.o  /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/libgmodule-2.0.a  -ldl  /usr/lib/x86_64-linux-gnu/libgcrypt.a  /usr/lib/x86_64-linux-gnu/libgpg-error.a  /usr/lib/x86_64-linux-gnu/libpcre2-8.a  -lm && :
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgpg-error.a(libgpg_error_la-init.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

I'm on Ubuntu 20.04, using gcc 8.4 and libgpg-error-dev is version 1.37-1.
Does this means that I have to rebuild that lib from source also?
If that's the issue do you know by any chance, any compatible version of libgpg-error-dev  which is compiled with fPIC?
Can I get a self contained dumpcap binary in any other way?

Thanks.

BR, 

 
Jorge Pinto Sousa
image


Sent with Proton Mail secure email.