Skip to contentSkip to conversation

libsdl2: Fix build when libunwind is not used

PATCH In review Khem Raj 3 participants 5 messages Jan 7, 2022 – Mar 4, 2022

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v2 1/1 libsdl2: Fix build when libunwind is not used

clang provides libunwind.h and cmake adds a check to find libunwind when this header is detected, which was not the case with automake. The check however is expecting specific unwinder implementation which provides libunwind-generic solib, this is not a standard library that all implementations will provide, therefore make this check optional.

Cc Andreas Müller <[email protected]>

---
v2: Udate patch status to submitted

 .../libsdl2/optional-libunwind-generic.patch   | 18 ++++++++++++++++++
 .../recipes-graphics/libsdl2/libsdl2_2.0.18.bb |  1 +
 2 files changed, 19 insertions(+)
 create mode 100644 meta/recipes-graphics/libsdl2/libsdl2/optional-libunwind-generic.patch
meta/recipes-graphics/libsdl2/libsdl2/optional-libunwind-generic.patch new file +18 -0
new file mode 100644
index 00000000000..757b99a5f68
@@ -0,0 +1,18 @@
+Do not error when libunwind-generic is not found, Not all
+implementations of libunwind will provide this library therefore
+do not make it hard error if its not found.
+
+Upstream-Status: Submitted [https://github.com/libsdl-org/SDL/pull/5194]
+Signed-off-by: Khem Raj <[email protected]>
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1358,7 +1358,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROI
+       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_GENERIC REQUIRED libunwind-generic)
++        pkg_search_module(UNWIND_GENERIC libunwind-generic)
+         list(APPEND EXTRA_LIBS ${UNWIND_LIBRARIES} ${UNWIND_GENERIC_LIBRARIES})
+       endif()
+     endif()
meta/recipes-graphics/libsdl2/libsdl2_2.0.18.bb +1 -0
index 893386343a7..1559d5e9425 100644
@@ -18,6 +18,7 @@ PROVIDES = "virtual/libsdl2"
 
 SRC_URI = "http://www.libsdl.org/release/SDL2-${PV}.tar.gz \
            file://0001-Fix-build-against-wayland-1.20.patch \
+           file://optional-libunwind-generic.patch \
 "
 
 S = "${WORKDIR}/SDL2-${PV}"
Signature · 1 line
2.34.1
#1 lore raw

Thanks :)

Alex

Quoted 75 lines · Khem Raj

clang provides libunwind.h and cmake adds a check to find libunwind when this header is detected, which was not the case with automake. The check however is expecting specific unwinder implementation which provides libunwind-generic solib, this is not a standard library that all implementations will provide, therefore make this check optional.

Cc Andreas Müller <[email protected]>

---
v2: Udate patch status to submitted

 .../libsdl2/optional-libunwind-generic.patch   | 18 ++++++++++++++++++
 .../recipes-graphics/libsdl2/libsdl2_2.0.18.bb |  1 +
 2 files changed, 19 insertions(+)
 create mode 100644

meta/recipes-graphics/libsdl2/libsdl2/optional-libunwind-generic.patch

diff --git a/meta/recipes-graphics/libsdl2/libsdl2/optional-libunwind-generic.patch b/meta/recipes-graphics/libsdl2/libsdl2/optional-libunwind-generic.patch new file mode 100644
index 00000000000..757b99a5f68
--- /dev/null
+++
b/meta/recipes-graphics/libsdl2/libsdl2/optional-libunwind-generic.patch

meta/recipes-graphics/libsdl2/libsdl2/optional-libunwind-generic.patch new file +12 -0
@@ -0,0 +1,18 @@
+Do not error when libunwind-generic is not found, Not all
+implementations of libunwind will provide this library therefore
+do not make it hard error if its not found.
+
+Upstream-Status: Submitted [https://github.com/libsdl-org/SDL/pull/5194]
+Signed-off-by: Khem Raj <[email protected]>
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1358,7 +1358,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROI
+       if(HAVE_LIBUNWIND_H)
+         # We've already found the header, so REQUIRE the lib to be

present

meta/recipes-graphics/libsdl2/libsdl2/optional-libunwind-generic.patch new file +4 -0
+         pkg_search_module(UNWIND REQUIRED libunwind)
+-        pkg_search_module(UNWIND_GENERIC REQUIRED libunwind-generic)
++        pkg_search_module(UNWIND_GENERIC libunwind-generic)
+         list(APPEND EXTRA_LIBS ${UNWIND_LIBRARIES}

${UNWIND_GENERIC_LIBRARIES})

meta/recipes-graphics/libsdl2/libsdl2/optional-libunwind-generic.patch new file +2 -0
+       endif()
+     endif()
meta/recipes-graphics/libsdl2/libsdl2_2.0.18.bb +1 -1
index 893386343a7..1559d5e9425 100644
@@ -18,6 +18,7 @@ PROVIDES = "virtual/libsdl2"
 
 SRC_URI = "http://www.libsdl.org/release/SDL2-${PV}.tar.gz \
            file://0001-Fix-build-against-wayland-1.20.patch \
+           file://optional-libunwind-generic.patch \
 "
 
 S = "${WORKDIR}/SDL2-${PV}"
--

2.34.1

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

#2 lore raw

"MACHINE=qemux86-64 bitbake libsdl2-native" still fails with a similar error:

| CMake Error at /home/test/yocto-master/poky/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

This is triggered by the "pkg_search_module(UNWIND REQUIRED libunwind)" line right above the one that is modified by this patch.

Any idea what is going on?

Quoted 89 lines · Alexander Kanavin

Thanks :)

Alex

On Fri, 7 Jan 2022 at 20:23, Khem Raj <[email protected]> wrote:

    clang provides libunwind.h and cmake adds a check to
    find libunwind when this header is detected, which was
    not the case with automake. The check however is expecting
    specific unwinder implementation which provides libunwind-generic
    solib, this is not a standard library that all implementations
    will provide, therefore make this check optional.

    Signed-off-by: Khem Raj <[email protected]>
    Cc: Andreas Müller <[email protected]>
    ---
    v2: Udate patch status to submitted

     .../libsdl2/optional-libunwind-generic.patch   | 18
    ++++++++++++++++++
     .../recipes-graphics/libsdl2/libsdl2_2.0.18.bb
    <http://libsdl2_2.0.18.bb> |  1 +
     2 files changed, 19 insertions(+)
     create mode 100644
    meta/recipes-graphics/libsdl2/libsdl2/optional-libunwind-generic.patch

    diff --git
    a/meta/recipes-graphics/libsdl2/libsdl2/optional-libunwind-generic.patch
    b/meta/recipes-graphics/libsdl2/libsdl2/optional-libunwind-generic.patch
    new file mode 100644
    index 00000000000..757b99a5f68
    --- /dev/null
    +++
    b/meta/recipes-graphics/libsdl2/libsdl2/optional-libunwind-generic.patch
    @@ -0,0 +1,18 @@
    +Do not error when libunwind-generic is not found, Not all
    +implementations of libunwind will provide this library therefore
    +do not make it hard error if its not found.
    +
    +Upstream-Status: Submitted
    [https://github.com/libsdl-org/SDL/pull/5194]
    +Signed-off-by: Khem Raj <[email protected]>
    +
    +--- a/CMakeLists.txt
    ++++ b/CMakeLists.txt
    +@@ -1358,7 +1358,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROI
    +       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_GENERIC REQUIRED libunwind-generic)
    ++        pkg_search_module(UNWIND_GENERIC libunwind-generic)
    +         list(APPEND EXTRA_LIBS ${UNWIND_LIBRARIES}
    ${UNWIND_GENERIC_LIBRARIES})
    +       endif()
    +     endif()
    diff --git a/meta/recipes-graphics/libsdl2/libsdl2_2.0.18.bb
    <http://libsdl2_2.0.18.bb>
    b/meta/recipes-graphics/libsdl2/libsdl2_2.0.18.bb
    <http://libsdl2_2.0.18.bb>
    index 893386343a7..1559d5e9425 100644
    --- a/meta/recipes-graphics/libsdl2/libsdl2_2.0.18.bb
    <http://libsdl2_2.0.18.bb>
    +++ b/meta/recipes-graphics/libsdl2/libsdl2_2.0.18.bb
    <http://libsdl2_2.0.18.bb>
    @@ -18,6 +18,7 @@ PROVIDES = "virtual/libsdl2"

     SRC_URI = "http://www.libsdl.org/release/SDL2-${PV}.tar.gz
    <http://www.libsdl.org/release/SDL2-$%7BPV%7D.tar.gz> \
    file://0001-Fix-build-against-wayland-1.20.patch \
    + file://optional-libunwind-generic.patch \
     "

     S = "${WORKDIR}/SDL2-${PV}"
    -- 
    2.34.1

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

author
#3 lore raw
Quoted 9 lines · Carlos Rafael Giani via lists.openembedded.org

"MACHINE=qemux86-64 bitbake libsdl2-native" still fails with a similar error:

| CMake Error at /home/test/yocto-master/poky/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

This is triggered by the "pkg_search_module(UNWIND REQUIRED libunwind)" line right above the one that is modified by this patch.

Any idea what is going on?

I think its looking for libunwind on your build host.

Quoted 81 lines · Alexander Kanavin

Thanks :)

Alex

Quoted 55 lines · Khem Raj

clang provides libunwind.h and cmake adds a check to find libunwind when this header is detected, which was not the case with automake. The check however is expecting specific unwinder implementation which provides libunwind-generic solib, this is not a standard library that all implementations will provide, therefore make this check optional.

Cc Andreas Müller <[email protected]>

---
v2: Udate patch status to submitted

 .../libsdl2/optional-libunwind-generic.patch   | 18 ++++++++++++++++++
 .../recipes-graphics/libsdl2/libsdl2_2.0.18.bb |  1 +
 2 files changed, 19 insertions(+)
 create mode 100644 meta/recipes-graphics/libsdl2/libsdl2/optional-libunwind-generic.patch
meta/recipes-graphics/libsdl2/libsdl2/optional-libunwind-generic.patch new file +18 -0
new file mode 100644
index 00000000000..757b99a5f68
@@ -0,0 +1,18 @@
+Do not error when libunwind-generic is not found, Not all
+implementations of libunwind will provide this library therefore
+do not make it hard error if its not found.
+
+Upstream-Status: Submitted [https://github.com/libsdl-org/SDL/pull/5194]
+Signed-off-by: Khem Raj <[email protected]>
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1358,7 +1358,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROI
+       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_GENERIC REQUIRED libunwind-generic)
++        pkg_search_module(UNWIND_GENERIC libunwind-generic)
+         list(APPEND EXTRA_LIBS ${UNWIND_LIBRARIES} ${UNWIND_GENERIC_LIBRARIES})
+       endif()
+     endif()
meta/recipes-graphics/libsdl2/libsdl2_2.0.18.bb +1 -1
index 893386343a7..1559d5e9425 100644
@@ -18,6 +18,7 @@ PROVIDES = "virtual/libsdl2"
 
 SRC_URI = "http://www.libsdl.org/release/SDL2-${PV}.tar.gz \
            file://0001-Fix-build-against-wayland-1.20.patch \
+           file://optional-libunwind-generic.patch \
 "
 
 S = "${WORKDIR}/SDL2-${PV}"
--
Quoted 5 lines

2.34.1

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

#4 lore raw

libunwind is installed on the host, complete with its -dev package. OE still does not find it.

I'll submit a patch that adds libunwind-native to the native DEPENDS.

Quoted 92 lines · Khem Raj
Quoted 8 lines · Carlos Rafael Giani via lists.openembedded.org

"MACHINE=qemux86-64 bitbake libsdl2-native" still fails with a similar error:

| CMake Error at /home/test/yocto-master/poky/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

This is triggered by the "pkg_search_module(UNWIND REQUIRED libunwind)" line right above the one that is modified by this patch.

Any idea what is going on?

I think its looking for libunwind on your build host.

Quoted 79 lines · Alexander Kanavin

Thanks :)

Alex

Quoted 50 lines · Khem Raj

clang provides libunwind.h and cmake adds a check to find libunwind when this header is detected, which was not the case with automake. The check however is expecting specific unwinder implementation which provides libunwind-generic solib, this is not a standard library that all implementations will provide, therefore make this check optional.

Cc Andreas Müller<[email protected]>

---
v2: Udate patch status to submitted

  .../libsdl2/optional-libunwind-generic.patch   | 18 ++++++++++++++++++
  .../recipes-graphics/libsdl2/libsdl2_2.0.18.bb |  1 +
  2 files changed, 19 insertions(+)

create mode 100644 meta/recipes-graphics/libsdl2/libsdl2/optional-libunwind-generic.patch

meta/recipes-graphics/libsdl2/libsdl2/optional-libunwind-generic.patch new file +18 -0
new file mode 100644
index 00000000000..757b99a5f68
@@ -0,0 +1,18 @@
+Do not error when libunwind-generic is not found, Not all
+implementations of libunwind will provide this library therefore
+do not make it hard error if its not found.
+
+Upstream-Status: Submitted [https://github.com/libsdl-org/SDL/pull/5194]
+Signed-off-by: Khem Raj<[email protected]>
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1358,7 +1358,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROI
+       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_GENERIC REQUIRED libunwind-generic)
++        pkg_search_module(UNWIND_GENERIC libunwind-generic)
+         list(APPEND EXTRA_LIBS ${UNWIND_LIBRARIES} ${UNWIND_GENERIC_LIBRARIES})
+       endif()
+     endif()
meta/recipes-graphics/libsdl2/libsdl2_2.0.18.bb +0 -0
index 893386343a7..1559d5e9425 100644
@@ -18,6 +18,7 @@ PROVIDES = "virtual/libsdl2"
 
  SRC_URI ="http://www.libsdl.org/release/SDL2-${PV}.tar.gz \ 

file://0001-Fix-build-against-wayland-1.20.patch \ + file://optional-libunwind-generic.patch \ "

Quoted 7 lines

S = "${WORKDIR}/SDL2-${PV}"
--
2.34.1

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