Packaging OBS Studio for MacPorts: "failed to find/load locale"

dliessi

New Member
Dear developers,
I'm preparing a Portfile to make OBS Studio available in MacPorts.
Basically, I need a Unix style installation under MacPorts' prefix (/opt/local).
I configure using cmake with the following options (most are standard cmake options in MacPorts):

Code:
-G "CodeBlocks - Unix Makefiles"
-DCMAKE_BUILD_TYPE=MacPorts
-DCMAKE_INSTALL_PREFIX="/opt/local"
-DCMAKE_INSTALL_NAME_DIR="/opt/local/lib"
-DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr"
-DCMAKE_C_COMPILER="$CC"
-DCMAKE_CXX_COMPILER="$CXX"
-DCMAKE_POLICY_DEFAULT_CMP0025=NEW
-DCMAKE_POLICY_DEFAULT_CMP0060=NEW
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_COLOR_MAKEFILE=ON
-DCMAKE_FIND_FRAMEWORK=LAST
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_MAKE_PROGRAM=/usr/bin/make
-DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules"
-DCMAKE_PREFIX_PATH="/opt/local/share/cmake/Modules"
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON
-DCMAKE_INSTALL_RPATH="/opt/local/lib"
-Wno-dev
-DPYTHON_EXECUTABLE=/opt/local/bin/python3.7
-DPYTHON_INCLUDE_DIR=/opt/local/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m
-DPYTHON_LIBRARY=/opt/local/Library/Frameworks/Python.framework/Versions/3.7/Python
-DUNIX_STRUCTURE=1
-DCMAKE_OSX_ARCHITECTURES="x86_64"
-DCMAKE_OSX_DEPLOYMENT_TARGET="10.13"
-DCMAKE_OSX_SYSROOT="/"

After that, make and make install apparently succeed (I can provide the full list of installed files, if needed), but when I run obs from the Terminal I get two dialog boxes with the errors "Failed to find locale/en-US.ini" and "Failed to load locale" and the program exits with this message in the Terminal:

Code:
error: Failed to load locale
info: == Profiler Results =============================
info: run_program_init: 29306,4 ms
info:  ┗OBSApp::AppInit: 13348,8 ms
info:    ┗OBSApp::InitLocale: 13348,4 ms
info: =================================================
info: == Profiler Time Between Calls ==================
info: =================================================
info: Number of memory leaks: 1

Is there anything I should add to the cmake options?
Can you give any hint on how I can solve the problem?

Thanks and best wishes.
Davide
 

dliessi

New Member
That would be a solution if I were building without the -DUNIX_STRUCTURE=1 option.
On Linux I can run the obs binary from any directory: I would expect the same behaviour on Mac when building with that option.
Anyway, I tried that too and I got the same errors.
 

dliessi

New Member
This is the full list of commands executed by the current build process.
Most variable values are set by MacPorts, but they can be changed if needed.

Code:
/usr/bin/git clone --progress https://github.com/obsproject/obs-studio.git /opt/local/var/macports/build/_opt_macports-git_macports-ports_multimedia_obs-studio/obs-studio/work/obs-studio-25.0.8 2>&1
GIT_DIR=/opt/local/var/macports/build/_opt_macports-git_macports-ports_multimedia_obs-studio/obs-studio/work/obs-studio-25.0.8/.git GIT_WORK_TREE=/opt/local/var/macports/build/_opt_macports-git_macports-ports_multimedia_obs-studio/obs-studio/work/obs-studio-25.0.8 /usr/bin/git checkout -q 25.0.8 2>&1
cd /opt/local/var/macports/build/_opt_macports-git_macports-ports_multimedia_obs-studio/obs-studio/work/obs-studio-25.0.8
git submodule update --init
/usr/bin/patch -p0 < '/opt/macports-git/macports-ports/multimedia/obs-studio/files/patch-unix_structure-apple.diff'
cd "/opt/local/var/macports/build/_opt_macports-git_macports-ports_multimedia_obs-studio/obs-studio/work/build"
/opt/local/bin/cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="/opt/local" -DCMAKE_INSTALL_NAME_DIR="/opt/local/lib" -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_POLICY_DEFAULT_CMP0060=NEW -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules" -DCMAKE_PREFIX_PATH="/opt/local/share/cmake/Modules" -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON -DCMAKE_INSTALL_RPATH="/opt/local/lib" -Wno-dev -DPYTHON_EXECUTABLE=/opt/local/bin/python3.7 -DPYTHON_INCLUDE_DIR=/opt/local/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -DPYTHON_LIBRARY=/opt/local/Library/Frameworks/Python.framework/Versions/3.7/Python -DUNIX_STRUCTURE=1 -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.13" -DCMAKE_OSX_SYSROOT="/" /opt/local/var/macports/build/_opt_macports-git_macports-ports_multimedia_obs-studio/obs-studio/work/obs-studio-25.0.8
/usr/bin/make -j4 -w all VERBOSE=ON
/usr/bin/make -w install/fast DESTDIR=/opt/local/var/macports/build/_opt_macports-git_macports-ports_multimedia_obs-studio/obs-studio/work/destroot

The files in the destroot directory are then tar+bzip2'ed and the archive is then expanded into MacPorts' prefix (usually /opt/local), which contains the usual bin, etc, include, lib, share, var directories.

Ideally the user should be able to run obs from any working directory, as it happens on Linux.
 

dliessi

New Member
I forgot the content of patch-unix_structure-apple.diff:
Code:
diff --git cmake/Modules/ObsHelpers.cmake cmake/Modules/ObsHelpers.cmake
index cb63ba61..5d497f04 100644
--- cmake/Modules/ObsHelpers.cmake
+++ cmake/Modules/ObsHelpers.cmake
@@ -556,7 +556,7 @@ function(define_graphic_modules target)
     foreach(dl_lib opengl d3d9 d3d11)
         string(TOUPPER ${dl_lib} dl_lib_upper)
         if(TARGET libobs-${dl_lib})
-            if(UNIX AND UNIX_STRUCTURE)
+            if(UNIX AND UNIX_STRUCTURE AND NOT APPLE)
                 target_compile_definitions(${target}
                     PRIVATE
                     DL_${dl_lib_upper}="$<TARGET_SONAME_FILE_NAME:libobs-${dl_lib}>"
 
Top