Question / Help Error compiling obs-studio-24.0.3 on Gentoo

SodaScripter

New Member
Code:
soda@ChadTop obs-studio-24.0.3/build » make -j4
[  1%] Built target obspython_swig_compilation
[  2%] Built target media-playback
[  3%] Built target glad
[  3%] Built target obslua_swig_compilation
[  3%] Built target obs-ffmpeg-mux
[ 25%] Built target libobs
[ 26%] Built target file-updater
[ 27%] Built target obs-frontend-api
[ 29%] Built target linux-capture
[ 33%] Built target libobs-opengl
[ 35%] Built target linux-v4l2
[ 36%] Built target linux-pulseaudio
[ 37%] Built target linux-jack
[ 38%] Built target linux-alsa
[ 39%] Built target image-source
[ 40%] Built target obs-x264
[ 45%] Built target linux-decklink
[ 46%] Built target obs-libfdk
[ 50%] Built target obs-outputs
[ 53%] Built target obs-ffmpeg
[ 56%] Built target obs-transitions
[ 62%] Built target obs-filters
[ 63%] Built target rtmp-services
[ 65%] Built target text-freetype2
[ 65%] Automatic MOC for target obs
[ 65%] Automatic MOC for target decklink-ouput-ui
[ 65%] Building C object deps/obs-scripting/CMakeFiles/obs-scripting.dir/obs-scripting-lua.c.o
[ 65%] Built target decklink-ouput-ui_autogen
[ 65%] Built target obs_autogen
[ 69%] Built target decklink-ouput-ui
/home/soda/Downloads/OBS/obs-studio-24.0.3/deps/obs-scripting/obs-scripting-lua.c: In function ‘load_lua_script’:
/home/soda/Downloads/OBS/obs-studio-24.0.3/deps/obs-scripting/obs-scripting-lua.c:96:2: error: implicit declaration of function ‘luaopen_ffi’; did you mean ‘luaopen_utf8’? [-Werror=implicit-function-declaration]
  luaopen_ffi(script);
  ^~~~~~~~~~~
  luaopen_utf8
[ 69%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-settings.cpp.o
[ 69%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-main.cpp.o
[ 70%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-interaction.cpp.o
cc1: some warnings being treated as errors
make[2]: *** [deps/obs-scripting/CMakeFiles/obs-scripting.dir/build.make:136: deps/obs-scripting/CMakeFiles/obs-scripting.dir/obs-scripting-lua.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:331: deps/obs-scripting/CMakeFiles/obs-scripting.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 70%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-properties.cpp.o
[ 70%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-auto-config.cpp.o
[ 71%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-main-outputs.cpp.o
[ 71%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-source-select.cpp.o
[ 71%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-settings-stream.cpp.o
[ 71%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-auto-config-test.cpp.o
[ 72%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-main-scene-collections.cpp.o
[ 72%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-main-transitions.cpp.o
[ 72%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-main-dropfiles.cpp.o
[ 73%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-main-profiles.cpp.o
[ 73%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-main-browser.cpp.o
[ 73%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-status-bar.cpp.o
[ 74%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-adv-audio.cpp.o
[ 74%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-transform.cpp.o
[ 74%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-preview.cpp.o
[ 74%] Building CXX object UI/CMakeFiles/obs.dir/window-basic-about.cpp.o
[ 75%] Building CXX object UI/CMakeFiles/obs.dir/window-namedialog.cpp.o
[ 75%] Building CXX object UI/CMakeFiles/obs.dir/window-log-reply.cpp.o
[ 75%] Building CXX object UI/CMakeFiles/obs.dir/window-projector.cpp.o
[ 76%] Building CXX object UI/CMakeFiles/obs.dir/window-remux.cpp.o
[ 76%] Building CXX object UI/CMakeFiles/obs.dir/auth-base.cpp.o
[ 76%] Building CXX object UI/CMakeFiles/obs.dir/source-tree.cpp.o
[ 76%] Building CXX object UI/CMakeFiles/obs.dir/properties-view.cpp.o
[ 77%] Building CXX object UI/CMakeFiles/obs.dir/focus-list.cpp.o
[ 77%] Building CXX object UI/CMakeFiles/obs.dir/menu-button.cpp.o
[ 77%] Building CXX object UI/CMakeFiles/obs.dir/double-slider.cpp.o
[ 78%] Building CXX object UI/CMakeFiles/obs.dir/slider-ignorewheel.cpp.o
[ 78%] Building CXX object UI/CMakeFiles/obs.dir/combobox-ignorewheel.cpp.o
[ 78%] Building CXX object UI/CMakeFiles/obs.dir/spinbox-ignorewheel.cpp.o
[ 79%] Building CXX object UI/CMakeFiles/obs.dir/record-button.cpp.o
[ 79%] Building CXX object UI/CMakeFiles/obs.dir/volume-control.cpp.o
[ 79%] Building CXX object UI/CMakeFiles/obs.dir/adv-audio-control.cpp.o
[ 79%] Building CXX object UI/CMakeFiles/obs.dir/item-widget-helpers.cpp.o
[ 80%] Building CXX object UI/CMakeFiles/obs.dir/horizontal-scroll-area.cpp.o
[ 80%] Building CXX object UI/CMakeFiles/obs.dir/vertical-scroll-area.cpp.o
[ 80%] Building CXX object UI/CMakeFiles/obs.dir/visibility-item-widget.cpp.o
[ 81%] Building CXX object UI/CMakeFiles/obs.dir/slider-absoluteset-style.cpp.o
[ 81%] Building CXX object UI/CMakeFiles/obs.dir/qt-display.cpp.o
[ 81%] Building CXX object UI/CMakeFiles/obs.dir/crash-report.cpp.o
[ 81%] Building CXX object UI/CMakeFiles/obs.dir/hotkey-edit.cpp.o
[ 82%] Building CXX object UI/CMakeFiles/obs.dir/source-label.cpp.o
[ 82%] Building CXX object UI/CMakeFiles/obs.dir/remote-text.cpp.o
[ 82%] Building CXX object UI/CMakeFiles/obs.dir/audio-encoders.cpp.o
[ 83%] Building CXX object UI/CMakeFiles/obs.dir/qt-wrappers.cpp.o
[ 83%] Building CXX object UI/CMakeFiles/obs.dir/qrc_obs.cpp.o
[ 83%] Linking CXX executable obs
[ 91%] Built target obs
make: *** [Makefile:152: all] Error 2
soda@ChadTop obs-studio-24.0.3/build »
 

OdatNurd

New Member
I'm not sure if you managed to resolve this or not, but I thought I'd chime in here anyway because when the same thing happened to me (on SlackWare) this was one of the Google hits while I was casting around to see if it was a known thing or not.

The reason for this error is having a copy of standard Lua installed in /usr/local (i.e. you compiled it yourself instead of installing a package, most likely). The rules in cmake/modules/FindLuajit.cmake look for the the lua.h and lualib.h header files in a series of directories, and it would appear that the order of the searches allows it to find the headers in /usr/local/include before it gets to the correct location of /usr/include/luajit-2.0 (in my particular case, anyway). If Lua is installed in /usr instead of /usr/local, the correct header files are found first.

The libraries are found correctly because they have a different name (LuaJIT mimics the headers from standard Lua), so adding something like -DLUAJIT_INCLUDE_DIR=/usr/include/luajit-2.0/ to the initial cmake line when you're setting up the build to point to the correct include location resolves the issue.

I'm not familiar enough with cmake to know if the search order can be influenced (or if that's an obs thing or something to be taken up with cmake directly), but it seems like it would be a better idea to always look explicitly for files in the luajit-2.0 directories in all locations first before dropping down to the standard include directory, just for safety.
 
Top