[Bf-blender-cvs] [ab65fe5a2dc] master: Fluid: Use hidden symbol visibility

Sebastián Barschkis noreply at git.blender.org
Mon Oct 12 12:45:16 CEST 2020


Commit: ab65fe5a2dcca9cb5de14eaeabe5a441bc41f15a
Author: Sebastián Barschkis
Date:   Fri Sep 25 10:17:10 2020 +0200
Branches: master
https://developer.blender.org/rBab65fe5a2dcca9cb5de14eaeabe5a441bc41f15a

Fluid: Use hidden symbol visibility

This resolves a long list of linker warnings that is currently only showing up on macOS arm builds.
The warnings themselves are of this shape (one example):

```
ld: warning: direct access in function 'Manta::MeshDataImpl<Manta::Vector3D<float> >::_W_39(_object, object, object*)' from file '../../lib/libextern_mantaflow.a(mesh.h.reg.cpp.o)' to global weak symbol 'typeinfo for Manta::MeshDataImpl<Manta::Vector3D<float> >' from file '../../lib/libextern_mantaflow.a(mesh.cpp.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
```

Just would like to get your opinion to make sure this is an acceptable way to handle this on all platforms.

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D9002

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

M	extern/mantaflow/CMakeLists.txt

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

diff --git a/extern/mantaflow/CMakeLists.txt b/extern/mantaflow/CMakeLists.txt
index 8bb0bc69f98..fe6c72660e0 100644
--- a/extern/mantaflow/CMakeLists.txt
+++ b/extern/mantaflow/CMakeLists.txt
@@ -31,6 +31,17 @@ if(MSVC_CLANG AND WITH_OPENMP AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.1
   remove_cc_flag("-fopenmp")
 endif()
 
+# Exporting functions from the blender binary gives linker warnings on Apple arm64 systems.
+# For now and until Apple arm64 is officially supported, these will just be silenced here.
+# TODO (sebbas): Check if official arm64 devices give linker warnings without this block.
+
+if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))
+  if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+  endif()
+endif()
+
 set(MANTAVERSION "0.13")
 
 add_definitions(-DWITH_FLUID=1)



More information about the Bf-blender-cvs mailing list