nowrep / obs-vkcapture

OBS Linux Vulkan/OpenGL game capture
GNU General Public License v2.0
508 stars 25 forks source link

Build fails on musl #136

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hi, currently obs-vkcapture fails to build on musl with: /src/elfhacks.c:363:39: error: '__ELF_NATIVE_CLASS' undeclared (first use in this function) A patch, more or less stolen from this PR for MangoHud, that seems to work is:

--- a/src/elfhacks.c
+++ b/src/elfhacks.c
@@ -18,6 +18,11 @@
 #include <fnmatch.h>
 #include "elfhacks.h"

+#ifndef __ELF_NATIVE_CLASS
+#include "sys/reg.h"
+#define __ELF_NATIVE_CLASS __WORDSIZE
+#endif
+
 /**
  *  \addtogroup elfhacks
  *  \{

This allows obs-vkcapture to build, however, there are still other runtime issues related to libdl.so, which causes obs-vkcapture to fail. Here is a potentially releveant issue

nowrep commented 1 year ago

Can you please open PR with this? It's fine if the GL capture doesn't work with musl, as long as it can be compiled with musl and Vulkan capture works.

nowrep commented 1 year ago

What are the other issues? The code should correctly handle dlsym not being in libdl.so (it's the case for newer glibc too).