Skip to contentSkip to conversation

mpv: Link libatomic on riscv64

PATCH New Khem Raj 1 participant 2 messages Mar 9, 2021

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 mpv: Link libatomic on riscv64

gcc uses __atomic_compare_exchange_1 which is not implemented for rv64

Fixes
video/out/vo_libmpv.c:186: undefined reference to `__atomic_compare_exchange_1'
collect2: error: ld returned 1 exit status

---
 meta-oe/recipes-multimedia/mplayer/mpv_0.32.0.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-oe/recipes-multimedia/mplayer/mpv_0.32.0.bb +2 -0
index 973a978b1c..e04925d0f1 100644
@@ -26,6 +26,8 @@ S = "${WORKDIR}/git"
 
 inherit waf pkgconfig mime-xdg
 
+LDFLAGS_append_riscv64 = " -latomic"
+
 LUA ?= "lua"
 LUA_mips64  = ""
 LUA_aarch64  = ""
Signature · 1 line
2.30.1
author
#1 lore raw

PATCH 2/2 glog: Link with libexecinfo on musl

some platforms e.g. riscv do not yet have libunwind ported so use libexecinfo instead

---
 .../glog/glog/libexecinfo.patch               | 29 +++++++++++++++++++
 meta-oe/recipes-support/glog/glog_0.4.0.bb    |  4 +++
 2 files changed, 33 insertions(+)
 create mode 100644 meta-oe/recipes-support/glog/glog/libexecinfo.patch
meta-oe/recipes-support/glog/glog/libexecinfo.patch new file +29 -0
new file mode 100644
index 0000000000..ae46d3274f
@@ -0,0 +1,29 @@
+Link libexecinfo if its found, this is needed for musl based systems
+
+Fixes
+ld: libglog.so.0.4.0: undefined reference to `backtrace'
+| collect2: error: ld returned 1 exit status
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -115,6 +115,7 @@ check_cxx_compiler_flag (-Wunnamed-type-
+ check_symbol_exists (snprintf stdio.h HAVE_SNPRINTF)
+ 
+ check_library_exists (dbghelp UnDecorateSymbolName "" HAVE_DBGHELP)
++check_library_exists (execinfo backtrace "" HAVE_EXECINFO)
+ 
+ find_package(Libunwind)
+ 
+@@ -471,6 +472,10 @@ if (Libunwind_FOUND)
+   target_link_libraries (glog PUBLIC unwind)
+ endif (Libunwind_FOUND)
+ 
++if (HAVE_EXECINFO)
++  target_link_libraries (glog PUBLIC execinfo)
++endif (HAVE_EXECINFO)
++
+ if (HAVE_DBGHELP)
+    target_link_libraries (glog PUBLIC dbghelp)
+ endif (HAVE_DBGHELP)
meta-oe/recipes-support/glog/glog_0.4.0.bb +4 -0
index 8dc84e4125..6b101ef676 100644
@@ -9,6 +9,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=dc9db360e0bbd4e46672f3fd91dd6c4b"
 SRC_URI = " \
     git://github.com/google/glog.git;nobranch=1 \
     file://0001-Find-Libunwind-during-configure.patch \
+    file://libexecinfo.patch \
 "
 
 SRCREV = "96a2f23dca4cc7180821ca5f32e526314395d26a"
@@ -20,8 +21,11 @@ inherit cmake
 PACKAGECONFIG ?= "shared unwind"
 PACKAGECONFIG_remove_riscv64 = "unwind"
 PACKAGECONFIG_remove_riscv32 = "unwind"
+PACKAGECONFIG_append_libc-musl_riscv64 = " execinfo"
+PACKAGECONFIG_append_libc-musl_riscv32 = " execinfo"
 
 PACKAGECONFIG[unwind] = "-DWITH_UNWIND=ON,-DWITH_UNWIND=OFF,libunwind,libunwind"
+PACKAGECONFIG[execinfo] = ",,libexecinfo"
 PACKAGECONFIG[shared] = "-DBUILD_SHARED_LIBS=ON,-DBUILD_SHARED_LIBS=OFF,,"
 
 do_configure_append() {
Signature · 1 line
2.30.1