[Bf-blender-cvs] [b555b8dedce] master: Build: hide most symbols on macOS on Linux to avoid conflicts

Brecht Van Lommel noreply at git.blender.org
Tue Mar 31 00:08:30 CEST 2020


Commit: b555b8dedce058985bfe8c544c8c46ba4821bc1a
Author: Brecht Van Lommel
Date:   Mon Mar 30 21:24:13 2020 +0200
Branches: master
https://developer.blender.org/rBb555b8dedce058985bfe8c544c8c46ba4821bc1a

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

===================================================================

M	build_files/cmake/platform/platform_apple.cmake
M	build_files/cmake/platform/platform_unix.cmake
M	source/creator/blender.map
M	source/creator/osx_locals.map

===================================================================

diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake
index 11889fc7a87..620a078f412 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -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++")
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index dcb6b9d34f9..c034e7028af 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -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'"
+)
diff --git a/source/creator/blender.map b/source/creator/blender.map
index 4c34dea3338..3e447ec9e89 100644
--- a/source/creator/blender.map
+++ b/source/creator/blender.map
@@ -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*;
 };
-
diff --git a/source/creator/osx_locals.map b/source/creator/osx_locals.map
index 3382ac954e2..908bfdae6cb 100644
--- a/source/creator/osx_locals.map
+++ b/source/creator/osx_locals.map
@@ -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*



More information about the Bf-blender-cvs mailing list