Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LZ4 test functions exposed, causing linker errors #1447

Closed
sybrenstuvel opened this issue Feb 9, 2021 · 2 comments
Closed

LZ4 test functions exposed, causing linker errors #1447

sybrenstuvel opened this issue Feb 9, 2021 · 2 comments

Comments

@sybrenstuvel
Copy link

sybrenstuvel commented Feb 9, 2021

Description of Issue

Blender cannot link against USD library version 21.02, because the latter exports the names LZ4_compress_forceExtDict and LZ4_decompress_safe_forceExtDict.

This issue was likely introduced in commit df48692. As you can see in the commit message of 4da033b, the LZ4 symbols are supposed to be encapsulated in a C++ namespace. However, since df48692 these two symbols are marked as export "C" and thus collide with other libraries.

Steps to Reproduce

  1. Build USD as static library
  2. Run nm -C libusd_m.a | grep LZ4
  3. See that LZ4_compress_forceExtDict and LZ4_decompress_safe_forceExtDict are listed.

System Information (OS, Hardware)

Kubuntu Linux 20.04 and CentOS 7

Package Versions

USD 21.02

Build Flags

We build with these extra flags, to ensure that USD uses the correct precompiled libraries used to build Blender:

  -DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
  -DBoost_USE_MULTITHREADED=ON
  -DBoost_USE_STATIC_LIBS=ON
  -DBoost_USE_STATIC_RUNTIME=OFF
  -DBOOST_ROOT=${LIBDIR}/boost
  -DBoost_NO_SYSTEM_PATHS=ON
  -DBoost_NO_BOOST_CMAKE=ON
  -DTBB_INCLUDE_DIRS=${LIBDIR}/tbb/include
  -DTBB_LIBRARIES=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
  -DTbb_TBB_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
  # USD wants the tbb debug lib set even when you are doing a release build
  # Otherwise it will error out during the cmake configure phase.
  -DTBB_LIBRARIES_DEBUG=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}

  # This is a preventative measure that avoids possible conflicts when add-ons
  # try to load another USD library into the same process space.
  -DPXR_SET_INTERNAL_NAMESPACE=usdBlender

  -DPXR_ENABLE_PYTHON_SUPPORT=OFF
  -DPXR_BUILD_IMAGING=OFF
  -DPXR_BUILD_TESTS=OFF
  -DBUILD_SHARED_LIBS=OFF
  -DPYTHON_EXECUTABLE=${PYTHON_BINARY}
  -DPXR_BUILD_MONOLITHIC=ON
  -DPXR_BUILD_USD_TOOLS=OFF

  -DCMAKE_DEBUG_POSTFIX=_d
  # USD is hellbound on making a shared lib, unless you point this variable to a valid cmake file
  # doesn't have to make sense, but as long as it points somewhere valid it will skip the shared lib.
  -DPXR_MONOLITHIC_IMPORT=${BUILD_DIR}/usd/src/external_usd/cmake/defaults/Version.cmake
@jilliene
Copy link

jilliene commented Feb 9, 2021

Filed as internal issue #USD-6563

@gitamohr
Copy link
Contributor

Oof. Sorry for the trouble here. I'll get it fixed up.

Travis-OBrien pushed a commit to Travis-OBrien/blender that referenced this issue Feb 28, 2021
USD version 21.02 includes two of the changes Blender used to patch in,
which have now been removed from `usd.diff`. Unfortunately 21.02
introduces another issue where LZ4 symbols are accidentally exported,
causing linker errors. Fortunately these symbols are only used for
resting, so I added a patch hunk that simply removes their `extern "C"`
declaration.

The LZ4 linker issue has been reported upstream at
PixarAnimationStudios/OpenUSD#1447.

Reviewed By: sebbas, mont29

Differential Revision: https://developer.blender.org/D10367
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants