Describe the bug
With some of the targets compilation fails with two implicit declaration of function errors. For example:
$ make clean
$ make micoair_h743-v2_default -j8
...
<path/to>/PX4-Autopilot/src/modules/uxrce_dds_client/Micro-XRCE-DDS-Client/src/c/profile/transport/ip/udp/udp_transport_posix.c: In function 'uxr_init_udp_platform':
<path/to>/PX4-Autopilot/src/modules/uxrce_dds_client/Micro-XRCE-DDS-Client/src/c/profile/transport/ip/udp/udp_transport_posix.c:46:18: error: implicit declaration of function 'getaddrinfo' [-Wimplicit-function-declaration]
46 | if (0 == getaddrinfo(ip, port, &hints, &result))
| ^~~~~~~~~~~
<path/to>/PX4-Autopilot/src/modules/uxrce_dds_client/Micro-XRCE-DDS-Client/src/c/profile/transport/ip/udp/udp_transport_posix.c:57:13: error: implicit declaration of function 'freeaddrinfo' [-Wimplicit-function-declaration]
57 | freeaddrinfo(result);
| ^~~~~~~~~~~~
Both getaddrinfo() and freeaddrinfo() function require NuttX with NETDB support to be enabled.
include/netdb.h#L286-L296
Which defaults to false.
libs/libc/netdb/Kconfig#L6-L8
I though the problem could be fixed adding CONFIG_LIBC_NETDB=y to nsh/defconfig for the given board. This does not work because the KConfig file does not include prompt for CONFIG_LIBC_NETDB.
Workaround is to enable a feature such as CONFIG_NETDB_HOSTFILE=y which then automatically sets CONFIG_LIBC_NETDB=y and compiling then succeeds.
libs/libc/netdb/Kconfig#L33-L36
Or if you are not using ROS you could just disable the uxrce_dds_client module with:
CONFIG_MODULES_UXRCE_DDS_CLIENT=n
I have two questions.
-
Is nsh/defconfig file the correct place to fix the problem?
-
Should netdb/Kconfig be patched so that directly setting CONFIG_LIBC_NETDB=y via nsh/defconfig would work?
To Reproduce
$ cd PX4-Autopilot
$ make clean
$ make micoair_h743-v2_default -j8
Describe the bug
With some of the targets compilation fails with two
implicit declaration of functionerrors. For example:Both
getaddrinfo()andfreeaddrinfo()function require NuttX with NETDB support to be enabled.include/netdb.h#L286-L296
Which defaults to false.
libs/libc/netdb/Kconfig#L6-L8
I though the problem could be fixed adding
CONFIG_LIBC_NETDB=ytonsh/defconfigfor the given board. This does not work because the KConfig file does not include prompt forCONFIG_LIBC_NETDB.Workaround is to enable a feature such as
CONFIG_NETDB_HOSTFILE=ywhich then automatically setsCONFIG_LIBC_NETDB=yand compiling then succeeds.libs/libc/netdb/Kconfig#L33-L36
Or if you are not using ROS you could just disable the
uxrce_dds_clientmodule with:I have two questions.
Is
nsh/defconfigfile the correct place to fix the problem?Should netdb/Kconfig be patched so that directly setting
CONFIG_LIBC_NETDB=yviansh/defconfigwould work?To Reproduce