libsdl2: Disable libunwind dependency in native builds

Message ID 20220329075101.3085897-1-crg7475@mailbox.org
State Accepted, archived
Commit ecd044b09f8715353cbf20b39ce2b1fe9e620631
Headers show
Series libsdl2: Disable libunwind dependency in native builds | expand

Commit Message

Carlos Rafael Giani March 29, 2022, 7:51 a.m. UTC
libunwind-native currently cannot be added to the class-native DEPENDS
due to the following problem:

https://autobuilder.yoctoproject.org/typhoon/#/builders/91/builds/5624/steps/12/logs/stdio

And without libunwind-native, libsdl2-native config fails errors like:

| -- Checking for one of the modules 'libunwind'
| CMake Error at [...]/build/tmp/work/x86_64-linux/libsdl2-native/2.0.20-r0/recipe-sysroot-native/usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:890 (message):
|   None of the required 'libunwind' found
| Call Stack (most recent call first):
|   CMakeLists.txt:1367 (pkg_search_module)

Ideally, the libunwind issue would be fixed, and then this could be added
to the libsdl2 recipe:

DEPENDS:append:class-native = " libunwind-native"

However, the libunwind problem is not trivial to fix, and requires a
specific setup to reproduce. As an alternative workaround, turn off
libunwind support in the native SDL2 build by disabling the unwind.h
check in the CMake script (this subsequently turns off all the other
libunwind checks). The main user of libsdl2-native is qemu-native, which
does not need libunwind support in SDL2.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
---
 ...d-in-native-OE-builds-by-not-looking.patch | 38 +++++++++++++++++++
 .../libsdl2/libsdl2_2.0.20.bb                 |  1 +
 2 files changed, 39 insertions(+)
 create mode 100644 meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch

Comments

Alexander Kanavin March 29, 2022, 8:35 p.m. UTC | #1
Is this specific to some particular host setup? If so, it needs to be
said in the commit message, so we know when it is safe to drop this
patch.

Alex

On Tue, 29 Mar 2022 at 09:52, Carlos Rafael Giani via
lists.openembedded.org <crg7475=mailbox.org@lists.openembedded.org>
wrote:
>
> libunwind-native currently cannot be added to the class-native DEPENDS
> due to the following problem:
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/91/builds/5624/steps/12/logs/stdio
>
> And without libunwind-native, libsdl2-native config fails errors like:
>
> | -- Checking for one of the modules 'libunwind'
> | CMake Error at [...]/build/tmp/work/x86_64-linux/libsdl2-native/2.0.20-r0/recipe-sysroot-native/usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:890 (message):
> |   None of the required 'libunwind' found
> | Call Stack (most recent call first):
> |   CMakeLists.txt:1367 (pkg_search_module)
>
> Ideally, the libunwind issue would be fixed, and then this could be added
> to the libsdl2 recipe:
>
> DEPENDS:append:class-native = " libunwind-native"
>
> However, the libunwind problem is not trivial to fix, and requires a
> specific setup to reproduce. As an alternative workaround, turn off
> libunwind support in the native SDL2 build by disabling the unwind.h
> check in the CMake script (this subsequently turns off all the other
> libunwind checks). The main user of libsdl2-native is qemu-native, which
> does not need libunwind support in SDL2.
>
> Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
> ---
>  ...d-in-native-OE-builds-by-not-looking.patch | 38 +++++++++++++++++++
>  .../libsdl2/libsdl2_2.0.20.bb                 |  1 +
>  2 files changed, 39 insertions(+)
>  create mode 100644 meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch
>
> diff --git a/meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch b/meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch
> new file mode 100644
> index 0000000000..214664f621
> --- /dev/null
> +++ b/meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch
> @@ -0,0 +1,38 @@
> +From 50c691e83f81b235bb96ef996dd4568ffaae256f Mon Sep 17 00:00:00 2001
> +From: Carlos Rafael Giani <crg7475@mailbox.org>
> +Date: Fri, 18 Mar 2022 12:06:23 +0100
> +Subject: [PATCH] Disable libunwind in native OE builds by not looking for
> + libunwind
> +
> +This is a workaround for this build error:
> +
> +| -- Checking for one of the modules 'libunwind'
> +| CMake Error at [...]/build/tmp/work/x86_64-linux/libsdl2-native/2.0.20-r0/recipe-sysroot-native/usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:890 (message):
> +|   None of the required 'libunwind' found
> +| Call Stack (most recent call first):
> +|   CMakeLists.txt:1367 (pkg_search_module)
> +
> +By not looking for the libunwind header, the rest of the libunwind
> +specific bits in the CMake build script are disabled.
> +
> +Upstream-Status: Inappropriate [OE specific]
> +---
> + CMakeLists.txt | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +index 64f9fbf..12a4d8f 100644
> +--- a/CMakeLists.txt
> ++++ b/CMakeLists.txt
> +@@ -862,7 +862,7 @@ if(SDL_LIBC)
> +     check_include_file(sys/types.h HAVE_SYS_TYPES_H)
> +     foreach(_HEADER
> +             stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h limits.h float.h
> +-            strings.h wchar.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h libunwind.h)
> ++            strings.h wchar.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h)
> +       string(TOUPPER "HAVE_${_HEADER}" _UPPER)
> +       string(REPLACE "." "_" _HAVE_H ${_UPPER})
> +       check_include_file("${_HEADER}" ${_HAVE_H})
> +--
> +2.32.0
> +
> diff --git a/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb b/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb
> index 58bc94cc86..4ba22c1fe6 100644
> --- a/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb
> +++ b/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb
> @@ -20,6 +20,7 @@ SRC_URI = "http://www.libsdl.org/release/SDL2-${PV}.tar.gz \
>             file://optional-libunwind-generic.patch \
>             file://0001-sdlchecks.cmake-pass-cflags-to-the-appropriate-cmake.patch \
>             "
> +SRC_URI:append:class-native = " file://0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch"
>
>  S = "${WORKDIR}/SDL2-${PV}"
>
> --
> 2.32.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#163739): https://lists.openembedded.org/g/openembedded-core/message/163739
> Mute This Topic: https://lists.openembedded.org/mt/90103750/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Carlos Rafael Giani March 31, 2022, 8:52 a.m. UTC | #2
I can only report my own host setup, which is Ubuntu 21.10 x86-64. 
libsdl2-native fails to build 100% of the time on this host.

On 29.03.22 22:35, Alexander Kanavin wrote:
> Is this specific to some particular host setup? If so, it needs to be
> said in the commit message, so we know when it is safe to drop this
> patch.
>
> Alex
>
> On Tue, 29 Mar 2022 at 09:52, Carlos Rafael Giani via
> lists.openembedded.org<crg7475=mailbox.org@lists.openembedded.org>
> wrote:
>> libunwind-native currently cannot be added to the class-native DEPENDS
>> due to the following problem:
>>
>> https://autobuilder.yoctoproject.org/typhoon/#/builders/91/builds/5624/steps/12/logs/stdio
>>
>> And without libunwind-native, libsdl2-native config fails errors like:
>>
>> | -- Checking for one of the modules 'libunwind'
>> | CMake Error at [...]/build/tmp/work/x86_64-linux/libsdl2-native/2.0.20-r0/recipe-sysroot-native/usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:890 (message):
>> |   None of the required 'libunwind' found
>> | Call Stack (most recent call first):
>> |   CMakeLists.txt:1367 (pkg_search_module)
>>
>> Ideally, the libunwind issue would be fixed, and then this could be added
>> to the libsdl2 recipe:
>>
>> DEPENDS:append:class-native = " libunwind-native"
>>
>> However, the libunwind problem is not trivial to fix, and requires a
>> specific setup to reproduce. As an alternative workaround, turn off
>> libunwind support in the native SDL2 build by disabling the unwind.h
>> check in the CMake script (this subsequently turns off all the other
>> libunwind checks). The main user of libsdl2-native is qemu-native, which
>> does not need libunwind support in SDL2.
>>
>> Signed-off-by: Carlos Rafael Giani<crg7475@mailbox.org>
>> ---
>>   ...d-in-native-OE-builds-by-not-looking.patch | 38 +++++++++++++++++++
>>   .../libsdl2/libsdl2_2.0.20.bb                 |  1 +
>>   2 files changed, 39 insertions(+)
>>   create mode 100644 meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch
>>
>> diff --git a/meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch b/meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch
>> new file mode 100644
>> index 0000000000..214664f621
>> --- /dev/null
>> +++ b/meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch
>> @@ -0,0 +1,38 @@
>> +From 50c691e83f81b235bb96ef996dd4568ffaae256f Mon Sep 17 00:00:00 2001
>> +From: Carlos Rafael Giani<crg7475@mailbox.org>
>> +Date: Fri, 18 Mar 2022 12:06:23 +0100
>> +Subject: [PATCH] Disable libunwind in native OE builds by not looking for
>> + libunwind
>> +
>> +This is a workaround for this build error:
>> +
>> +| -- Checking for one of the modules 'libunwind'
>> +| CMake Error at [...]/build/tmp/work/x86_64-linux/libsdl2-native/2.0.20-r0/recipe-sysroot-native/usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:890 (message):
>> +|   None of the required 'libunwind' found
>> +| Call Stack (most recent call first):
>> +|   CMakeLists.txt:1367 (pkg_search_module)
>> +
>> +By not looking for the libunwind header, the rest of the libunwind
>> +specific bits in the CMake build script are disabled.
>> +
>> +Upstream-Status: Inappropriate [OE specific]
>> +---
>> + CMakeLists.txt | 2 +-
>> + 1 file changed, 1 insertion(+), 1 deletion(-)
>> +
>> +diff --git a/CMakeLists.txt b/CMakeLists.txt
>> +index 64f9fbf..12a4d8f 100644
>> +--- a/CMakeLists.txt
>> ++++ b/CMakeLists.txt
>> +@@ -862,7 +862,7 @@ if(SDL_LIBC)
>> +     check_include_file(sys/types.h HAVE_SYS_TYPES_H)
>> +     foreach(_HEADER
>> +             stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h limits.h float.h
>> +-            strings.h wchar.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h libunwind.h)
>> ++            strings.h wchar.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h)
>> +       string(TOUPPER "HAVE_${_HEADER}" _UPPER)
>> +       string(REPLACE "." "_" _HAVE_H ${_UPPER})
>> +       check_include_file("${_HEADER}" ${_HAVE_H})
>> +--
>> +2.32.0
>> +
>> diff --git a/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb b/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb
>> index 58bc94cc86..4ba22c1fe6 100644
>> --- a/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb
>> +++ b/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb
>> @@ -20,6 +20,7 @@ SRC_URI ="http://www.libsdl.org/release/SDL2-${PV}.tar.gz \ 
>> file://optional-libunwind-generic.patch \ 
>> file://0001-sdlchecks.cmake-pass-cflags-to-the-appropriate-cmake.patch 
>> \ "
>> +SRC_URI:append:class-native =" file://0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch"
>>
>>   S = "${WORKDIR}/SDL2-${PV}"
>>
>> --
>> 2.32.0
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#163739):https://lists.openembedded.org/g/openembedded-core/message/163739
>> Mute This Topic:https://lists.openembedded.org/mt/90103750/1686489
>> Group Owner:openembedded-core+owner@lists.openembedded.org
>> Unsubscribe:https://lists.openembedded.org/g/openembedded-core/unsub  [alex.kanavin@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
Alexander Kanavin March 31, 2022, 10:16 a.m. UTC | #3
But the autobuilder does have a 21.10 worker, and the problem isn't
happening there, or is it?

Alex

On Thu, 31 Mar 2022 at 10:52, Carlos Rafael Giani <crg7475@mailbox.org> wrote:
>
> I can only report my own host setup, which is Ubuntu 21.10 x86-64. libsdl2-native fails to build 100% of the time on this host.
>
> On 29.03.22 22:35, Alexander Kanavin wrote:
>
> Is this specific to some particular host setup? If so, it needs to be
> said in the commit message, so we know when it is safe to drop this
> patch.
>
> Alex
>
> On Tue, 29 Mar 2022 at 09:52, Carlos Rafael Giani via
> lists.openembedded.org <crg7475=mailbox.org@lists.openembedded.org>
> wrote:
>
> libunwind-native currently cannot be added to the class-native DEPENDS
> due to the following problem:
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/91/builds/5624/steps/12/logs/stdio
>
> And without libunwind-native, libsdl2-native config fails errors like:
>
> | -- Checking for one of the modules 'libunwind'
> | CMake Error at [...]/build/tmp/work/x86_64-linux/libsdl2-native/2.0.20-r0/recipe-sysroot-native/usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:890 (message):
> |   None of the required 'libunwind' found
> | Call Stack (most recent call first):
> |   CMakeLists.txt:1367 (pkg_search_module)
>
> Ideally, the libunwind issue would be fixed, and then this could be added
> to the libsdl2 recipe:
>
> DEPENDS:append:class-native = " libunwind-native"
>
> However, the libunwind problem is not trivial to fix, and requires a
> specific setup to reproduce. As an alternative workaround, turn off
> libunwind support in the native SDL2 build by disabling the unwind.h
> check in the CMake script (this subsequently turns off all the other
> libunwind checks). The main user of libsdl2-native is qemu-native, which
> does not need libunwind support in SDL2.
>
> Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
> ---
>  ...d-in-native-OE-builds-by-not-looking.patch | 38 +++++++++++++++++++
>  .../libsdl2/libsdl2_2.0.20.bb                 |  1 +
>  2 files changed, 39 insertions(+)
>  create mode 100644 meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch
>
> diff --git a/meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch b/meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch
> new file mode 100644
> index 0000000000..214664f621
> --- /dev/null
> +++ b/meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch
> @@ -0,0 +1,38 @@
> +From 50c691e83f81b235bb96ef996dd4568ffaae256f Mon Sep 17 00:00:00 2001
> +From: Carlos Rafael Giani <crg7475@mailbox.org>
> +Date: Fri, 18 Mar 2022 12:06:23 +0100
> +Subject: [PATCH] Disable libunwind in native OE builds by not looking for
> + libunwind
> +
> +This is a workaround for this build error:
> +
> +| -- Checking for one of the modules 'libunwind'
> +| CMake Error at [...]/build/tmp/work/x86_64-linux/libsdl2-native/2.0.20-r0/recipe-sysroot-native/usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:890 (message):
> +|   None of the required 'libunwind' found
> +| Call Stack (most recent call first):
> +|   CMakeLists.txt:1367 (pkg_search_module)
> +
> +By not looking for the libunwind header, the rest of the libunwind
> +specific bits in the CMake build script are disabled.
> +
> +Upstream-Status: Inappropriate [OE specific]
> +---
> + CMakeLists.txt | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +index 64f9fbf..12a4d8f 100644
> +--- a/CMakeLists.txt
> ++++ b/CMakeLists.txt
> +@@ -862,7 +862,7 @@ if(SDL_LIBC)
> +     check_include_file(sys/types.h HAVE_SYS_TYPES_H)
> +     foreach(_HEADER
> +             stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h limits.h float.h
> +-            strings.h wchar.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h libunwind.h)
> ++            strings.h wchar.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h)
> +       string(TOUPPER "HAVE_${_HEADER}" _UPPER)
> +       string(REPLACE "." "_" _HAVE_H ${_UPPER})
> +       check_include_file("${_HEADER}" ${_HAVE_H})
> +--
> +2.32.0
> +
> diff --git a/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb b/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb
> index 58bc94cc86..4ba22c1fe6 100644
> --- a/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb
> +++ b/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb
> @@ -20,6 +20,7 @@ SRC_URI = "http://www.libsdl.org/release/SDL2-${PV}.tar.gz \
>             file://optional-libunwind-generic.patch \
>             file://0001-sdlchecks.cmake-pass-cflags-to-the-appropriate-cmake.patch \
>             "
> +SRC_URI:append:class-native = " file://0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch"
>
>  S = "${WORKDIR}/SDL2-${PV}"
>
> --
> 2.32.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#163739): https://lists.openembedded.org/g/openembedded-core/message/163739
> Mute This Topic: https://lists.openembedded.org/mt/90103750/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>

Patch

diff --git a/meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch b/meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch
new file mode 100644
index 0000000000..214664f621
--- /dev/null
+++ b/meta/recipes-graphics/libsdl2/libsdl2/0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch
@@ -0,0 +1,38 @@ 
+From 50c691e83f81b235bb96ef996dd4568ffaae256f Mon Sep 17 00:00:00 2001
+From: Carlos Rafael Giani <crg7475@mailbox.org>
+Date: Fri, 18 Mar 2022 12:06:23 +0100
+Subject: [PATCH] Disable libunwind in native OE builds by not looking for
+ libunwind
+
+This is a workaround for this build error:
+
+| -- Checking for one of the modules 'libunwind'
+| CMake Error at [...]/build/tmp/work/x86_64-linux/libsdl2-native/2.0.20-r0/recipe-sysroot-native/usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:890 (message):
+|   None of the required 'libunwind' found
+| Call Stack (most recent call first):
+|   CMakeLists.txt:1367 (pkg_search_module)
+
+By not looking for the libunwind header, the rest of the libunwind
+specific bits in the CMake build script are disabled.
+
+Upstream-Status: Inappropriate [OE specific]
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 64f9fbf..12a4d8f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -862,7 +862,7 @@ if(SDL_LIBC)
+     check_include_file(sys/types.h HAVE_SYS_TYPES_H)
+     foreach(_HEADER
+             stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h limits.h float.h
+-            strings.h wchar.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h libunwind.h)
++            strings.h wchar.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h)
+       string(TOUPPER "HAVE_${_HEADER}" _UPPER)
+       string(REPLACE "." "_" _HAVE_H ${_UPPER})
+       check_include_file("${_HEADER}" ${_HAVE_H})
+-- 
+2.32.0
+
diff --git a/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb b/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb
index 58bc94cc86..4ba22c1fe6 100644
--- a/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb
+++ b/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb
@@ -20,6 +20,7 @@  SRC_URI = "http://www.libsdl.org/release/SDL2-${PV}.tar.gz \
            file://optional-libunwind-generic.patch \
            file://0001-sdlchecks.cmake-pass-cflags-to-the-appropriate-cmake.patch \
            "
+SRC_URI:append:class-native = " file://0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch"
 
 S = "${WORKDIR}/SDL2-${PV}"