Build: hide most symbols on macOS on Linux to avoid conflicts

This means symbols from Blender itself and most external libraries. We can't
just hide all because that breaks some libraries. The better solution would
be to rebuild all library dependencies with hidden visibility.

Fixes T75223: Luxrender add-on failing to load on macOS
This commit is contained in:
Brecht Van Lommel 2020-03-30 21:24:13 +02:00
parent 899bfdc412
commit b555b8dedc
Notes: blender-bot 2023-02-14 18:58:53 +01:00
Referenced by commit bae1c243ce, Build: hide USD symbols, make Blender symbols visible again
Referenced by issue blender/blender-addons#75223, Blender 2.82+ crash on MacOS when enabling BlendLuxCore LuxCoreRender addon.
4 changed files with 137 additions and 28 deletions

View File

@ -449,10 +449,13 @@ if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)
# Xcode 5 is always using CLANG, which has too low template depth of 128 for libmv
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=1024")
endif()
# Get rid of eventually clashes, we export some symbols explicitly as local
# Avoid conflicts with Luxrender, and other plug-ins that may use the same
# libraries as Blender with a different version or build options.
set(PLATFORM_LINKFLAGS
"${PLATFORM_LINKFLAGS} -Xlinker -unexported_symbols_list -Xlinker '${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map'"
)
set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -fvisibility=hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -stdlib=libc++")

View File

@ -405,13 +405,6 @@ if(WITH_LLVM)
endif()
endif()
if(WITH_LLVM OR WITH_SDL_DYNLOAD)
# Fix for conflict with Mesa llvmpipe
set(PLATFORM_LINKFLAGS
"${PLATFORM_LINKFLAGS} -Wl,--version-script='${CMAKE_SOURCE_DIR}/source/creator/blender.map'"
)
endif()
if(WITH_OPENSUBDIV)
find_package_wrapper(OpenSubdiv)
@ -601,3 +594,10 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-intel")
endif()
# Avoid conflicts with Mesa llvmpipe, Luxrender, and other plug-ins that may
# use the same libraries as Blender with a different version or build options.
set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -fvisibility=hidden")
set(PLATFORM_LINKFLAGS
"${PLATFORM_LINKFLAGS} -Wl,--version-script='${CMAKE_SOURCE_DIR}/source/creator/blender.map'"
)

View File

@ -6,21 +6,71 @@
{
global:
*;
*_boost*;
*;
*_boost*;
local:
*default_error_condition*;
*llvm*;
*LLVM*;
decodeInstruction;
ForceStackAlign;
_Jv_RegisterClasses;
Name;
NumNamedVarArgParams;
X86CompilationCallback*;
*boost*;
*SDL*;
*embree*;
cu*;
al*;
*Alembic*;
av*;
blosc*;
*boost*;
*ceres*;
*cineon*;
*COLLADA*;
cu*;
decodeInstruction;
*default_error_condition*;
*dpx*;
*embree*;
ff_*;
fftw*;
FLAC*;
ForceStackAlign;
FT_*;
*GeneratedSaxParser*;
*google*;
gsm*;
Gsm*;
html*;
id3tag*;
*Iex*;
*Ilm*;
*Imath*;
*Imf*;
jack_*;
jpeg_*;
jsimd**;
_Jv_RegisterClasses;
lame_*;
*llvm*;
*LLVM*;
*MathML*;
*mkldnn*;
Name;
NumNamedVarArgParams;
oc_*;
ogg*;
*oidn*;
*OpenColorIO*;
*OpenImageIO*;
*OpenSubdiv*;
*openvdb*;
opj_*;
opus_*;
*OSL*;
png_*;
*SDL*;
*squish*;
*tbb*;
*TIFF*;
*tinyformat*;
vorbis*;
vp8*;
vp9*;
vpx*;
x264_*;
X86CompilationCallback*;
xml*;
xvid*;
*YAML*;
};

View File

@ -1,10 +1,66 @@
## The symbols will be treated as if they were marked as __private_extern__
## (aka visibility=hidden) and will not be global in the output file
al*
*Alembic*
av*
blosc*
*boost*
*__ZNSt6vector*
*ceres*
*cineon*
*COLLADA*
cu*
decodeInstruction
*default_error_condition*
*dpx*
*embree*
ff_*
fftw*
FLAC*
ForceStackAlign
FT_*
*GeneratedSaxParser*
*google*
gsm*
Gsm*
html*
id3tag*
*Iex*
*Ilm*
*Imath*
*Imf*
jack_*
jpeg_*
jsimd**
_Jv_RegisterClasses
lame_*
*llvm*
*LLVM*
*MathML*
*mkldnn*
Name
NumNamedVarArgParams
oc_*
ogg*
*oidn*
*OpenColorIO*
*OpenImageIO*
*OpenSubdiv*
*openvdb*
opj_*
opus_*
*OSL*
*embree*
cu*
png_*
*SDL*
*squish*
*tbb*
*TIFF*
*tinyformat*
vorbis*
vp8*
vp9*
vpx*
x264_*
X86CompilationCallback*
xml*
xvid*
*YAML*