bazukas/obs-linuxbrowser

Can't compile on Ubuntu 18

Closed this issue · 12 comments

noozo commented

Tried using g++-5 and g++-7 and no joy :(

/home/void/.config/obs-studio/plugins/obs-linuxbrowser/src/browser/browser-client.cpp: In member function ‘void BrowserClient::SetScroll(CefRefPtr<CefBrowser>, uint32_t, uint32_t)’:
/home/void/.config/obs-studio/plugins/obs-linuxbrowser/src/browser/browser-client.cpp:96:12: error: ‘to_string’ is not a member of ‘std’
  script += std::to_string(horizontal) + "," + std::to_string(vertical) + ");";
            ^
/home/void/.config/obs-studio/plugins/obs-linuxbrowser/src/browser/browser-client.cpp:96:47: error: ‘to_string’ is not a member of ‘std’
  script += std::to_string(horizontal) + "," + std::to_string(vertical) + ");";
                                               ^
CMakeFiles/browser.dir/build.make:110: recipe for target 'CMakeFiles/browser.dir/src/browser/browser-client.cpp.o' failed
make[2]: *** [CMakeFiles/browser.dir/src/browser/browser-client.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/browser.dir/all' failed
make[1]: *** [CMakeFiles/browser.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2```

Could you please edit src/browser/browser-client.cpp and put #include <string> line 20:

#include <algorithm>
#include <math.h>
#include "base64.hpp"
#include "browser-client.hpp"

Please confirm if it worked out or if there are still errors occuring.

noozo commented
noozo commented

Any simple way to confirm which compiler versions my make command is using? Maybe the CXX and CC flags didn't work for some reason... (not a C++ dev myself ;))

You could try CXX=/usr/bin/g++ CC=/usr/bin/gcc CXXFLAGS= make -j4.

Your Problem is quite confusing, as to_string is part of standard C++11 which we have included in our CXXFLAGS so it should normally be activated, but your system seems to be not using C++11. That is strange.

EDIT: Alternatively you could try installing the clang compiler and executing CXX=/usr/bin/clang++ CC=/usr/bin/clang make -j4 to compile obs-linuxbrowser.

Try appying this patch, if the above solution doesn't work out for you:
https://gist.github.com/NexAdn/b86820b12e20f1c4beb86e6a77c7a5c8

noozo commented

What exactly worked for you? The first approach with CC and CXX or the second approach with the patch file?

Okay, it seems like it can't find the OBS headers. Have you set the OBS_INCLUDE and OBS_LIB variables correctly?
https://github.com/bazukas/obs-linuxbrowser#building-plugin

noozo commented

It normally not necessary to set these variables as OBS uses standard include paths per default. In #62, OBS had previously been installed via Software Center and installing the plugin via the default method didn't work out because SC somehow changed the paths.

If you have installed OBS via software center, you should probably search somewhere in /usr/include for a folder named obs or similar, maybe there could also be a snap folder (or it may be somewhere in the root directory) where the include files are stored. Try searching your file system for a file named obs-module.h. In whatever directory this file is, you should set this directory as OBS_INCLUDE for CMake.

For OBS_LIB you should search for a file named libobs.so, which is normally located at /usr/lib. Same procedure as with OBS_INCLUDE you should set it to whatever directory libobs.so is located at.

noozo commented

You have written the command line wrong. Also, you have to compile OBS-Studio to get the libary files. Follow [1] to build obs from source. After building obs-studio, the command line should look like this:
cmake -DCEF_DIR=/home/void/Downloads/cef_binary_3.3359.1774.gd49d25f_linux64 -DOBS_INCLUDE=/home/void/Downloads/obs-studio/libobs -DOBS_LIB=/home/void/Downloads/obs-studio/build/libobs ..
I hope this fixes your problem.

[1] https://github.com/obsproject/obs-studio/wiki/Install-Instructions#linux-build-directions

noozo commented