Skip to contentSkip to conversation

ot-br-posix: Fix Musl build error

PATCH In review [email protected] 3 participants 5 messages Dec 3, 2024 – Dec 6, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ot-br-posix: Fix Musl build error

From: "deepan.shivap" <[email protected]>

Mistakenly removed musl-fixes.patch in previous commit.

update & Include 0001-Musl-build-fix.patch based on latest upstream of ot-br-posix

Remove CXXFLAGS:append:libc-musl:toolchain-clang = " -Wno-error=sign-compare -Wno-error=unused-but-set-variable", as issue is not reproducible with current SRCREV of ot-br-posix.

---
 .../ot-br-posix/0001-Musl-build-fix.patch     | 27 +++++++++++++++++++
 .../openthread/ot-br-posix_git.bb             |  4 +--
 2 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 meta-networking/recipes-connectivity/openthread/ot-br-posix/0001-Musl-build-fix.patch
meta-networking/recipes-connectivity/openthread/ot-br-posix/0001-Musl-build-fix.patch new file +27 -0
new file mode 100644
index 000000000..108ed76b3
@@ -0,0 +1,27 @@
+From 502aa4ab4bbc790fb2999ff2b5f10dabd7085190 Mon Sep 17 00:00:00 2001
+From: "deepan.shivap" <[email protected]>
+Date: Mon, 2 Dec 2024 23:12:17 +0900
+Subject: [PATCH] Musl build fix
+
+usage of getaddrinfo_a creates dependency on libanl, which is  specific
+to glibc.
+
+Upstream-Status: Pending
+Signed-off-by: deepan.shivap <[email protected]>
+---
+ src/posix/platform/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/posix/platform/CMakeLists.txt b/src/posix/platform/CMakeLists.txt
+index b4ac241f5..7b2028e45 100644
+--- a/src/posix/platform/CMakeLists.txt
++++ b/src/posix/platform/CMakeLists.txt
+@@ -175,7 +175,7 @@ target_link_libraries(openthread-posix
+ )
+ 
+ option(OT_TARGET_OPENWRT "enable openthread posix for OpenWRT" OFF)
+-if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT OT_TARGET_OPENWRT)
++if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT OT_TARGET_OPENWRT AND NOT OT_TARGET_MUSL)
+     target_compile_definitions(ot-posix-config
+         INTERFACE "OPENTHREAD_POSIX_CONFIG_NAT64_AIL_PREFIX_ENABLE=1"
+     )
meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb +1 -3
index 8183f5203..f4c193a8e 100644
@@ -19,15 +19,13 @@ SRC_URI = "gitsm://github.com/openthread/ot-br-posix.git;protocol=https;branch=m
            file://0001-cmake-Disable-nonnull-compare-warning-on-gcc.patch \
            file://default-cxx-std.patch \
            file://0001-fix-build-on-GCC-14-for-yocto.patch;patchdir=third_party/openthread/repo \
+           file://0001-Musl-build-fix.patch;patchdir=third_party/openthread/repo \
            "
 
 S = "${WORKDIR}/git"
 SYSTEMD_SERVICE:${PN} = "otbr-agent.service"
 
 inherit pkgconfig cmake systemd
-# openthread/repo/src/cli/cli.cpp:1786:18: fatal error: variable 'i' set but not used [-Wunused-but-set-variable]
-#    for (uint8_t i = 0;; i++)
-CXXFLAGS:append:libc-musl:toolchain-clang = " -Wno-error=sign-compare -Wno-error=unused-but-set-variable"
 
 LDFLAGS:append:riscv32 = " -latomic"
 
Signature · 1 line
2.34.1
#1 lore raw
Quoted 60 lines · deepan.shivap via lists.openembedded.org

From: "deepan.shivap" <[email protected]>

Mistakenly removed musl-fixes.patch in previous commit.

update & Include 0001-Musl-build-fix.patch based on latest upstream of ot-br-posix

Remove CXXFLAGS:append:libc-musl:toolchain-clang = " -Wno-error=sign-compare -Wno-error=unused-but-set-variable", as issue is not reproducible with current SRCREV of ot-br-posix.

---
 .../ot-br-posix/0001-Musl-build-fix.patch     | 27 +++++++++++++++++++
 .../openthread/ot-br-posix_git.bb             |  4 +--
 2 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 meta-networking/recipes-connectivity/openthread/ot-br-posix/0001-Musl-build-fix.patch
meta-networking/recipes-connectivity/openthread/ot-br-posix/0001-Musl-build-fix.patch new file +27 -0
new file mode 100644
index 000000000..108ed76b3
@@ -0,0 +1,27 @@
+From 502aa4ab4bbc790fb2999ff2b5f10dabd7085190 Mon Sep 17 00:00:00 2001
+From: "deepan.shivap" <[email protected]>
+Date: Mon, 2 Dec 2024 23:12:17 +0900
+Subject: [PATCH] Musl build fix
+
+usage of getaddrinfo_a creates dependency on libanl, which is  specific
+to glibc.
+
+Upstream-Status: Pending
+Signed-off-by: deepan.shivap <[email protected]>
+---
+ src/posix/platform/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/posix/platform/CMakeLists.txt b/src/posix/platform/CMakeLists.txt
+index b4ac241f5..7b2028e45 100644
+--- a/src/posix/platform/CMakeLists.txt
++++ b/src/posix/platform/CMakeLists.txt
+@@ -175,7 +175,7 @@ target_link_libraries(openthread-posix
+ )
+
+ option(OT_TARGET_OPENWRT "enable openthread posix for OpenWRT" OFF)
+-if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT OT_TARGET_OPENWRT)
++if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT OT_TARGET_OPENWRT AND NOT OT_TARGET_MUSL)
+     target_compile_definitions(ot-posix-config
+         INTERFACE "OPENTHREAD_POSIX_CONFIG_NAT64_AIL_PREFIX_ENABLE=1"
+     )
meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb +1 -0
index 8183f5203..f4c193a8e 100644
@@ -19,15 +19,13 @@ SRC_URI = "gitsm://github.com/openthread/ot-br-posix.git;protocol=https;branch=m
            file://0001-cmake-Disable-nonnull-compare-warning-on-gcc.patch \
            file://default-cxx-std.patch \
            file://0001-fix-build-on-GCC-14-for-yocto.patch;patchdir=third_party/openthread/repo \
+           file://0001-Musl-build-fix.patch;patchdir=third_party/openthread/repo \

meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb SRC_URI = "gitsm://github.com/openthread/ot-br-posix.git;protocol=https;branch=m · line 29

Quoted 10 lines
meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb +0 -3
            "
 
 S = "${WORKDIR}/git"
 SYSTEMD_SERVICE:${PN} = "otbr-agent.service"
 
 inherit pkgconfig cmake systemd
-# openthread/repo/src/cli/cli.cpp:1786:18: fatal error: variable 'i' set but not used [-Wunused-but-set-variable]
-#    for (uint8_t i = 0;; i++)
-CXXFLAGS:append:libc-musl:toolchain-clang = " -Wno-error=sign-compare -Wno-error=unused-but-set-variable"
 

While this fixes one problem it exposes another error seen in couple of places

| /home/kraj01/yoe/build/tmp/work/riscv32-yoe-linux-musl/ot-br-posix/0.3.0+git/git/src/backbone_router/nd_proxy.cpp:187:67:
fatal error: comparison of integers of
↪ different signs: 'unsigned long' and 'int' [-Wsign-compare]
| 187 | for (cmsghdr = CMSG_FIRSTHDR(&msghdr); cmsghdr;
cmsghdr = CMSG_NXTHDR(&msghdr, cmsghdr))
| |

        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

| /home/kraj01/yoe/build/tmp/work/riscv32-yoe-linux-musl/ot-br-posix/0.3.0+git/recipe-sysroot/usr/include/sys/socket.h:358:44:
note: expanded from macro 'CMSG_NXTHDR'
↪
| 358 | __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >=
__MHDR_END(mhdr) - (unsigned char *)(cmsg) \
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 1 error generated.

Quoted 14 lines
meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb +0 -1
 LDFLAGS:append:riscv32 = " -latomic"
 
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#114179): https://lists.openembedded.org/g/openembedded-devel/message/114179
Mute This Topic: https://lists.openembedded.org/mt/109895644/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

I've asked to deepan to test it with musl, but not with musl+clang, so the CXXFLAGS:append:libc-musl:toolchain-clang line in the recipe is still needed (at least for the sign-compare, maybe both).

Deepan please send v2.

Quoted 112 lines · Khem Raj via lists.openembedded.org
Quoted 60 lines · deepan.shivap via lists.openembedded.org

From: "deepan.shivap" <[email protected]>

Mistakenly removed musl-fixes.patch in previous commit.

update & Include 0001-Musl-build-fix.patch based on latest upstream of ot-br-posix

Remove CXXFLAGS:append:libc-musl:toolchain-clang = " -Wno-error=sign-compare -Wno-error=unused-but-set-variable", as issue is not reproducible with current SRCREV of ot-br-posix.

---
 .../ot-br-posix/0001-Musl-build-fix.patch     | 27 +++++++++++++++++++
 .../openthread/ot-br-posix_git.bb             |  4 +--
 2 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 meta-networking/recipes-connectivity/openthread/ot-br-posix/0001-Musl-build-fix.patch
meta-networking/recipes-connectivity/openthread/ot-br-posix/0001-Musl-build-fix.patch new file +27 -0
new file mode 100644
index 000000000..108ed76b3
@@ -0,0 +1,27 @@
+From 502aa4ab4bbc790fb2999ff2b5f10dabd7085190 Mon Sep 17 00:00:00 2001
+From: "deepan.shivap" <[email protected]>
+Date: Mon, 2 Dec 2024 23:12:17 +0900
+Subject: [PATCH] Musl build fix
+
+usage of getaddrinfo_a creates dependency on libanl, which is  specific
+to glibc.
+
+Upstream-Status: Pending
+Signed-off-by: deepan.shivap <[email protected]>
+---
+ src/posix/platform/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/posix/platform/CMakeLists.txt b/src/posix/platform/CMakeLists.txt
+index b4ac241f5..7b2028e45 100644
+--- a/src/posix/platform/CMakeLists.txt
++++ b/src/posix/platform/CMakeLists.txt
+@@ -175,7 +175,7 @@ target_link_libraries(openthread-posix
+ )
+
+ option(OT_TARGET_OPENWRT "enable openthread posix for OpenWRT" OFF)
+-if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT OT_TARGET_OPENWRT)
++if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT OT_TARGET_OPENWRT AND NOT OT_TARGET_MUSL)
+     target_compile_definitions(ot-posix-config
+         INTERFACE "OPENTHREAD_POSIX_CONFIG_NAT64_AIL_PREFIX_ENABLE=1"
+     )
meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb +1 -0
index 8183f5203..f4c193a8e 100644
@@ -19,15 +19,13 @@ SRC_URI = "gitsm://github.com/openthread/ot-br-posix.git;protocol=https;branch=m
            file://0001-cmake-Disable-nonnull-compare-warning-on-gcc.patch \
            file://default-cxx-std.patch \
            file://0001-fix-build-on-GCC-14-for-yocto.patch;patchdir=third_party/openthread/repo \
+           file://0001-Musl-build-fix.patch;patchdir=third_party/openthread/repo \

meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb SRC_URI = "gitsm://github.com/openthread/ot-br-posix.git;protocol=https;branch=m · line 29

Quoted 10 lines
meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb +0 -3
            "
 
 S = "${WORKDIR}/git"
 SYSTEMD_SERVICE:${PN} = "otbr-agent.service"
 
 inherit pkgconfig cmake systemd
-# openthread/repo/src/cli/cli.cpp:1786:18: fatal error: variable 'i' set but not used [-Wunused-but-set-variable]
-#    for (uint8_t i = 0;; i++)
-CXXFLAGS:append:libc-musl:toolchain-clang = " -Wno-error=sign-compare -Wno-error=unused-but-set-variable"
 

While this fixes one problem it exposes another error seen in couple of places

| /home/kraj01/yoe/build/tmp/work/riscv32-yoe-linux-musl/ot-br-posix/0.3.0+git/git/src/backbone_router/nd_proxy.cpp:187:67:
fatal error: comparison of integers of
↪ different signs: 'unsigned long' and 'int' [-Wsign-compare]
| 187 | for (cmsghdr = CMSG_FIRSTHDR(&msghdr); cmsghdr;
cmsghdr = CMSG_NXTHDR(&msghdr, cmsghdr))
| |

        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

| /home/kraj01/yoe/build/tmp/work/riscv32-yoe-linux-musl/ot-br-posix/0.3.0+git/recipe-sysroot/usr/include/sys/socket.h:358:44:
note: expanded from macro 'CMSG_NXTHDR'
↪
| 358 | __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >=

__MHDR_END(mhdr) - (unsigned char *)(cmsg) \
   |       |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 1 error generated.

Quoted 8 lines
meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb +0 -1
 LDFLAGS:append:riscv32 = " -latomic"
 
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#114208): https://lists.openembedded.org/g/openembedded-devel/message/114208
Mute This Topic: https://lists.openembedded.org/mt/109895644/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
Quoted 6 lines · Martin Jansa

I've asked to deepan to test it with musl, but not with musl+clang, so the CXXFLAGS:append:libc-musl:toolchain-clang line in the recipe is still needed (at least for the sign-compare, maybe both).

Deepan please send v2.

I think a separate patch is in order since I have accepted v1. right way to fix might be to initialize msghdr elements individually see

https://git.openembedded.org/meta-openembedded/tree/meta-oe/recipes-extended/canopenterm/canopenterm/0001-can_linux-initialize-msghdr-in-a-portable-way.patch

this might be upstreamable as well.

Quoted 115 lines
Quoted 112 lines · Khem Raj via lists.openembedded.org
Quoted 60 lines · deepan.shivap via lists.openembedded.org

From: "deepan.shivap" <[email protected]>

Mistakenly removed musl-fixes.patch in previous commit.

update & Include 0001-Musl-build-fix.patch based on latest upstream of ot-br-posix

Remove CXXFLAGS:append:libc-musl:toolchain-clang = " -Wno-error=sign-compare -Wno-error=unused-but-set-variable", as issue is not reproducible with current SRCREV of ot-br-posix.

---
 .../ot-br-posix/0001-Musl-build-fix.patch     | 27 +++++++++++++++++++
 .../openthread/ot-br-posix_git.bb             |  4 +--
 2 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 meta-networking/recipes-connectivity/openthread/ot-br-posix/0001-Musl-build-fix.patch
meta-networking/recipes-connectivity/openthread/ot-br-posix/0001-Musl-build-fix.patch new file +27 -0
new file mode 100644
index 000000000..108ed76b3
@@ -0,0 +1,27 @@
+From 502aa4ab4bbc790fb2999ff2b5f10dabd7085190 Mon Sep 17 00:00:00 2001
+From: "deepan.shivap" <[email protected]>
+Date: Mon, 2 Dec 2024 23:12:17 +0900
+Subject: [PATCH] Musl build fix
+
+usage of getaddrinfo_a creates dependency on libanl, which is  specific
+to glibc.
+
+Upstream-Status: Pending
+Signed-off-by: deepan.shivap <[email protected]>
+---
+ src/posix/platform/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/posix/platform/CMakeLists.txt b/src/posix/platform/CMakeLists.txt
+index b4ac241f5..7b2028e45 100644
+--- a/src/posix/platform/CMakeLists.txt
++++ b/src/posix/platform/CMakeLists.txt
+@@ -175,7 +175,7 @@ target_link_libraries(openthread-posix
+ )
+
+ option(OT_TARGET_OPENWRT "enable openthread posix for OpenWRT" OFF)
+-if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT OT_TARGET_OPENWRT)
++if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT OT_TARGET_OPENWRT AND NOT OT_TARGET_MUSL)
+     target_compile_definitions(ot-posix-config
+         INTERFACE "OPENTHREAD_POSIX_CONFIG_NAT64_AIL_PREFIX_ENABLE=1"
+     )
meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb +1 -0
index 8183f5203..f4c193a8e 100644
@@ -19,15 +19,13 @@ SRC_URI = "gitsm://github.com/openthread/ot-br-posix.git;protocol=https;branch=m
            file://0001-cmake-Disable-nonnull-compare-warning-on-gcc.patch \
            file://default-cxx-std.patch \
            file://0001-fix-build-on-GCC-14-for-yocto.patch;patchdir=third_party/openthread/repo \
+           file://0001-Musl-build-fix.patch;patchdir=third_party/openthread/repo \

meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb SRC_URI = "gitsm://github.com/openthread/ot-br-posix.git;protocol=https;branch=m · line 29

Quoted 10 lines
meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb +0 -3
            "
 
 S = "${WORKDIR}/git"
 SYSTEMD_SERVICE:${PN} = "otbr-agent.service"
 
 inherit pkgconfig cmake systemd
-# openthread/repo/src/cli/cli.cpp:1786:18: fatal error: variable 'i' set but not used [-Wunused-but-set-variable]
-#    for (uint8_t i = 0;; i++)
-CXXFLAGS:append:libc-musl:toolchain-clang = " -Wno-error=sign-compare -Wno-error=unused-but-set-variable"
 

While this fixes one problem it exposes another error seen in couple of places

| /home/kraj01/yoe/build/tmp/work/riscv32-yoe-linux-musl/ot-br-posix/0.3.0+git/git/src/backbone_router/nd_proxy.cpp:187:67:
fatal error: comparison of integers of
↪ different signs: 'unsigned long' and 'int' [-Wsign-compare]
| 187 | for (cmsghdr = CMSG_FIRSTHDR(&msghdr); cmsghdr;
cmsghdr = CMSG_NXTHDR(&msghdr, cmsghdr))
| |

        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

| /home/kraj01/yoe/build/tmp/work/riscv32-yoe-linux-musl/ot-br-posix/0.3.0+git/recipe-sysroot/usr/include/sys/socket.h:358:44:
note: expanded from macro 'CMSG_NXTHDR'
↪
| 358 | __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >=

__MHDR_END(mhdr) - (unsigned char *)(cmsg) \
   |       |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 1 error generated.

Quoted 8 lines
meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb +0 -1
 LDFLAGS:append:riscv32 = " -latomic"
 
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#114208): https://lists.openembedded.org/g/openembedded-devel/message/114208
Mute This Topic: https://lists.openembedded.org/mt/109895644/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw
Quoted 7 lines · Khem Raj
Quoted 5 lines · Martin Jansa

I've asked to deepan to test it with musl, but not with musl+clang, so the CXXFLAGS:append:libc-musl:toolchain-clang line in the recipe is still needed (at least for the sign-compare, maybe both).

Quoted 9 lines
Quoted 1 line

Deepan please send v2.

I think a separate patch is in order since I have accepted v1. right way to fix might be to initialize msghdr elements individually see

https://git.openembedded.org/meta-openembedded/tree/meta-oe/recipes-extended/canopenterm/canopenterm/0001-can_linux-initialize-msghdr-in-a-portable-way.patch

this might be upstreamable as well.

meanwhile I have staged a fix in meta-clang
https://github.com/kraj/meta-clang/pull/1038

Quoted 115 lines
Quoted 115 lines
Quoted 112 lines · Khem Raj via lists.openembedded.org
Quoted 60 lines · deepan.shivap via lists.openembedded.org

From: "deepan.shivap" <[email protected]>

Mistakenly removed musl-fixes.patch in previous commit.

update & Include 0001-Musl-build-fix.patch based on latest upstream of ot-br-posix

Remove CXXFLAGS:append:libc-musl:toolchain-clang = " -Wno-error=sign-compare -Wno-error=unused-but-set-variable", as issue is not reproducible with current SRCREV of ot-br-posix.

---
 .../ot-br-posix/0001-Musl-build-fix.patch     | 27 +++++++++++++++++++
 .../openthread/ot-br-posix_git.bb             |  4 +--
 2 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 meta-networking/recipes-connectivity/openthread/ot-br-posix/0001-Musl-build-fix.patch
meta-networking/recipes-connectivity/openthread/ot-br-posix/0001-Musl-build-fix.patch new file +27 -0
new file mode 100644
index 000000000..108ed76b3
@@ -0,0 +1,27 @@
+From 502aa4ab4bbc790fb2999ff2b5f10dabd7085190 Mon Sep 17 00:00:00 2001
+From: "deepan.shivap" <[email protected]>
+Date: Mon, 2 Dec 2024 23:12:17 +0900
+Subject: [PATCH] Musl build fix
+
+usage of getaddrinfo_a creates dependency on libanl, which is  specific
+to glibc.
+
+Upstream-Status: Pending
+Signed-off-by: deepan.shivap <[email protected]>
+---
+ src/posix/platform/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/posix/platform/CMakeLists.txt b/src/posix/platform/CMakeLists.txt
+index b4ac241f5..7b2028e45 100644
+--- a/src/posix/platform/CMakeLists.txt
++++ b/src/posix/platform/CMakeLists.txt
+@@ -175,7 +175,7 @@ target_link_libraries(openthread-posix
+ )
+
+ option(OT_TARGET_OPENWRT "enable openthread posix for OpenWRT" OFF)
+-if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT OT_TARGET_OPENWRT)
++if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT OT_TARGET_OPENWRT AND NOT OT_TARGET_MUSL)
+     target_compile_definitions(ot-posix-config
+         INTERFACE "OPENTHREAD_POSIX_CONFIG_NAT64_AIL_PREFIX_ENABLE=1"
+     )
meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb +1 -0
index 8183f5203..f4c193a8e 100644
@@ -19,15 +19,13 @@ SRC_URI = "gitsm://github.com/openthread/ot-br-posix.git;protocol=https;branch=m
            file://0001-cmake-Disable-nonnull-compare-warning-on-gcc.patch \
            file://default-cxx-std.patch \
            file://0001-fix-build-on-GCC-14-for-yocto.patch;patchdir=third_party/openthread/repo \
+           file://0001-Musl-build-fix.patch;patchdir=third_party/openthread/repo \

meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb SRC_URI = "gitsm://github.com/openthread/ot-br-posix.git;protocol=https;branch=m · line 29

Quoted 10 lines
meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb +0 -3
            "
 
 S = "${WORKDIR}/git"
 SYSTEMD_SERVICE:${PN} = "otbr-agent.service"
 
 inherit pkgconfig cmake systemd
-# openthread/repo/src/cli/cli.cpp:1786:18: fatal error: variable 'i' set but not used [-Wunused-but-set-variable]
-#    for (uint8_t i = 0;; i++)
-CXXFLAGS:append:libc-musl:toolchain-clang = " -Wno-error=sign-compare -Wno-error=unused-but-set-variable"
 

While this fixes one problem it exposes another error seen in couple of places

| /home/kraj01/yoe/build/tmp/work/riscv32-yoe-linux-musl/ot-br-posix/0.3.0+git/git/src/backbone_router/nd_proxy.cpp:187:67:
fatal error: comparison of integers of
↪ different signs: 'unsigned long' and 'int' [-Wsign-compare]
| 187 | for (cmsghdr = CMSG_FIRSTHDR(&msghdr); cmsghdr;
cmsghdr = CMSG_NXTHDR(&msghdr, cmsghdr))
| |

        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

| /home/kraj01/yoe/build/tmp/work/riscv32-yoe-linux-musl/ot-br-posix/0.3.0+git/recipe-sysroot/usr/include/sys/socket.h:358:44:
note: expanded from macro 'CMSG_NXTHDR'
↪
| 358 | __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >=

__MHDR_END(mhdr) - (unsigned char *)(cmsg) \
   |       |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 1 error generated.

Quoted 8 lines
meta-networking/recipes-connectivity/openthread/ot-br-posix_git.bb +0 -1
 LDFLAGS:append:riscv32 = " -latomic"
 
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#114208): https://lists.openembedded.org/g/openembedded-devel/message/114208
Mute This Topic: https://lists.openembedded.org/mt/109895644/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-