fails to buid on mips(el): undefined reference to `__sync_fetch_and_add_8'
envgap__pavel-odintsov__fastnetmon-703
01 / FAILURE SIGNATURE
As reported upstream
./obj-mipsel-linux-gnu/./src/fastnetmon.cpp:1698: undefined reference to `__sync_fetch_and_add_8'
Not a benchmark task.
- In a clean container the reported failure did not reproduce, or the known fix did not make the project run.
02 / ENVIRONMENT RECIPE
- Base commit
b6e6843d2e21bea1a2ca69643622cc4eb42d4d06- Manifest
src/CMakeLists.txt- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
pavel-odintsov/fastnetmon #703 · read the original issue
fastnetmon fails to build on the Debian architectures mips, mipsel, m68k, powerpc, sh4:
```
/usr/bin/c++ -g -O2 -fdebug-prefix-map=/<<BUILDDIR>>/fastnetmon-1.1.3+dfsg=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-z,relro -Wl,-z,now -rdynamic CMakeFiles/fastnetmon.dir/fastnetmon.cpp.o -o fastnetmon -lboost_thread -lboost_regex -lboost_program_options -lboost_system -lboost_chrono -lboost_date_time -lboost_atomic -lpthread -lhiredis -lmongoc-1.0 -lbson-1.0 libfast_dpi.a -llog4cpp -lpthread libpatricia.a libfastnetmon_pcap_format.a libipfix_rfc.a libfast_library.a libunified_parser.a libafpacket_plugin.a libsflow_plugin.a libnetflow_plugin.a libpcap_plugin.a libexample_plugin.a libnetmap_plugin.a -lndpi -lboost_thread -lboost_regex -lboost_program_options -lboost_system -lboost_chrono -lboost_date_time -lboost_atomic -lpthread libpatricia.a libfastnetmon_pcap_format.a -ljson-c libunified_parser.a libipfix_rfc.a -lluajit-5.1 -lpcap libfastnetmon_packet_parser.a
CMakeFiles/fastnetmon.dir/fastnetmon.cpp.o: In function `process_packet(simple_packet&)':
./obj-mipsel-linux-gnu/./src/fastnetmon.cpp:1698: undefined reference to `__sync_fetch_and_add_8'
./obj-mipsel-linux-gnu/./src/fastnetmon.cpp:1788: undefined reference to `__sync_fetch_and_add_8'
./obj-mipsel-linux-gnu/./src/fastnetmon.cpp:1789: undefined reference to `__sync_fetch_and_add_8'
./obj-mipsel-linux-gnu/./src/fastnetmon.cpp:1788: undefined reference to `__sync_fetch_and_add_8'
./obj-mipsel-linux-gnu/./src/fastnetmon.cpp:1789: undefined reference to `__sync_fetch_and_add_8'
CMakeFiles/fastnetmon.dir/fastnetmon.cpp.o:./obj-mipsel-linux-gnu/./src/fastnetmon.cpp:1916: more undefined references to `__sync_fetch_and_add_8' follow
collect2: error: ld returned 1 exit status
CMakeFiles/fastnetmon.dir/build.make:135: recipe for target 'fastnetmon' failed
make[3]: *** [fastnetmon] Error 1
```
The problem is that these architectures do not provide a 64-bit versions of `__sync_fetch_and_add` (i.e. `__sync_fetch_and_add_8`):
```
bdrung@eller:~$ readelf -a /lib/mipsel-linux-gnu/libgcc_s.so.1 | grep __sync_add_and_fetch
6: 00011060 36 FUNC GLOBAL DEFAULT 13 __sync_add_and_fetch_4@@GCC_4.4.0
108: 00010fa0 88 FUNC GLOBAL DEFAULT 13 __sync_add_and_fetch_1@@GCC_4.4.0
696: 00011000 88 FUNC GLOBAL DEFAULT 13 __sync_add_and_fetch_2@@GCC_4.4.0
```
The atomic library does not provide `__sync_add_and_fetch`.
Debian-Bug: https://bugs.debian.org/86980504 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]