bazukas / obs-linuxbrowser

OBS Linux Browser Plugin
GNU General Public License v2.0
499 stars 48 forks source link

Can't compile on Ubuntu 18 #65

Closed noozo closed 6 years ago

noozo commented 6 years ago

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```
NexAdn commented 6 years ago

Could you please edit src/browser/browser-client.cpp and put #include <string> line 20: https://github.com/bazukas/obs-linuxbrowser/blob/fa4ed834fe969cdf46ead6b5d4dd850bb16887d6/src/browser/browser-client.cpp#L18-L22

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

noozo commented 6 years ago

No joy, still same error.

On Fri, May 18, 2018 at 11:38 AM NexAdn notifications@github.com wrote:

Could you please edit src/browser/browser-client.cpp and insert a new line with #include in this area:

https://github.com/bazukas/obs-linuxbrowser/blob/master/src/browser/browser-client.cpp#L18-L22

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bazukas/obs-linuxbrowser/issues/65#issuecomment-390167978, or mute the thread https://github.com/notifications/unsubscribe-auth/AAANGdk4sm_1ESnxV3tB11viUGJFEwERks5tzqSPgaJpZM4UEcfs .

noozo commented 6 years ago

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 ;))

NexAdn commented 6 years ago

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.

NexAdn commented 6 years ago

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

noozo commented 6 years ago

The patch worked, but now...


Scanning dependencies of target browser-subprocess
[  7%] Building C object CMakeFiles/obs-linuxbrowser.dir/src/plugin/main.c.o
[ 15%] Building C object
CMakeFiles/obs-linuxbrowser.dir/src/plugin/manager.c.o
/home/void/.config/obs-studio/plugins/obs-linuxbrowser/src/plugin/main.c:17:24:
fatal error: obs-module.h: No such file or directory
compilation terminated.
[ 23%] Building CXX object
CMakeFiles/browser.dir/src/browser/browser-client.cpp.o
CMakeFiles/obs-linuxbrowser.dir/build.make:62: recipe for target
'CMakeFiles/obs-linuxbrowser.dir/src/plugin/main.c.o' failed
make[2]: *** [CMakeFiles/obs-linuxbrowser.dir/src/plugin/main.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 30%] Building CXX object
CMakeFiles/browser-subprocess.dir/src/browser/browser-client.cpp.o
In file included from
/home/void/.config/obs-studio/plugins/obs-linuxbrowser/src/plugin/manager.c:27:0:
/home/void/.config/obs-studio/plugins/obs-linuxbrowser/src/plugin/manager.h:20:24:
fatal error: obs-module.h: No such file or directory
compilation terminated.
CMakeFiles/obs-linuxbrowser.dir/build.make:86: recipe for target
'CMakeFiles/obs-linuxbrowser.dir/src/plugin/manager.c.o' failed
make[2]: *** [CMakeFiles/obs-linuxbrowser.dir/src/plugin/manager.c.o] Error
1
CMakeFiles/Makefile2:104: recipe for target
'CMakeFiles/obs-linuxbrowser.dir/all' failed
make[1]: *** [CMakeFiles/obs-linuxbrowser.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 38%] Linking CXX executable build/obs-linuxbrowser/bin/64bit/browser
[ 46%] Linking CXX executable
build/obs-linuxbrowser/bin/64bit/browser-subprocess
[ 69%] Built target browser-subprocess
[ 92%] Built target browser
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2```
NexAdn commented 6 years ago

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 6 years ago

I have not... what should they be?

(the patch version worked)

Thanks again!

On Fri, May 18, 2018 at 12:42 PM NexAdn notifications@github.com wrote:

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?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bazukas/obs-linuxbrowser/issues/65#issuecomment-390181525, or mute the thread https://github.com/notifications/unsubscribe-auth/AAANGcrPOjTYoJ06B1BpIQL9uqPNj-e-ks5tzrOzgaJpZM4UEcfs .

NexAdn commented 6 years ago

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 6 years ago

Can't find either libobs.so or obs-module.h anywhere under my /usr folder :(

OBS installed via package manager. Also tried to find a -dev package, but none is available.

Downloaded the source for OBS and pointed OBS_INCLUDE as such, but no joy:

cmake -D CEF_DIR=/home/void/Downloads/cef_binary_3.3359.1774.gd49d25f_linux64 OBS_INCLUDE=/home/void/Downloads/obs-studio/libobs .. or OBS_INCLUDE=/home/void/Downloads/obs-studio/libobs cmake -D CEF_DIR=/home/void/Downloads/cef_binary_3.3359.1774.gd49d25f_linux64 ..

Either case still get obs-module.h: No such file or directory (and the file is confirmed to be there). I'm completely stumped on this :(

On Fri, May 18, 2018 at 2:20 PM NexAdn notifications@github.com wrote:

It normally not necessary to set these variables as OBS uses standard include paths per default. In #62 https://github.com/bazukas/obs-linuxbrowser/issues/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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bazukas/obs-linuxbrowser/issues/65#issuecomment-390204668, or mute the thread https://github.com/notifications/unsubscribe-auth/AAANGddgWFcm-0ep9h7GZfKauur1lhFjks5tzsqwgaJpZM4UEcfs .

NexAdn commented 6 years ago

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 6 years ago

Perfect!

Had to replace g++5 with g++6, but it works now.

Thanks!

On Fri, May 18, 2018 at 2:40 PM NexAdn notifications@github.com wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bazukas/obs-linuxbrowser/issues/65#issuecomment-390210301, or mute the thread https://github.com/notifications/unsubscribe-auth/AAANGcXgZeOdEknJdG6OMDJOdfVGHFJbks5tzs82gaJpZM4UEcfs .