UI: Link python when obs-scripting python is enabled

This fixes #2222 by ensuring python symbols are in the global symbol
table through a direct linkage to the executable. When python is
normally linked via frontend-tools.so its symbols are not global since
we dlopen frontend-tools.so. This causes issues for native python
modules which stopped directly linking python around 3.8 as the symbols
will not resolve.

This is pretty much a hack, but it minimizes the number of extra symbols
we add and hopefully isnt too terrible to maintain.
master
Kurt Kartaltepe 2021-11-09 21:58:42 -08:00 committed by Jim
parent 88aec3b43c
commit 1017cd5430
1 changed files with 11 additions and 0 deletions

View File

@ -148,6 +148,7 @@ elseif(APPLE)
elseif(UNIX)
find_package(Qt5Gui REQUIRED)
find_package(PythonDeps QUIET)
include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
@ -159,6 +160,16 @@ elseif(UNIX)
Qt5::Gui
Qt5::GuiPrivate)
# python symbols must be in the global symbol table
# so we link the main executable to python if we expect
# obs-scripting python support to be enabled.
# see: https://github.com/obsproject/obs-studio/issues/2222 and https://bugs.python.org/issue36721
if(NOT DISABLE_PYTHON AND PYTHONLIBS_FOUND)
set(obs_PLATFORM_LIBRARIES
${obs_PLATFORM_LIBRARIES}
${PYTHON_LIBRARIES})
endif()
if("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
list(APPEND obs_PLATFORM_LIBRARIES
procstat)