Build: Hide PugiXML symbols from MaterialX on Linux

This change uses a symbol map to hide PugiXML symbols from MaterialX libraries
when dependencies are built. This avoids conflict with symbols from pugixml.a
used by Blender for the Grease Pencil SVG exporter.

The root cause of the conflict has been addressed upstream:

  https://github.com/AcademySoftwareFoundation/MaterialX/pull/1944

However, the patch does not cleanly apply on 1.38, and it not cleat when the
next 1.39 is released. Additional complication is that reportedly USD does
not yet support MaterialX 1.39.

This fix is only for Linux. Similar thing can be applied on macOS, however so
far I could not reproduce the issue on macOS.

Ref #124173

Pull Request: https://projects.blender.org/blender/blender/pulls/126518
This commit is contained in:
Sergey Sharybin
2024-10-04 11:16:05 +02:00
committed by Sergey Sharybin
parent 63650461b7
commit 680a80d61c
2 changed files with 11 additions and 0 deletions
@@ -26,6 +26,12 @@ if(WIN32)
LIST(APPEND MATERIALX_EXTRA_ARGS -DPYTHON_LIBRARIES=${LIBDIR}/python/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}${PYTHON_POSTFIX}.lib)
endif()
if(UNIX AND NOT APPLE)
LIST(APPEND MATERIALX_EXTRA_ARGS
-DCMAKE_SHARED_LINKER_FLAGS=-Wl,--version-script="${CMAKE_SOURCE_DIR}/linux/materialx_symbols_unix.map"
)
endif()
ExternalProject_Add(external_materialx
URL file://${PACKAGE_DIR}/${MATERIALX_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
@@ -0,0 +1,5 @@
/* Hide PugiXML symbols until MaterialX is upgraded to 1.39+ */
{
local:
*pugi*;
};