ns3.42 error build on Openflow : -Werror=pedantic

75 views
Skip to first unread message

wildan

unread,
Aug 2, 2024, 4:33:38 AM8/2/24
to ns-3-users
I switched from ns-3.40 to ns-3.42 with Openflow module. In ns-3.40 and 3.41 the build process was successful, but when I used ns-3.42 the build process failed in Openflow. Here is the error message:

danz@192:~/Simulator/ns-3-dev$ ./ns3 build [0/2] Re-checking globbed directories... [798/2004] Building CXX object src/openflow/CMakeFiles/libopenflow-obj.dir/model/openflow-interface.cc.o FAILED: src/openflow/CMakeFiles/libopenflow-obj.dir/model/openflow-interface.cc.o /usr/bin/ccache /usr/bin/c++ -DEIGEN_MPL2_ONLY -DENABLE_OPENFLOW -DHAVE_BOOST -DHAVE_BOOST_UNITS -DHAVE_EIGEN3 -DHAVE_GSL -DHAVE_LIBXML2 -DHAVE_SQLITE3 -DNS3_ASSERT_ENABLE -DNS3_BUILD_PROFILE_DEBUG -DNS3_LOG_ENABLE -DNS3_MPI -DNS3_OPENFLOW -DPROJECT_SOURCE_PATH=\"/home/danz/Simulator/ns-3-dev\" -D__LINUX__ -I/home/danz/Simulator/ns-3-dev/build/include -I/usr -I/usr/include/eigen3 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gtk-3.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/atk-1.0 -I/usr/include/libxml2 -I/usr/include/python3.11 -I/usr/lib/x86_64-linux-gnu/openmpi/include -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -I/home/danz/Simulator/openflow/include/openflow -I/home/danz/Simulator/openflow/include -g -fPIC -fno-semantic-interposition -fdiagnostics-color=always -Wno-restrict -Wall -Wpedantic -Werror -Wno-error=deprecated-declarations -Wno-stringop-truncation -std=c++20 -MD -MT src/openflow/CMakeFiles/libopenflow-obj.dir/model/openflow-interface.cc.o -MF src/openflow/CMakeFiles/libopenflow-obj.dir/model/openflow-interface.cc.o.d -o src/openflow/CMakeFiles/libopenflow-obj.dir/model/openflow-interface.cc.o -c /home/danz/Simulator/ns-3-dev/src/openflow/model/openflow-interface.cc In file included from /home/danz/Simulator/openflow/include/openflow/ericsson-ext.h:5, from /home/danz/Simulator/ns-3-dev/src/openflow/model/openflow-interface.h:37, from /home/danz/Simulator/ns-3-dev/src/openflow/model/openflow-interface.cc:18: /home/danz/Simulator/openflow/include/openflow/openflow.h:282:31: error: ISO C++ forbids zero-size array ‘ports’ [-Werror=pedantic] 282 | struct ofp_phy_port ports[0]; /* Port definitions. The number of ports | ^ /home/danz/Simulator/openflow/include/openflow/openflow.h:445:18: error: ISO C++ forbids zero-size array ‘data’ [-Werror=pedantic] 445 | uint8_t data[0]; /* Ethernet frame, halfway through 32-bit word, | ^ /home/danz/Simulator/openflow/include/openflow/openflow.h:585:38: error: ISO C++ forbids zero-size array ‘actions’ [-Werror=pedantic] 585 | struct ofp_action_header actions[0]; /* Actions. */ | ^ /home/danz/Simulator/openflow/include/openflow/openflow.h:719:38: error: ISO C++ forbids zero-size array ‘actions’ [-Werror=pedantic] 719 | struct ofp_action_header actions[0]; /* The action length is inferred | ^ /home/danz/Simulator/openflow/include/openflow/openflow.h:743:38: error: ISO C++ forbids zero-size array ‘actions’ [-Werror=pedantic] 743 | struct ofp_action_header actions[0]; /* Uses the same action header as the flow-table | ^ /home/danz/Simulator/openflow/include/openflow/openflow.h:836:18: error: ISO C++ forbids zero-size array ‘data’ [-Werror=pedantic] 836 | uint8_t data[0]; /* Variable-length data. Interpreted based | ^ /home/danz/Simulator/openflow/include/openflow/openflow.h:890:18: error: ISO C++ forbids zero-size array ‘body’ [-Werror=pedantic] 890 | uint8_t body[0]; /* Body of the request. */ | ^ /home/danz/Simulator/openflow/include/openflow/openflow.h:902:18: error: ISO C++ forbids zero-size array ‘body’ [-Werror=pedantic] 902 | uint8_t body[0]; /* Body of the reply. */ | ^ /home/danz/Simulator/openflow/include/openflow/openflow.h:948:38: error: ISO C++ forbids zero-size array ‘actions’ [-Werror=pedantic] 948 | struct ofp_action_header actions[0]; /* Actions. */ | ^ In file included from /home/danz/Simulator/ns-3-dev/src/openflow/model/openflow-interface.h:38: /home/danz/Simulator/openflow/include/openflow/nicira-ext.h:87:36: error: ISO C++ forbids zero-size array ‘snat’ [-Werror=pedantic] 87 | struct nx_snat_config snat[0]; | ^ /home/danz/Simulator/openflow/include/openflow/nicira-ext.h:86:5: error: invalid use of ‘union nx_act_config::<unnamed>’ with a zero-size array in ‘struct nx_act_config’ [-Werror=pedantic] 86 | union { | ^~~~~ /home/danz/Simulator/openflow/include/openflow/nicira-ext.h:87:31: note: array member ‘nx_snat_config nx_act_config::<unnamed union>::snat [0]’ declared here 87 | struct nx_snat_config snat[0]; | ^~~~ In file included from /home/danz/Simulator/openflow/include/openflow/private/datapath.h:43, from /home/danz/Simulator/ns-3-dev/src/openflow/model/openflow-interface.h:58: /home/danz/Simulator/openflow/include/openflow/private/switch-port.h:32:38: error: ISO C++ forbids zero-size array ‘actions’ [-Werror=pedantic] 32 | struct ofp_action_header actions[0]; | ^ In file included from /home/danz/Simulator/openflow/include/openflow/private/datapath.h:55: /home/danz/Simulator/openflow/include/openflow/private/packets.h:218:9: error: ISO C++ prohibits anonymous structs [-Werror=pedantic] 218 | { | ^ In file included from /home/danz/Simulator/openflow/include/openflow/private/dp_act.h:38, from /home/danz/Simulator/ns-3-dev/src/openflow/model/openflow-interface.h:63: /home/danz/Simulator/openflow/include/openflow/private/switch-flow.h:54:38: error: ISO C++ forbids zero-size array ‘actions’ [-Werror=pedantic] 54 | struct ofp_action_header actions[0]; | ^ cc1plus: all warnings being treated as errors [799/2004] Building CXX object src/openflow/CMakeFiles/libopenflow-test.dir/test/openflow-switch-test-suite.cc.o FAILED: src/openflow/CMakeFiles/libopenflow-test.dir/test/openflow-switch-test-suite.cc.o

Gabriel Ferreira

unread,
Aug 2, 2024, 5:20:06 AM8/2/24
to ns-3-users
Yes. Please disable pedantic errors by commenting out these lines. Or setting NS3_WARNINGS_AS_ERRORS=OFF.
https://gitlab.com/nsnam/ns-3-dev/-/blob/master/build-support/macros-and-definitions.cmake?ref_type=heads#L232-L234
Message has been deleted

wildan

unread,
Aug 2, 2024, 5:42:29 AM8/2/24
to ns-3-users
thank you

Gabriel Ferreira

unread,
Aug 2, 2024, 6:36:17 AM8/2/24
to ns-3-users
This flag was recently enabled in 3.42, to make sure we adhere as much as possible to standard C++ (avoiding compiler extensions)

Wagner de Oliveira

unread,
Sep 4, 2025, 1:58:05 AM (9 days ago) Sep 4
to ns-3-users
Hi Gabriel, I followed both methods you suggested in the "ns3.42 error build on Openflow: -Werror=pedantic" thread.
In my case, I'm using Ubuntu 24.04, ns-3.45, and the errors persist.
Two types of errors are appearing in ns-3.45, for a total of 15 errors, similar to those in ns-3.42.
The errors are:

1- error: ISO C++ forbids zero-size array 'actions' [-Werror=pedantic]; struct ofp_action_header actions[0];
2- note: array member 'nx_snat_config nx_act_config::<unnamed union>::snat[0]' declared here; struct nx_snat_config snat[0];

I'm attaching the figures.
Could you tell me another method to block or cancel these errors, other than the two methods you suggested?

Wagner

000-OPENFLOW-ERROR .pdf

Gabriel Ferreira

unread,
Sep 4, 2025, 4:30:59 AM (9 days ago) Sep 4
to ns-3-users
Same response. Either disable warnings as errors (NS3_WARNINGS_AS_ERRORS), or all warnings (NS3_WARNINGS).
./ns3 configure --disable-werror or  ./ns3 configure --disable-warnings,
or directly via CMake definitions ./ns3 configure -- -DNS3_WARNINGS_AS_ERRORS=OFF
Reply all
Reply to author
Forward
0 new messages