diff mbox series

[meta-oe] libnfs: dont install libnfs-config.cmake

Message ID 20230928233623.767530-1-f_l_k@t-online.de
State Under Review
Headers show
Series [meta-oe] libnfs: dont install libnfs-config.cmake | expand

Commit Message

Markus Volk Sept. 28, 2023, 11:36 p.m. UTC
kodi uses its own FindNFS.cmake	to find	libnfs and succeeds with pkgconfig.
If libnfs-config.cmake is found it will also be utilized (for win/mac?)
which is generally bad for cross-compiling and causes the prefix to get hardcoded
to /usr thus libnfs.so.5.0.2 is taken from the host machine

Removing this file fixes:
| aarch64-poky-linux-ld.lld: error: /usr/lib/libnfs.so.5.0.2 is incompatible with elf64-littleaarch64
| aarch64-poky-linux-clang++: error: linker command failed with exit code 1 (use -v to see invocation)
| ninja: build stopped: subcommand failed.

Add CFLAG workaround to fix compiling with clang complaining about
old coding style while gcc doesn't care.

Signed-off-by: Markus Volk <f_l_k@t-online.de>
---
 meta-oe/recipes-connectivity/libnfs/libnfs_5.0.2.bb | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Comments

Khem Raj Sept. 29, 2023, 6 p.m. UTC | #1
On Thu, Sep 28, 2023 at 4:36 PM Markus Volk <f_l_k@t-online.de> wrote:
>
> kodi uses its own FindNFS.cmake to find libnfs and succeeds with pkgconfig.
> If libnfs-config.cmake is found it will also be utilized (for win/mac?)
> which is generally bad for cross-compiling and causes the prefix to get hardcoded
> to /usr thus libnfs.so.5.0.2 is taken from the host machine
>
> Removing this file fixes:
> | aarch64-poky-linux-ld.lld: error: /usr/lib/libnfs.so.5.0.2 is incompatible with elf64-littleaarch64
> | aarch64-poky-linux-clang++: error: linker command failed with exit code 1 (use -v to see invocation)
> | ninja: build stopped: subcommand failed.
>
> Add CFLAG workaround to fix compiling with clang complaining about
> old coding style while gcc doesn't care.
>
> Signed-off-by: Markus Volk <f_l_k@t-online.de>
> ---
>  meta-oe/recipes-connectivity/libnfs/libnfs_5.0.2.bb | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/meta-oe/recipes-connectivity/libnfs/libnfs_5.0.2.bb b/meta-oe/recipes-connectivity/libnfs/libnfs_5.0.2.bb
> index e0df18a50..a025189b8 100644
> --- a/meta-oe/recipes-connectivity/libnfs/libnfs_5.0.2.bb
> +++ b/meta-oe/recipes-connectivity/libnfs/libnfs_5.0.2.bb
> @@ -3,10 +3,18 @@ HOMEPAGE = "https://github.com/sahlberg/libnfs"
>  LICENSE = "LGPL-2.1-only & BSD-2-Clause & GPL-3.0-only"
>  LIC_FILES_CHKSUM = "file://COPYING;md5=825301ba17efc9d188ee0abd4b924ada"
>
> -SRC_URI = "git://github.com/sahlberg/libnfs.git;protocol=https;branch=master \
> -    file://0001-CMakeLists.txt-respect-CMAKE_INSTALL_LIBDIR-for-mult.patch \
> +SRC_URI = " \
> +       git://github.com/sahlberg/libnfs.git;protocol=https;branch=master \
> +       file://0001-CMakeLists.txt-respect-CMAKE_INSTALL_LIBDIR-for-mult.patch \
>  "
>  SRCREV = "40348f45d6beb8a8f50b6b63414a98fc1a061b7d"
>  S = "${WORKDIR}/git"
>
>  inherit cmake
> +
> +do_install:append() {
> +       rm -f ${D}${libdir}/cmake/libnfs/libnfs-config.cmake
> +}
> +
> +# Workaround for clang
> +CFLAGS += "-Wno-implicit-function-declaration"

I was curious what the real failure is underneath, so I removed it
locally with clang and it seems to work for couple of arches
arm64/x86_64
so I wonder how to reproduce the error this option suppresses.

> --
> 2.42.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#105230): https://lists.openembedded.org/g/openembedded-devel/message/105230
> Mute This Topic: https://lists.openembedded.org/mt/101648795/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Markus Volk Sept. 29, 2023, 9:58 p.m. UTC | #2
On Fri, Sep 29 2023 at 11:00:33 AM -07:00:00, Khem Raj 
<raj.khem@gmail.com> wrote:
> so I wonder how to reproduce the error this option suppresses.

I encountered both issues when building for aarch64 raspberrypi4 with 
up to date branches.

The first one happens to me, if I try to build recent kodi for other 
platforms than host
<https://github.com/xbmc/xbmc/blob/c94910c9671755ff5a2425c322c9ec5f4a0ed576/cmake/modules/FindNFS.cmake#L32>

and the second issue was that libnfs stopped build with clang because 
of implicit-function-declaration. As far as i remember its been here
<https://github.com/sahlberg/libnfs/blob/4755490afcd8f79421ece560a0b0ee98cf41846a/lib/socket.c#L301>
Markus Volk Sept. 29, 2023, 10:34 p.m. UTC | #3
On Fri, Sep 29 2023 at 11:00:33 AM -07:00:00, Khem Raj 
<raj.khem@gmail.com> wrote:
> so I removed it
> locally with clang and it seems to work for couple of arches
> arm64/x86_64

Should I send a v2 and remove the CFLAG? Since you can build for arm64, 
maybe the problem is on my side?
I am not really in need of this hack. clang17 also still has some minor 
issues with onevpl from meta-intel. Nothing major, but there are still 
enough minor issues to keep me from using clang toolchain regulary.
diff mbox series

Patch

diff --git a/meta-oe/recipes-connectivity/libnfs/libnfs_5.0.2.bb b/meta-oe/recipes-connectivity/libnfs/libnfs_5.0.2.bb
index e0df18a50..a025189b8 100644
--- a/meta-oe/recipes-connectivity/libnfs/libnfs_5.0.2.bb
+++ b/meta-oe/recipes-connectivity/libnfs/libnfs_5.0.2.bb
@@ -3,10 +3,18 @@  HOMEPAGE = "https://github.com/sahlberg/libnfs"
 LICENSE = "LGPL-2.1-only & BSD-2-Clause & GPL-3.0-only"
 LIC_FILES_CHKSUM = "file://COPYING;md5=825301ba17efc9d188ee0abd4b924ada"
 
-SRC_URI = "git://github.com/sahlberg/libnfs.git;protocol=https;branch=master \
-    file://0001-CMakeLists.txt-respect-CMAKE_INSTALL_LIBDIR-for-mult.patch \
+SRC_URI = " \
+	git://github.com/sahlberg/libnfs.git;protocol=https;branch=master \
+	file://0001-CMakeLists.txt-respect-CMAKE_INSTALL_LIBDIR-for-mult.patch \
 "
 SRCREV = "40348f45d6beb8a8f50b6b63414a98fc1a061b7d"
 S = "${WORKDIR}/git"
 
 inherit cmake
+
+do_install:append() {
+	rm -f ${D}${libdir}/cmake/libnfs/libnfs-config.cmake
+}
+
+# Workaround for clang
+CFLAGS += "-Wno-implicit-function-declaration"