I recently encountered FreeRTOS-Plus-TCP compilation issues in a project. A minimal project that reproduces some of these compilation issues is attached (freertos-plus-tcp-compilation-issues.zip (1.8 KB)). When built, this minimal project produces the following output (Ubuntu 20.04):
cmake -S . -B build
:
-- The C compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Using FreeRTOS-Plus-TCP Test Configuration : CUSTOM
-- Found PCAP: /usr/lib/x86_64-linux-gnu/libpcap.so
-- Performing Test PCAP_LINKS_SOLO
-- Performing Test PCAP_LINKS_SOLO - Success
-- Looking for pcap_get_pfring_id
-- Looking for pcap_get_pfring_id - not found
-- Looking for pcap_dump_open_append
-- Looking for pcap_dump_open_append - found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build
cmake --build build -j
:
Scanning dependencies of target freertos_kernel_port
[ 1%] Building C object _deps/freertos_kernel-build/portable/CMakeFiles/freertos_kernel_port.dir/ThirdParty/GCC/Posix/port.c.o
[ 3%] Building C object _deps/freertos_kernel-build/portable/CMakeFiles/freertos_kernel_port.dir/ThirdParty/GCC/Posix/utils/wait_for_event.c.o
[ 3%] Built target freertos_kernel_port
Scanning dependencies of target freertos_kernel
[ 12%] Building C object _deps/freertos_kernel-build/CMakeFiles/freertos_kernel.dir/tasks.c.o
[ 12%] Building C object _deps/freertos_kernel-build/CMakeFiles/freertos_kernel.dir/queue.c.o
[ 12%] Building C object _deps/freertos_kernel-build/CMakeFiles/freertos_kernel.dir/event_groups.c.o
[ 12%] Building C object _deps/freertos_kernel-build/CMakeFiles/freertos_kernel.dir/timers.c.o
[ 12%] Building C object _deps/freertos_kernel-build/CMakeFiles/freertos_kernel.dir/croutine.c.o
[ 14%] Building C object _deps/freertos_kernel-build/CMakeFiles/freertos_kernel.dir/portable/MemMang/heap_4.c.o
[ 12%] Building C object _deps/freertos_kernel-build/CMakeFiles/freertos_kernel.dir/list.c.o
[ 15%] Building C object _deps/freertos_kernel-build/CMakeFiles/freertos_kernel.dir/stream_buffer.c.o
[ 17%] Linking C static library libfreertos_kernel.a
[ 17%] Built target freertos_kernel
Scanning dependencies of target freertos_plus_tcp_utilities
[ 21%] Building C object _deps/freertos_plus_tcp-build/tools/CMakeFiles/freertos_plus_tcp_utilities.dir/tcp_utilities/tcp_mem_stats.c.o
[ 21%] Building C object _deps/freertos_plus_tcp-build/tools/CMakeFiles/freertos_plus_tcp_utilities.dir/tcp_utilities/tcp_dump_packets.c.o
[ 21%] Building C object _deps/freertos_plus_tcp-build/tools/CMakeFiles/freertos_plus_tcp_utilities.dir/tcp_utilities/tcp_netstat.c.o
[ 23%] Linking C static library libfreertos_plus_tcp_utilities.a
[ 23%] Built target freertos_plus_tcp_utilities
Scanning dependencies of target freertos_plus_tcp_network_if
[ 25%] Building C object _deps/freertos_plus_tcp-build/source/portable/NetworkInterface/linux/CMakeFiles/freertos_plus_tcp_network_if.dir/NetworkInterface.c.o
[ 26%] Linking C static library libfreertos_plus_tcp_network_if.a
[ 26%] Built target freertos_plus_tcp_network_if
Scanning dependencies of target freertos_plus_tcp_network_if_common
[ 28%] Building C object _deps/freertos_plus_tcp-build/source/portable/NetworkInterface/CMakeFiles/freertos_plus_tcp_network_if_common.dir/Common/phyHandling.c.o
[ 29%] Linking C static library libfreertos_plus_tcp_network_if_common.a
[ 29%] Built target freertos_plus_tcp_network_if_common
Scanning dependencies of target freertos_plus_tcp_port
[ 31%] Building C object _deps/freertos_plus_tcp-build/source/portable/CMakeFiles/freertos_plus_tcp_port.dir/BufferManagement/BufferAllocation_2.c.o
[ 32%] Linking C static library libfreertos_plus_tcp_port.a
[ 32%] Built target freertos_plus_tcp_port
Scanning dependencies of target freertos_plus_tcp
[ 39%] Building C object _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_BitConfig.c.o
[ 39%] Building C object _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_DNS_Callback.c.o
[ 39%] Building C object _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_DHCP.c.o
[ 39%] Building C object _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_DNS_Cache.c.o
[ 40%] Building C object _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_DHCPv6.c.o
[ 42%] Building C object _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_DNS_Parser.c.o
[ 43%] Building C object _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_ICMP.c.o
[ 46%] Building C object _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_ARP.c.o
[ 46%] Building C object _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_DNS_Networking.c.o
[ 50%] Building C object _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_IP_Timers.c.o
[ 51%] Building C object _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_IP.c.o
[ 53%] Building C object _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_IP_Utils.c.o
[ 48%] Building C object _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_DNS.c.o
In file included from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/FreeRTOS_BitConfig.c:37:
/home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_kernel-src/include/./task.h:184:19: error: comma at end of enumerator list [-Werror=pedantic]
184 | eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
| ^
In file included from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/FreeRTOS_DHCP.c:38:
/home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_kernel-src/include/./task.h:184:19: error: comma at end of enumerator list [-Werror=pedantic]
184 | eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
| ^
In file included from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/FreeRTOS_DHCPv6.c:37:
/home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_kernel-src/include/./task.h:184:19: error: comma at end of enumerator list [-Werror=pedantic]
184 | eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
| ^
In file included from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/include/FreeRTOS_IP.h:32,
from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/FreeRTOS_DNS_Cache.c:34:
/home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_kernel-src/include/./task.h:184:19: error: comma at end of enumerator list [-Werror=pedantic]
184 | eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
| ^
In file included from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/include/FreeRTOS_IP.h:32,
from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/include/FreeRTOS_DNS_Networking.h:30,
from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/FreeRTOS_DNS_Networking.c:36:
/home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_kernel-src/include/./task.h:184:19: error: comma at end of enumerator list [-Werror=pedantic]
184 | eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
| ^
In file included from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/include/FreeRTOS_IP.h:32,
from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/include/FreeRTOS_DNS_Callback.h:36,
from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/FreeRTOS_DNS_Callback.c:33:
/home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_kernel-src/include/./task.h:184:19: error: comma at end of enumerator list [-Werror=pedantic]
184 | eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
| ^
In file included from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/FreeRTOS_ARP.c:39:
/home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_kernel-src/include/./task.h:184:19: error: comma at end of enumerator list [-Werror=pedantic]
184 | eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
| ^
In file included from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/FreeRTOS_ICMP.c:40:
/home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_kernel-src/include/./task.h:184:19: error: comma at end of enumerator list [-Werror=pedantic]
184 | eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
| ^
cc1: all warnings being treated as errors
In file included from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/FreeRTOS_DNS.c:39:
/home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_kernel-src/include/./task.h:184:19: error: comma at end of enumerator list [-Werror=pedantic]
184 | eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
| ^
make[2]: *** [_deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/build.make:141: _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_DNS_Callback.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
cc1: all warnings being treated as errors
make[2]: *** [_deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/build.make:154: _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_DNS_Networking.c.o] Error 1
cc1: all warnings being treated as errors
cc1: all warnings being treated as errors
make[2]: *** [_deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/build.make:180: _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_ICMP.c.o] Error 1
make[2]: *** [_deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/build.make:102: _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_DHCPv6.c.o] Error 1
cc1: all warnings being treated as errors
make[2]: *** [_deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/build.make:128: _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_DNS_Cache.c.o] Error 1
In file included from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/include/FreeRTOS_IP.h:32,
from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/FreeRTOS_DNS_Parser.c:36:
/home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_kernel-src/include/./task.h:184:19: error: comma at end of enumerator list [-Werror=pedantic]
184 | eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
| ^
cc1: all warnings being treated as errors
make[2]: *** [_deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/build.make:76: _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_BitConfig.c.o] Error 1
In file included from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/FreeRTOS_IP.c:40:
/home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_kernel-src/include/./task.h:184:19: error: comma at end of enumerator list [-Werror=pedantic]
184 | eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
| ^
In file included from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/FreeRTOS_IP_Timers.c:40:
/home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_kernel-src/include/./task.h:184:19: error: comma at end of enumerator list [-Werror=pedantic]
184 | eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
| ^
cc1: all warnings being treated as errors
make[2]: *** [_deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/build.make:89: _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_DHCP.c.o] Error 1
cc1: all warnings being treated as errors
make[2]: *** [_deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/build.make:63: _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_ARP.c.o] Error 1
In file included from /home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_plus_tcp-src/source/FreeRTOS_IP_Utils.c:40:
/home/apcountryman/Downloads/freertos-plus-tcp-compilation-issues/build/_deps/freertos_kernel-src/include/./task.h:184:19: error: comma at end of enumerator list [-Werror=pedantic]
184 | eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
| ^
cc1: all warnings being treated as errors
make[2]: *** [_deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/build.make:115: _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_DNS.c.o] Error 1
cc1: all warnings being treated as errors
cc1: all warnings being treated as errors
make[2]: *** [_deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/build.make:206: _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_IP_Timers.c.o] Error 1
make[2]: *** [_deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/build.make:167: _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_DNS_Parser.c.o] Error 1
cc1: all warnings being treated as errors
make[2]: *** [_deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/build.make:193: _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_IP.c.o] Error 1
cc1: all warnings being treated as errors
make[2]: *** [_deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/build.make:219: _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/FreeRTOS_IP_Utils.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:840: _deps/freertos_plus_tcp-build/source/CMakeFiles/freertos_plus_tcp.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
I have determined the following so far:
- These compilation issues are not present in FreeRTOS-Plus-TCP’s CI build-checks which are using a newer version of GCC (11.4.0).
- The
test/build-combination/
directory is always included in a build (see FreeRTOS-Plus-TCP/test/CMakeLists.txt at 1bc37d3e901dc585217877f0adbf0c9f456c6c34 · FreeRTOS/FreeRTOS-Plus-TCP · GitHub). -Werror
and-Wpedantic
are enabled bytest/build-combination/CMakeLists.txt
(see FreeRTOS-Plus-TCP/test/build-combination/CMakeLists.txt at 1bc37d3e901dc585217877f0adbf0c9f456c6c34 · FreeRTOS/FreeRTOS-Plus-TCP · GitHub).- FreeRTOS-Plus-TCP suppresses
-Wpedantic
for somefreertos_plus_tcp
source files (but not all) in an attempt to get a clean build with GCC (see FreeRTOS-Plus-TCP/source/CMakeLists.txt at 1bc37d3e901dc585217877f0adbf0c9f456c6c34 · FreeRTOS/FreeRTOS-Plus-TCP · GitHub). - FreeRTOS-Plus-TCP sets the C standard used to compile
freertos_plus_tcp
to 90 (see FreeRTOS-Plus-TCP/source/CMakeLists.txt at 1bc37d3e901dc585217877f0adbf0c9f456c6c34 · FreeRTOS/FreeRTOS-Plus-TCP · GitHub). - Changing the C standard used to compile
freertos_plus_tcp
to 99 or later resolves the compilation issues. - Not setting the C standard used to compile
freertos_plus_tcp
(and thus using whatever is the compiler default) resolves the compilation issues. - FreeRTOS-Kernel no longer sets the C standard used to compile
freertos_kernel
due to issues encountered by consumers of FreeRTOS-Kernel when the C standard used to compilefreertos_kernel
was set to 90 (see Remove C90 requirement from CMakeLists by aggarg · Pull Request #649 · FreeRTOS/FreeRTOS-Kernel · GitHub).
Based on what I’ve determined, Move CMake compile options to test builds by apcountryman · Pull Request #1115 · FreeRTOS/FreeRTOS-Plus-TCP · GitHub did not fully resolve the overarching issue outlined in Override compile options set by FreeRTOS-Plus-TCP. To fully resolve this issue, consumers of FreeRTOS-Plus-TCP need to be able to fully control the compile options (including the C standard) used when building targets defined by FreeRTOS-Plus-TCP. This could be accomplished by making the following changes to FreeRTOS-Plus-TCP:
- Move the setting of the C standard used to compile
freertos_plus_tcp
totest/build-combination/CMakeLists.txt
. - Provide a mechanism that lets consumers of FreeRTOS-Plus-TCP exclude the
test/build-combinated/
directory from builds.
I would like to get feedback from the FreeRTOS-Plus-TCP maintainers on the issue I am encountering and the proposed path forward.