Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to compile in a GNU/Linux environment? #20

Open
jasonkhanlar opened this issue Apr 20, 2019 · 11 comments
Open

Is it possible to compile in a GNU/Linux environment? #20

jasonkhanlar opened this issue Apr 20, 2019 · 11 comments

Comments

@jasonkhanlar
Copy link

I see https://github.com/Oncorporation/obs-shaderfilter/blob/master/CMakeLists.txt
references obs.dll file
which seems to be specific to proprietary MS Windows operating system only.

Is it possible the source code could be adjusted to make compiling in GNU/Linux environments also?

For example, in another OBS Studio plugin's CMakeLists.txt file I see:
https://github.com/bazukas/obs-linuxbrowser/blob/master/CMakeLists.txt
and also
https://github.com/bazukas/obs-linuxbrowser/blob/master/cmake/FindOBS.cmake

@jasonkhanlar jasonkhanlar changed the title Is it possible to compile in an GNU/Linux environment? Is it possible to compile in a GNU/Linux environment? Apr 27, 2019
@over9001
Copy link

over9001 commented May 7, 2019

I'm also hoping this can be used with Linux.

Thank you
!

@GameKyuubi
Copy link

I'd also like to see this

@adynathos
Copy link

Yes, I was able to build it as part of a source build of OBS.

  • Download the OBS source, put it into /somewhere/obs-studio-source
  • Download the shaderfilter plugin and put it in /somewhere/obs-studio-source/plugins/obs-shaderfilter
  • Replace the plugin's CMake file ( /somewhere/obs-studio-source/plugins/obs-shaderfilter/CMakeLists.txt ) with the following:
project (obs-shaderfilter)

set(obs-shaderfilter_SOURCES
	${CMAKE_CURRENT_SOURCE_DIR}/src/obs-shaderfilter.c
)

add_library(obs-shaderfilter MODULE
	${obs-shaderfilter_SOURCES}
)
target_link_libraries(obs-shaderfilter
	libobs
)

install_obs_plugin_with_data(obs-shaderfilter data)
  • Add the following line to /somewhere/obs-studio-source/plugins/CMakeLists.txt:
add_subdirectory(obs-shaderfilter)
  • Create build dir /somewhere/build and install dir /somewhere/install
  • Configure CMake: it will tell you that libraries are missing, install them from the repos
cd /somewhere/build
cmake ../obs-studio-source -DCMAKE_INSTALL_PREFIX=/somewhere/install
  • Build and write to build directory
make -j
make install
  • Run the build, it needs to know where its libraries are
cd /somewhere/install
LD_LIBRARY_PATH=./lib bin/obs

@b4zz4
Copy link

b4zz4 commented Nov 9, 2019

obs-studio/plugins/obs-shaderfilter/src/obs-shaderfilter.c:1:24: fatal error: obs-module.h

@jessicah
Copy link

I found https://gist.github.com/jessicah/2a07073f9a1e0f9bdb1791d1a9d4480d seemed to work. Ensure you use an absolute path to an OBS installed from source, not a relative path. CMake seems to break with a relative path.

@GameKyuubi
Copy link

GameKyuubi commented Aug 9, 2020

@adynathos

[ 26%] Linking C shared library libobsglad.so
/usr/bin/ld: CMakeFiles/glad.dir/src/glad_glx.c.o:(.bss+0x4b8): multiple definition of `gladGetProcAddressPtr'; CMakeFiles/glad.dir/src/glad.c.o:(.bss+0x5008): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [deps/glad/CMakeFiles/glad.dir/build.make:119: deps/glad/libobsglad.so.0] Error 1
make[1]: *** [CMakeFiles/Makefile2:797: deps/glad/CMakeFiles/glad.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 27%] Linking C shared library libobs.so
[ 27%] Built target libobs
make: *** [Makefile:171: all] Error 2

@Saravji
Copy link

Saravji commented Apr 22, 2022

I put all the instructions together and created a solution to build / install obs-shaderfilter, obs-studio and the virtual camera plugin on Ubnuntu.
Would like to see this merged into this repo. My solution is limited to Ubuntu, though, so not linux in general terms and does not consider all flavors of linux. So will not suggest it as "the" solution but a first step to the complete solution.
I also put together all the instructions and a video demonstrating it:
webpage with instructions: saravjishut.org/obs-shaderfilter
my fork of this repo: github.com/Saravji/obs-shaderfilter

@NoelleTGS
Copy link

@Saravji Doesn't seem to fully work. I was able to compile it all and run but adding any sort of effect will keep the screen black and give me errors.

For fisheye.shader for example, this is what I'm getting:

info: ------------------------------------------------
info: Loaded scenes:
info: - scene 'Scene':
info:     - source: 'Video Capture Device (V4L2)' (v4l2_input)
info:         - filter: 'User-defined shader' (shader_filter)
info: ------------------------------------------------
error: Error compiling shader:
0(41) : error C1503: undefined variable "uv"


error: device_pixelshader_create (GL) failed
error: Pass (0) <> missing pixel shader!
warning: [obs-shaderfilter] Unable to create effect. Errors returned from parser:
(None)

@Saravji
Copy link

Saravji commented May 9, 2022

@NoelleTGS Hello Fellow Canadian! - I have not verified that all shaders / filters work 100%. The error message reads as thought this is a config problem on the build in / supplied shaders / filters? (I'm not 100% sure here, so more guessing than being able to point you in the right direction.)
But happy to hear that the compile work for you! With this you're the first officially confirmed independent compile! ;-)

@NoelleTGS
Copy link

@Saravji I'm using this in Manjaro instead of Ubuntu like it says in your instructions so I wonder if that might be part of the issue. I could try compiling it through an Ubuntu VM quickly to see if the issue persists. I googled some of the lines from the errors I was getting and there really wasn't much aside from "just reinstall" so we'll see.

@NoelleTGS
Copy link

NoelleTGS commented May 10, 2022

Alright looks like it wasn't an issue with that all along! It was the shader itself causing issues, I grabbed @exeldro's fixed version from here and it's working without issues!

I tried copying the plugin from that build to my regular Flatpak install and ofc, it didn't work. I was able to make it work by placing the .so in the ridiculous directory of /var/lib/flatpak/app/com.obsproject.Studio/current/0069ec300ce09337a585acfcefe0f2ecdfa0efcd08d920b2751c844fd026296a/files/lib, but right now it looks like this.

image

Guess there's a little more troubleshooting to do but regardless, I got it working and that's all I care about lol.

2023 edit: for those coming across this years later, the only thing that's changed is that you will place the shaderfilter.so in the "obs-plugins" folder within the ".../files/lib" directory and it'll work just fine. I've attached the shaderfilter.so in a zip file for those who'd like to use it.

obs-shaderfilter.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants