diff mbox series

[1/1] Fix implicit declaration of function 'htobe64' in gcc 14 on musl systems

Message ID 20240514063811.383371-1-brahmajit.xyz@gmail.com (mailing list archive)
State Not Applicable
Headers show
Series [1/1] Fix implicit declaration of function 'htobe64' in gcc 14 on musl systems | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Brahmajit Das May 14, 2024, 6:35 a.m. UTC
On musl systems with GCC 14 and above, the htobe64 function cannot be
found by default. From the man page[0], the function is from endian.h
header file. If the file is not included in, then we get the following
error message. The issue however cannot be reproduced on glibc systems.

In file included from ../include/libgenl.h:5,
                 from libgenl.c:12:
../include/libnetlink.h: In function 'rta_getattr_be64':
../include/libnetlink.h:281:16: error: implicit declaration of function 'htobe64' [-Wimplicit-function-declaration]
  281 |         return htobe64(rta_getattr_u64(rta));
      |                ^~~~~~~
make[1]: *** [../config.include:24: libgenl.o] Error 1

[0]: https://linux.die.net/man/3/htobe64

Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
---
 include/libnetlink.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Stephen Hemminger May 14, 2024, 3:43 p.m. UTC | #1
On Tue, 14 May 2024 06:35:37 +0000
Brahmajit Das <brahmajit.xyz@gmail.com> wrote:

> On musl systems with GCC 14 and above, the htobe64 function cannot be
> found by default. From the man page[0], the function is from endian.h
> header file. If the file is not included in, then we get the following
> error message. The issue however cannot be reproduced on glibc systems.
> 
> In file included from ../include/libgenl.h:5,
>                  from libgenl.c:12:
> ../include/libnetlink.h: In function 'rta_getattr_be64':
> ../include/libnetlink.h:281:16: error: implicit declaration of function 'htobe64' [-Wimplicit-function-declaration]
>   281 |         return htobe64(rta_getattr_u64(rta));
>       |                ^~~~~~~
> make[1]: *** [../config.include:24: libgenl.o] Error 1
> 
> [0]: https://linux.die.net/man/3/htobe64
> 
> Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>


Fixes: 976dca372e4c ("f_flower: implement pfcp opts")
diff mbox series

Patch

diff --git a/include/libnetlink.h b/include/libnetlink.h
index 30f0c2d2..77e81815 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -12,6 +12,7 @@ 
 #include <linux/neighbour.h>
 #include <linux/netconf.h>
 #include <arpa/inet.h>
+#include <endian.h>
 
 struct rtnl_handle {
 	int			fd;