nowrep / obs-vkcapture

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

How to build obs-vkcapture 32bit on Pop!_Os #85

Closed gabriele2000 closed 2 years ago

gabriele2000 commented 2 years ago

I'm using Pop!_Os, a debian-based distro. I regularly build obs-vkcapture by myself, though 32bit games fails to being capture so I guess I'm missing something on the build options, right? That said: is there a way to install it both for 32bit and 64bit? The path is not /lib but /lib/x86_86_gnu_linux or something like that...

nowrep commented 2 years ago

You can take a look at the Arch PKGBUILD and something similar should work also for you:

https://github.com/nowrep/obs-vkcapture/blob/b5965325ee11530e0426ca5157a6c56a71e45b9f/dist/PKGBUILD#L26-L36

Only the capture libraries are needed for 32bit build, so building plugin is disabled.

gabriele2000 commented 2 years ago

You can take a look at the Arch PKGBUILD and something similar should work also for you:

https://github.com/nowrep/obs-vkcapture/blob/b5965325ee11530e0426ca5157a6c56a71e45b9f/dist/PKGBUILD#L26-L36

Only the capture libraries are needed for 32bit build, so building plugin is disabled.

gabriele@msi-gp72m:~/obs-vkcapture/build$ export CFLAGS="-m32 ${CFLAGS}" && export CXXFLAGS="-m32 ${CXXFLAGS}" && export LDFLAGS="-m32 ${LDFLAGS}" && cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/lib/i386-linux-gnu -DBUILD_PLUGIN=OFF -DVulkan_LIBRARY=/lib/i386-linux-gnu -DOPENGL_glx_LIBRARY=/lib/i386-linux-gnu -DOPENGL_opengl_LIBRARY=/lib/i386-linux-gnu -DCMAKE_BUILD_TYPE=Release ..
-- Configuring done
-- Generating done
-- Build files have been written to: /home/gabriele/obs-vkcapture/build
gabriele@msi-gp72m:~/obs-vkcapture/build$ make
Consolidate compiler generated dependencies of target VkLayer_obs_vkcapture
[ 12%] Linking C shared module libVkLayer_obs_vkcapture.so
/usr/bin/ld: cannot find /lib/i386-linux-gnu: file format not recognized
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/VkLayer_obs_vkcapture.dir/build.make:114: libVkLayer_obs_vkcapture.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/VkLayer_obs_vkcapture.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
gabriele@msi-gp72m:~/obs-vkcapture/build$ 

@nowrep I guess it's something about LD on 32 bit folders and runtimes... I had to manually point the vulkan runtimes and the opengl runtimes so I guess that I'm missing something

nowrep commented 2 years ago

Don't add these -DVulkan_LIBRARY=/lib/i386-linux-gnu -DOPENGL_glx_LIBRARY=/lib/i386-linux-gnu -DOPENGL_opengl_LIBRARY=/lib/i386-linux-gnu, you're asking to link against /lib/i386-linux-gnu which is obviously not a library but a directory.

gabriele2000 commented 2 years ago

Don't add these -DVulkan_LIBRARY=/lib/i386-linux-gnu -DOPENGL_glx_LIBRARY=/lib/i386-linux-gnu -DOPENGL_opengl_LIBRARY=/lib/i386-linux-gnu, you're asking to link against /lib/i386-linux-gnu which is obviously not a library but a directory.

gabriele@msi-gp72m:~/obs-vkcapture/build$ export CFLAGS="-m32 ${CFLAGS}" && export CXXFLAGS="-m32 ${CXXFLAGS}" && export LDFLAGS="-m32 ${LDFLAGS}" && cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=/lib/i386-linux-gnu -DBUILD_PLUGIN=OFF -DCMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Vulkan (missing: Vulkan_LIBRARY)
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.22/Modules/FindVulkan.cmake:129 (find_package_handle_standard_args)
  CMakeLists.txt:6 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/gabriele/obs-vkcapture/build/CMakeFiles/CMakeOutput.log".
gabriele@msi-gp72m:~/obs-vkcapture/build$ 
nowrep commented 2 years ago

You need to have 32bit vulkan/opengl installed with its dev packages too.

gabriele2000 commented 2 years ago

You need to have 32bit vulkan/opengl installed with its dev packages too.

Heh, I had to manually search for the exact name through trial and error and I had to put :i386 at the end of every package. I thought that 32-bit libraries were always going to be installed, since I had to enable 32-bit stuff for wine.

Thanks a lot man! I fixed it!

UPDATE: @nowrep I created a basic script to compile both in 32-bit and 64-bit, maybe one day I could improve it so everyone with ubuntu-based distribution can use it to one-click install

gabriele@msi-gp72m:~$ cat /bin/vkcapture
#! /bin/bash

cd /home/gabriele/obs-vkcapture
git pull

#64-bit installation
cd /home/gabriele/obs-vkcapture/build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu -DCMAKE_BUILD_TYPE=Release ..
make
sudo make install

#32 bit installation
cd /home/gabriele/obs-vkcapture/build32
export CFLAGS="-m32 ${CFLAGS}"
export CXXFLAGS="-m32 ${CXXFLAGS}"
export LDFLAGS="-m32 ${LDFLAGS}"
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib/i386-linux-gnu -DCMAKE_BUILD_TYPE=Release -DBUILD_PLUGIN=OFF ..
make
sudo make install
echo "Restart the terminal to compile again"