libsdl2: Make libunwind dependency optional for native builds

Message ID 20220307080750.489418-1-crg7475@mailbox.org
State New
Headers show
Series libsdl2: Make libunwind dependency optional for native builds | expand

Commit Message

Carlos Rafael Giani March 7, 2022, 8:07 a.m. UTC
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
---
 ...ependency-optional-for-native-libsdl.patch | 37 +++++++++++++++++++
 .../libsdl2/libsdl2_2.0.20.bb                 |  1 +
 2 files changed, 38 insertions(+)
 create mode 100644 meta/recipes-graphics/libsdl2/libsdl2/0001-Make-libunwind-dependency-optional-for-native-libsdl.patch

Comments

Alexander Kanavin March 7, 2022, 9:30 a.m. UTC | #1
This needs to be better explained, particularly why the patch is
inappropriate for upstream submission.

Alex

On Mon, 7 Mar 2022 at 09:08, Carlos Rafael Giani via
lists.openembedded.org <crg7475=mailbox.org@lists.openembedded.org>
wrote:
>
> Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
> ---
>  ...ependency-optional-for-native-libsdl.patch | 37 +++++++++++++++++++
>  .../libsdl2/libsdl2_2.0.20.bb                 |  1 +
>  2 files changed, 38 insertions(+)
>  create mode 100644 meta/recipes-graphics/libsdl2/libsdl2/0001-Make-libunwind-dependency-optional-for-native-libsdl.patch
>
> diff --git a/meta/recipes-graphics/libsdl2/libsdl2/0001-Make-libunwind-dependency-optional-for-native-libsdl.patch b/meta/recipes-graphics/libsdl2/libsdl2/0001-Make-libunwind-dependency-optional-for-native-libsdl.patch
> new file mode 100644
> index 0000000000..00f3486194
> --- /dev/null
> +++ b/meta/recipes-graphics/libsdl2/libsdl2/0001-Make-libunwind-dependency-optional-for-native-libsdl.patch
> @@ -0,0 +1,37 @@
> +From 78078bcf00f0ad13d93b1dc525ee0a666c30f246 Mon Sep 17 00:00:00 2001
> +From: Carlos Rafael Giani <crg7475@mailbox.org>
> +Date: Mon, 7 Mar 2022 05:09:08 +0100
> +Subject: [PATCH] Make libunwind dependency optional for native libsdl2 OE
> + build
> +
> +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)
> +
> +Upstream-Status: Inappropriate [OE specific]
> +
> +Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
> +---
> + CMakeLists.txt | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +index 64f9fbf..eda3112 100644
> +--- a/CMakeLists.txt
> ++++ b/CMakeLists.txt
> +@@ -1364,7 +1364,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU)
> +
> +       if(HAVE_LIBUNWIND_H)
> +         # We've already found the header, so REQUIRE the lib to be present
> +-        pkg_search_module(UNWIND REQUIRED libunwind)
> ++        pkg_search_module(UNWIND libunwind)
> +         pkg_search_module(UNWIND_GENERIC libunwind-generic)
> +         list(APPEND EXTRA_LIBS ${UNWIND_LIBRARIES} ${UNWIND_GENERIC_LIBRARIES})
> +       endif()
> +--
> +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 90724ab8b7..d8211165d4 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-Make-libunwind-dependency-optional-for-native-libsdl.patch "
>
>  S = "${WORKDIR}/SDL2-${PV}"
>
> --
> 2.32.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#162798): https://lists.openembedded.org/g/openembedded-core/message/162798
> Mute This Topic: https://lists.openembedded.org/mt/89607589/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 7, 2022, 9:31 a.m. UTC | #2
Also, is this going to cause non-deterministic builds?

Alex

On Mon, 7 Mar 2022 at 10:30, Alexander Kanavin via
lists.openembedded.org <alex.kanavin=gmail.com@lists.openembedded.org>
wrote:
>
> This needs to be better explained, particularly why the patch is
> inappropriate for upstream submission.
>
> Alex
>
> On Mon, 7 Mar 2022 at 09:08, Carlos Rafael Giani via
> lists.openembedded.org <crg7475=mailbox.org@lists.openembedded.org>
> wrote:
> >
> > Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
> > ---
> >  ...ependency-optional-for-native-libsdl.patch | 37 +++++++++++++++++++
> >  .../libsdl2/libsdl2_2.0.20.bb                 |  1 +
> >  2 files changed, 38 insertions(+)
> >  create mode 100644 meta/recipes-graphics/libsdl2/libsdl2/0001-Make-libunwind-dependency-optional-for-native-libsdl.patch
> >
> > diff --git a/meta/recipes-graphics/libsdl2/libsdl2/0001-Make-libunwind-dependency-optional-for-native-libsdl.patch b/meta/recipes-graphics/libsdl2/libsdl2/0001-Make-libunwind-dependency-optional-for-native-libsdl.patch
> > new file mode 100644
> > index 0000000000..00f3486194
> > --- /dev/null
> > +++ b/meta/recipes-graphics/libsdl2/libsdl2/0001-Make-libunwind-dependency-optional-for-native-libsdl.patch
> > @@ -0,0 +1,37 @@
> > +From 78078bcf00f0ad13d93b1dc525ee0a666c30f246 Mon Sep 17 00:00:00 2001
> > +From: Carlos Rafael Giani <crg7475@mailbox.org>
> > +Date: Mon, 7 Mar 2022 05:09:08 +0100
> > +Subject: [PATCH] Make libunwind dependency optional for native libsdl2 OE
> > + build
> > +
> > +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)
> > +
> > +Upstream-Status: Inappropriate [OE specific]
> > +
> > +Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
> > +---
> > + CMakeLists.txt | 2 +-
> > + 1 file changed, 1 insertion(+), 1 deletion(-)
> > +
> > +diff --git a/CMakeLists.txt b/CMakeLists.txt
> > +index 64f9fbf..eda3112 100644
> > +--- a/CMakeLists.txt
> > ++++ b/CMakeLists.txt
> > +@@ -1364,7 +1364,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU)
> > +
> > +       if(HAVE_LIBUNWIND_H)
> > +         # We've already found the header, so REQUIRE the lib to be present
> > +-        pkg_search_module(UNWIND REQUIRED libunwind)
> > ++        pkg_search_module(UNWIND libunwind)
> > +         pkg_search_module(UNWIND_GENERIC libunwind-generic)
> > +         list(APPEND EXTRA_LIBS ${UNWIND_LIBRARIES} ${UNWIND_GENERIC_LIBRARIES})
> > +       endif()
> > +--
> > +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 90724ab8b7..d8211165d4 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-Make-libunwind-dependency-optional-for-native-libsdl.patch "
> >
> >  S = "${WORKDIR}/SDL2-${PV}"
> >
> > --
> > 2.32.0
> >
> >
> >
> >
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#162801): https://lists.openembedded.org/g/openembedded-core/message/162801
> Mute This Topic: https://lists.openembedded.org/mt/89607589/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Richard Purdie March 7, 2022, 10:39 p.m. UTC | #3
On Mon, 2022-03-07 at 10:31 +0100, Alexander Kanavin wrote:
> Also, is this going to cause non-deterministic builds?

Yes, it would break if sstate is reused from a system with to a system without
libunwind.

Can we just disable libunwind for native?

Cheers,

Richard
Carlos Rafael Giani March 18, 2022, 11:08 a.m. UTC | #4
I am preparing a patch for this. I am somewhat uncertain though if this 
is considered an OK approach or a hack, since we could in theory add 
libunwind-native as a libsdl2-native dependency, but libunwind-native 
itself has build issues, as seen here:

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

To me, it seems that the "clean" solution would be to fix 
libunwind-native then. But that may take longer (just guessing here, I 
have no idea about libunwind).

Thoughts?

On 07.03.22 23:39, Richard Purdie wrote:
> On Mon, 2022-03-07 at 10:31 +0100, Alexander Kanavin wrote:
>> Also, is this going to cause non-deterministic builds?
> Yes, it would break if sstate is reused from a system with to a system without
> libunwind.
>
> Can we just disable libunwind for native?
>
> Cheers,
>
> Richard
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#162869):https://lists.openembedded.org/g/openembedded-core/message/162869
> Mute This Topic:https://lists.openembedded.org/mt/89607589/3617253
> Group Owner:openembedded-core+owner@lists.openembedded.org
> Unsubscribe:https://lists.openembedded.org/g/openembedded-core/unsub  [crg7475@mailbox.org]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Richard Purdie March 18, 2022, 11:35 a.m. UTC | #5
On Fri, 2022-03-18 at 12:08 +0100, Carlos Rafael Giani via
lists.openembedded.org wrote:
> I am preparing a patch for this. I am somewhat uncertain though if this is
> considered an OK approach or a hack, since we could in theory add libunwind-
> native as a libsdl2-native dependency, but libunwind-native itself has build
> issues, as seen here:
> https://autobuilder.yoctoproject.org/typhoon/#/builders/91/builds/5624/steps/12/logs/stdio
> To me, it seems that the "clean" solution would be to fix libunwind-native
> then. But that may take longer (just guessing here, I have no idea about
> libunwind).
> Thoughts?

The key questions are:

a) Can we fix unwind-native to work on centos7 where it breaks? If so, that is
the best solution.

b) What functionality do we lose if we disable unwind in libsdl? Is it minor
debugging info or something we really do need?

I'm afraid I don't know the answers to those questions so it makes the correct
course of action hard to see.

Cheers,

Richard
Carlos Rafael Giani March 18, 2022, 8:10 p.m. UTC | #6
I can't do (a) at the moment since I do not have CentOS set up here. As 
for (b), I think that if disabling libunwind in the libsdl2-native build 
only, the impact is minimized, since libsdl2-native is used only for 
other native tools like QEMU.

On 18.03.22 12:35, Richard Purdie wrote:
> On Fri, 2022-03-18 at 12:08 +0100, Carlos Rafael Giani via
> lists.openembedded.org wrote:
>> I am preparing a patch for this. I am somewhat uncertain though if this is
>> considered an OK approach or a hack, since we could in theory add libunwind-
>> native as a libsdl2-native dependency, but libunwind-native itself has build
>> issues, as seen here:
>> https://autobuilder.yoctoproject.org/typhoon/#/builders/91/builds/5624/steps/12/logs/stdio
>> To me, it seems that the "clean" solution would be to fix libunwind-native
>> then. But that may take longer (just guessing here, I have no idea about
>> libunwind).
>> Thoughts?
> The key questions are:
>
> a) Can we fix unwind-native to work on centos7 where it breaks? If so, that is
> the best solution.
>
> b) What functionality do we lose if we disable unwind in libsdl? Is it minor
> debugging info or something we really do need?
>
> I'm afraid I don't know the answers to those questions so it makes the correct
> course of action hard to see.
>
> Cheers,
>
> Richard
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#163447):https://lists.openembedded.org/g/openembedded-core/message/163447
> Mute This Topic:https://lists.openembedded.org/mt/89607589/3617253
> Group Owner:openembedded-core+owner@lists.openembedded.org
> Unsubscribe:https://lists.openembedded.org/g/openembedded-core/unsub  [crg7475@mailbox.org]
> -=-=-=-=-=-=-=-=-=-=-=-
>

Patch

diff --git a/meta/recipes-graphics/libsdl2/libsdl2/0001-Make-libunwind-dependency-optional-for-native-libsdl.patch b/meta/recipes-graphics/libsdl2/libsdl2/0001-Make-libunwind-dependency-optional-for-native-libsdl.patch
new file mode 100644
index 0000000000..00f3486194
--- /dev/null
+++ b/meta/recipes-graphics/libsdl2/libsdl2/0001-Make-libunwind-dependency-optional-for-native-libsdl.patch
@@ -0,0 +1,37 @@ 
+From 78078bcf00f0ad13d93b1dc525ee0a666c30f246 Mon Sep 17 00:00:00 2001
+From: Carlos Rafael Giani <crg7475@mailbox.org>
+Date: Mon, 7 Mar 2022 05:09:08 +0100
+Subject: [PATCH] Make libunwind dependency optional for native libsdl2 OE
+ build
+
+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)
+
+Upstream-Status: Inappropriate [OE specific]
+
+Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 64f9fbf..eda3112 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1364,7 +1364,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU)
+ 
+       if(HAVE_LIBUNWIND_H)
+         # We've already found the header, so REQUIRE the lib to be present
+-        pkg_search_module(UNWIND REQUIRED libunwind)
++        pkg_search_module(UNWIND libunwind)
+         pkg_search_module(UNWIND_GENERIC libunwind-generic)
+         list(APPEND EXTRA_LIBS ${UNWIND_LIBRARIES} ${UNWIND_GENERIC_LIBRARIES})
+       endif()
+-- 
+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 90724ab8b7..d8211165d4 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-Make-libunwind-dependency-optional-for-native-libsdl.patch "
 
 S = "${WORKDIR}/SDL2-${PV}"