]> code.ossystems Code Review - openembedded-core.git/commitdiff
ofono: prevent using bundled ell headers and fix build with ell-0.39
authorMartin Jansa <Martin.Jansa@gmail.com>
Wed, 21 Apr 2021 11:07:56 +0000 (13:07 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 23 Apr 2021 09:10:43 +0000 (10:10 +0100)
* -I../ofono-1.31 is included when building drivers/mbimmodem/mbim.c and then
  ell.h will happily include ell/util.h from there:

  # 1 "/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/ofono/1.31-r0/recipe-sysroot/usr/include/ell/ell.h" 1 3 4
  # 23 "/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/ofono/1.31-r0/recipe-sysroot/usr/include/ell/ell.h" 3 4
  # 1 "../ofono-1.31/ell/util.h" 1 3 4
  # 26 "../ofono-1.31/ell/util.h" 3 4
  # 1 "/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/ofono/1.31-r0/recipe-sysroot/usr/include/string.h" 1 3 4
  # 26 "/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/ofono/1.31-r0/recipe-sysroot/usr/include/string.h" 3 4
  # 1 "/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/ofono/1.31-r0/recipe-sysroot/usr/include/bits/libc-header-start.h" 1 3 4
  # 27 "/OE/build/oe-core/tmp-glibc/work/core2-64-oe-linux/ofono/1.31-r0/recipe-sysroot/usr/include/string.h" 2 3 4

* and it gets more interesting because unlikely() macro was dropped from ell/util.h in:
  https://git.kernel.org/pub/scm/libs/ell/ell.git/commit/?id=2a682421b06e41c45098217a686157f576847021
  and ofono builds from git (which doesn't bundle ell) were failing with:

drivers/mbimmodem/mbim-message.c: In function 'message_iter_next_entry_valist':
drivers/mbimmodem/mbim-message.c:504:8: warning: implicit declaration of function 'unlikely' [-Wimplicit-function-declaration]
  504 |    if (unlikely(indent > MAX_NESTING))
      |        ^~~~~~~~
...
x86_64-webos-linux-libtool: link: x86_64-webos-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=/OE/build/luneos-honister/webos-ports/tmp-glibc/work/core2-64-webos-linux/ofono/1.31+gitAUTOINC+0db662bd6b-r0/recipe-sysroot -I/OE/build/luneos-honister/webos-ports/tmp-glibc/work/core2-64-webos-linux/ofono/1.31+gitAUTOINC+0db662bd6b-r0/recipe-sysroot/usr/include/dbus-1.0 -I/OE/build/luneos-honister/webos-ports/tmp-glibc/work/core2-64-webos-linux/ofono/1.31+gitAUTOINC+0db662bd6b-r0/recipe-sysroot/usr/lib/dbus-1.0/include -I/OE/build/luneos-honister/webos-ports/tmp-glibc/work/core2-64-webos-linux/ofono/1.31+gitAUTOINC+0db662bd6b-r0/recipe-sysroot/usr/include/glib-2.0 -I/OE/build/luneos-honister/webos-ports/tmp-glibc/work/core2-64-webos-linux/ofono/1.31+gitAUTOINC+0db662bd6b-r0/recipe-sysroot/usr/lib/glib-2.0/include -DOFONO_PLUGIN_BUILTIN -DPLUGINDIR=\"/usr/lib/ofono/plugins\" -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/OE/build/luneos-honister/webos-ports/tmp-glibc/work/core2-64-webos-linux/ofono/1.31+gitAUTOINC+0db662bd6b-r0=/usr/src/debug/ofono/1.31+gitAUTOINC+0db662bd6b-r0 -fdebug-prefix-map=/OE/build/luneos-honister/webos-ports/tmp-glibc/work/core2-64-webos-linux/ofono/1.31+gitAUTOINC+0db662bd6b-r0=/usr/src/debug/ofono/1.31+gitAUTOINC+0db662bd6b-r0 -fdebug-prefix-map=/OE/build/luneos-honister/webos-ports/tmp-glibc/work/core2-64-webos-linux/ofono/1.31+gitAUTOINC+0db662bd6b-r0/recipe-sysroot= -fdebug-prefix-map=/OE/build/luneos-honister/webos-ports/tmp-glibc/work/core2-64-webos-linux/ofono/1.31+gitAUTOINC+0db662bd6b-r0/recipe-sysroot-native= -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o unit/test-mbim unit/test-mbim.o drivers/mbimmodem/mbim-message.o drivers/mbimmodem/mbim.o  -lell
drivers/mbimmodem/mbim-message.c:1389: error: undefined reference to 'unlikely'
drivers/mbimmodem/mbim-message.c:1255: error: undefined reference to 'unlikely'
drivers/mbimmodem/mbim-message.c:514: error: undefined reference to 'unlikely'
drivers/mbimmodem/mbim-message.c:504: error: undefined reference to 'unlikely'
collect2: error: ld returned 1 exit status

  while build from 1.31 tarball was passing OK, because using this older
  bundled ell/util.h

  delete bundled ell as we always enable external ell to make sure this
  doesn't happen again and fix mbimmodem to build with ell-0.39

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-connectivity/ofono/ofono/0002-mbim-Fix-build-with-ell-0.39-by-restoring-unlikely-m.patch [new file with mode: 0644]
meta/recipes-connectivity/ofono/ofono_1.31.bb

diff --git a/meta/recipes-connectivity/ofono/ofono/0002-mbim-Fix-build-with-ell-0.39-by-restoring-unlikely-m.patch b/meta/recipes-connectivity/ofono/ofono/0002-mbim-Fix-build-with-ell-0.39-by-restoring-unlikely-m.patch
new file mode 100644 (file)
index 0000000..3655b3f
--- /dev/null
@@ -0,0 +1,28 @@
+From 76e4054801350ebd4a44057379431a33d460ad0f Mon Sep 17 00:00:00 2001
+From: Martin Jansa <Martin.Jansa@gmail.com>
+Date: Wed, 21 Apr 2021 11:01:34 +0000
+Subject: [PATCH] mbim: Fix build with ell-0.39 by restoring unlikely macro
+ from ell/util.h
+
+Upstream-Status: Pending
+
+Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
+---
+ drivers/mbimmodem/mbim-private.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/drivers/mbimmodem/mbim-private.h b/drivers/mbimmodem/mbim-private.h
+index 51693eae..d917312c 100644
+--- a/drivers/mbimmodem/mbim-private.h
++++ b/drivers/mbimmodem/mbim-private.h
+@@ -30,6 +30,10 @@
+   __result; })
+ #endif
++/* used to be part of ell/util.h before 0.39:
++   https://git.kernel.org/pub/scm/libs/ell/ell.git/commit/?id=2a682421b06e41c45098217a686157f576847021 */
++#define unlikely(x) __builtin_expect(!!(x), 0)
++
+ enum mbim_control_message {
+       MBIM_OPEN_MSG = 0x1,
+       MBIM_CLOSE_MSG = 0x2,
index 7d0976ad7f569d1c1530e49f0b31ed2a10d0c3dc..2425ef76a646d62c9711f9eebc76b1590ff782ba 100644 (file)
@@ -11,6 +11,7 @@ SRC_URI = "\
     ${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
     file://ofono \
     file://0001-mbim-add-an-optional-TEMP_FAILURE_RETRY-macro-copy.patch \
+    file://0002-mbim-Fix-build-with-ell-0.39-by-restoring-unlikely-m.patch \
 "
 SRC_URI[md5sum] = "1c26340e3c6ed132cc812595081bb3dc"
 SRC_URI[sha256sum] = "a15c5d28096c10eb30e47a68b6dc2e7c4a5a99d7f4cfedf0b69624f33d859e9b"
@@ -30,9 +31,14 @@ PACKAGECONFIG[bluez] = "--enable-bluetooth, --disable-bluetooth, bluez5"
 
 EXTRA_OECONF += "--enable-test --enable-external-ell"
 
+do_configure_prepend() {
+    bbnote "Removing bundled ell from ${S}/ell to prevent including it"
+    rm -rf ${S}/ell
+}
+
 do_install_append() {
-  install -d ${D}${sysconfdir}/init.d/
-  install -m 0755 ${WORKDIR}/ofono ${D}${sysconfdir}/init.d/ofono
+    install -d ${D}${sysconfdir}/init.d/
+    install -m 0755 ${WORKDIR}/ofono ${D}${sysconfdir}/init.d/ofono
 }
 
 PACKAGES =+ "${PN}-tests"