rtbrick / bngblaster

The BNG Blaster is an open-source network tester for access and routing protocols.
https://rtbrick.github.io/bngblaster/
BSD 3-Clause "New" or "Revised" License
202 stars 32 forks source link

Build failure on aarch64-linux #216

Closed yu-re-ka closed 9 months ago

yu-re-ka commented 9 months ago

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

Version 0.8.28

JSON configuration: N/A

Steps to reproduce the behavior:

  1. Attempt to build bngblaster on a non-x86 architecture

Expected behavior

bngblaster builds

Screenshots

[  1%] Building C object code/bngblaster/CMakeFiles/lwipcontribportunix.dir/__/lwip/contrib/ports/unix/port/perf.c.o
[  1%] Building C object code/bngblaster/CMakeFiles/lwipcontribportunix.dir/__/lwip/contrib/ports/unix/port/netif/sio.c.o
[  1%] Building C object code/bngblaster/CMakeFiles/lwipcontribportunix.dir/__/lwip/contrib/ports/unix/port/sys_arch.c.o
[  2%] Building C object code/lspgen/CMakeFiles/lspgen.dir/__/common/src/logging.c.o
[  3%] Building C object code/bngblaster/CMakeFiles/lwipcontribportunix.dir/__/lwip/contrib/ports/unix/port/netif/list.c.o
[  3%] Building C object code/bngblaster/CMakeFiles/lwipcontribportunix.dir/__/lwip/contrib/ports/unix/port/netif/tapif.c.o
[  4%] Building C object code/lspgen/CMakeFiles/lspgen.dir/__/common/src/timer.c.o
[  4%] Building C object code/lspgen/CMakeFiles/lspgen.dir/__/common/src/utils.c.o
[  5%] Building C object code/bngblaster/CMakeFiles/lwipcore.dir/__/lwip/src/core/init.c.o
[  5%] Building C object code/bngblaster/CMakeFiles/lwipcontribportunix.dir/__/lwip/contrib/ports/unix/port/netif/fifo.c.o
gcc: error: unrecognized command-line option '-m64'
make[2]: *** [code/lspgen/CMakeFiles/lspgen.dir/build.make:76: code/lspgen/CMakeFiles/lspgen.dir/__/common/src/logging.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
gcc: error: unrecognized command-line option '-m64'
gcc: error: unrecognized command-line option '-m64'
make[2]: *** [code/lspgen/CMakeFiles/lspgen.dir/build.make:104: code/lspgen/CMakeFiles/lspgen.dir/__/common/src/utils.c.o] Error 1
make[2]: *** [code/lspgen/CMakeFiles/lspgen.dir/build.make:90: code/lspgen/CMakeFiles/lspgen.dir/__/common/src/timer.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:329: code/lspgen/CMakeFiles/lspgen.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Additional context

The compiler option -m64 is only valid when building for x86, but is specified in https://github.com/rtbrick/bngblaster/blob/6934bb51b7257b067b5ba49dd1a811a73f0c39d2/code/bngblaster/CMakeLists.txt#L68 and https://github.com/rtbrick/bngblaster/blob/6934bb51b7257b067b5ba49dd1a811a73f0c39d2/code/lspgen/CMakeLists.txt#L22 regardless of architecture

GIC-de commented 9 months ago

A few days ago, I integrated the following CMAKE option into the dev branch (https://github.com/rtbrick/bngblaster/commit/2abd7b362a3e0b347de3f999210137b46b21a83f) to enable the building of the BNG Blaster on my older Pi3. However, I still need to follow up with updating the documentation regarding this integration.

cmake -DBNGBLASTER_CPU_NATIVE=on .

yu-re-ka commented 9 months ago

BNGBLASTER_CPU_NATIVE uses -march=native which is not unsuitable for distro packaging because the resulting binary only works on CPUs that have all the instruction set extensions as the builder.

We need a mode that passes neither -m64 nor -march=native, and IMO that should be the default.

GIC-de commented 9 months ago

Please verify.

yu-re-ka commented 9 months ago

Can confirm this works on aarch64-linux 👍🏻