Error with building Adobe file-format plugin

I am working on a project that requires converting obj files to usd and I received a suggestion to look into the Adobe plugin here. I am building on an AWS EC2 instance running Ubuntu. I guess this isn’t directly OpenUSD related, but I’m a little lost with this output:

ubuntu@ip-172-31-23-122:~/USD-Fileformat-plugins$ cmake --build build
[  1%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[  3%] Linking CXX static library ../../../lib/libgtest.a
[  3%] Built target gtest
[  5%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/test.cpp.o
[  7%] Linking CXX shared library libfileformatUtils.so
[ 37%] Built target fileformatUtils
[ 39%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[ 41%] Linking CXX static library ../../../lib/libgtest_main.a
[ 41%] Built target gtest_main
[ 47%] Built target fmt
[ 49%] Linking CXX shared library libusdObj.so
[ 62%] Built target usdObj
[ 64%] Building CXX object obj/tests/CMakeFiles/objSanityTests.dir/sanityTests.cpp.o
[ 66%] Linking CXX executable objSanityTests
/usr/bin/ld: CMakeFiles/objSanityTests.dir/sanityTests.cpp.o: in function `OBJSanityTests_LoadCube_Test::TestBody()':
sanityTests.cpp:(.text+0xae): undefined reference to `pxrInternal_v0_24__pxrReserved__::UsdStage::Open(std::string const&, pxrInternal_v0_24__pxrReserved__::UsdStage::InitialLoadSet)'
collect2: error: ld returned 1 exit status
gmake[2]: *** [obj/tests/CMakeFiles/objSanityTests.dir/build.make:117: obj/tests/objSanityTests] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:454: obj/tests/CMakeFiles/objSanityTests.dir/all] Error 2
gmake: *** [Makefile:166: all] Error 2

It’s not exactly verbose so I was hoping it would look familiar to someone here. I used the suggested build commands but for the options I disabled fbx and gltf. I was getting similar errors for the sanity tests for those but disabled them since I only need obj support. It is also worth mentioning that I was getting errors building draco due to some source files missing include statements like the following:

/home/ubuntu/USD_Adobe/src/draco-1.3.6/src/draco/core/hash_utils.h:27:1: error: ‘size_t’ does not name a type
   27 | size_t HashCombine(T1 a, T2 b) {
      | ^~~~~~
/home/ubuntu/USD_Adobe/src/draco-1.3.6/src/draco/core/hash_utils.h:21:1: note: ‘size_t’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’?
   20 | #include <functional>
  +++ |+#include <cstddef>
   21 | 
/home/ubuntu/USD_Adobe/src/draco-1.3.6/src/draco/core/hash_utils.h:34:1: error: ‘size_t’ does not name a type
   34 | size_t HashCombine(T a, size_t hash) {

I went into the OpenUSD python build script and updated the draco version to 1.5.6, which happened to have those missing include statements in the error output.

Hey thanks for posting, feel free to make a git issue on the plugin repository itself if you run into any issues with the plugins. We are monitoring those closely.

As for your issue, the dependencies can get complicated. I’m curious which version of USD you are using? Are you still having an issue, or are things working now that you updated your script locally?

The plugin docs do mention draco 1.5.6 ( adobe/USD-Fileformat-plugins: A collection of USD fileformat plugins (github.com)). Depending on your use case it may make sense not to build draco with USD and set -DUSD_FILEFORMATS_FETCH_DRACO to true when building the plugin to pull down the version needed by them.

My USD version is 0.24.3. Updating the OpenUSD build script to use draco 1.5.6 solved the draco issues, but not the objSanityTests issue. I used the build command cmake -S . -B build -DCMAKE_INSTALL_PREFIX=bin -DCMAKE_BUILD_TYPE=Release -DUSD_FILEFORMATS_FETCH_DRACO=ON -DUSD_FILEFORMATS_ENABLE_FBX=OFF -DUSD_FILEFORMATS_ENABLE_GLTF=OFF after rebuilding OpenUSD without the --draco tag. Unfortunately that doesn’t fix the issue either.

Here’s a full log of the build:

ubuntu@ip-172-31-23-122:~/USD-Fileformat-plugins$ cmake --build build
[  1%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[  3%] Linking CXX static library ../../../lib/libgtest.a
[  3%] Built target gtest
[  5%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/assetresolver.cpp.o
[  7%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/common.cpp.o
[  9%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/dictencoder.cpp.o
[ 11%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/geometry.cpp.o
/home/ubuntu/USD-Fileformat-plugins/utils/geometry.cpp: In instantiation of ‘void adobe::usd::mapPrimvarWithReverseIndex(const ReverseIndex&, const VtIntArray&, adobe::usd::Primvar<T>&) [with T = pxrInternal_v0_24__pxrReserved__::GfVec3f; adobe::usd::ReverseIndex = std::vector<int>; pxrInternal_v0_24__pxrReserved__::VtIntArray = pxrInternal_v0_24__pxrReserved__::VtArray<int>]’:
/home/ubuntu/USD-Fileformat-plugins/utils/geometry.cpp:638:35:   required from ‘void adobe::usd::mapPrimvarToTriangulatedMesh(const ReverseIndex&, const ReverseIndex&, const VtIntArray&, const string&, adobe::usd::Primvar<T>&) [with T = pxrInternal_v0_24__pxrReserved__::GfVec3f; adobe::usd::ReverseIndex = std::vector<int>; pxrInternal_v0_24__pxrReserved__::VtIntArray = pxrInternal_v0_24__pxrReserved__::VtArray<int>; std::string = std::basic_string<char>]’
/home/ubuntu/USD-Fileformat-plugins/utils/geometry.cpp:797:33:   required from here
/home/ubuntu/USD-Fileformat-plugins/utils/geometry.cpp:593:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  593 |                 if (j >= numValues) {
      |                     ~~^~~~~~~~~~~~
/home/ubuntu/USD-Fileformat-plugins/utils/geometry.cpp: In instantiation of ‘void adobe::usd::mapPrimvarWithReverseIndex(const ReverseIndex&, const VtIntArray&, adobe::usd::Primvar<T>&) [with T = pxrInternal_v0_24__pxrReserved__::GfVec4f; adobe::usd::ReverseIndex = std::vector<int>; pxrInternal_v0_24__pxrReserved__::VtIntArray = pxrInternal_v0_24__pxrReserved__::VtArray<int>]’:
/home/ubuntu/USD-Fileformat-plugins/utils/geometry.cpp:638:35:   required from ‘void adobe::usd::mapPrimvarToTriangulatedMesh(const ReverseIndex&, const ReverseIndex&, const VtIntArray&, const string&, adobe::usd::Primvar<T>&) [with T = pxrInternal_v0_24__pxrReserved__::GfVec4f; adobe::usd::ReverseIndex = std::vector<int>; pxrInternal_v0_24__pxrReserved__::VtIntArray = pxrInternal_v0_24__pxrReserved__::VtArray<int>; std::string = std::basic_string<char>]’
/home/ubuntu/USD-Fileformat-plugins/utils/geometry.cpp:799:33:   required from here
/home/ubuntu/USD-Fileformat-plugins/utils/geometry.cpp:593:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
/home/ubuntu/USD-Fileformat-plugins/utils/geometry.cpp: In instantiation of ‘void adobe::usd::mapPrimvarWithReverseIndex(const ReverseIndex&, const VtIntArray&, adobe::usd::Primvar<T>&) [with T = pxrInternal_v0_24__pxrReserved__::GfVec2f; adobe::usd::ReverseIndex = std::vector<int>; pxrInternal_v0_24__pxrReserved__::VtIntArray = pxrInternal_v0_24__pxrReserved__::VtArray<int>]’:
/home/ubuntu/USD-Fileformat-plugins/utils/geometry.cpp:638:35:   required from ‘void adobe::usd::mapPrimvarToTriangulatedMesh(const ReverseIndex&, const ReverseIndex&, const VtIntArray&, const string&, adobe::usd::Primvar<T>&) [with T = pxrInternal_v0_24__pxrReserved__::GfVec2f; adobe::usd::ReverseIndex = std::vector<int>; pxrInternal_v0_24__pxrReserved__::VtIntArray = pxrInternal_v0_24__pxrReserved__::VtArray<int>; std::string = std::basic_string<char>]’
/home/ubuntu/USD-Fileformat-plugins/utils/geometry.cpp:801:33:   required from here
/home/ubuntu/USD-Fileformat-plugins/utils/geometry.cpp:593:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
/home/ubuntu/USD-Fileformat-plugins/utils/geometry.cpp: In instantiation of ‘void adobe::usd::mapPrimvarWithReverseIndex(const ReverseIndex&, const VtIntArray&, adobe::usd::Primvar<T>&) [with T = float; adobe::usd::ReverseIndex = std::vector<int>; pxrInternal_v0_24__pxrReserved__::VtIntArray = pxrInternal_v0_24__pxrReserved__::VtArray<int>]’:
/home/ubuntu/USD-Fileformat-plugins/utils/geometry.cpp:638:35:   required from ‘void adobe::usd::mapPrimvarToTriangulatedMesh(const ReverseIndex&, const ReverseIndex&, const VtIntArray&, const string&, adobe::usd::Primvar<T>&) [with T = float; adobe::usd::ReverseIndex = std::vector<int>; pxrInternal_v0_24__pxrReserved__::VtIntArray = pxrInternal_v0_24__pxrReserved__::VtArray<int>; std::string = std::basic_string<char>]’
/home/ubuntu/USD-Fileformat-plugins/utils/geometry.cpp:808:37:   required from here
/home/ubuntu/USD-Fileformat-plugins/utils/geometry.cpp:593:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
[ 13%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/transforms.cpp.o
[ 15%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/images.cpp.o
[ 16%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/layerRead.cpp.o
[ 18%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/layerWriteShared.cpp.o
[ 20%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/layerWriteMaterial.cpp.o
[ 22%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/layerWriteMaterialX.cpp.o
[ 24%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/layerWriteSdfData.cpp.o
[ 26%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/materials.cpp.o
[ 28%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/resolver.cpp.o
[ 30%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/sdfMaterialUtils.cpp.o
[ 32%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/sdfUtils.cpp.o
[ 33%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/test.cpp.o
[ 35%] Building CXX object utils/CMakeFiles/fileformatUtils.dir/usdData.cpp.o
[ 37%] Linking CXX shared library libfileformatUtils.so
[ 37%] Built target fileformatUtils
[ 39%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[ 41%] Linking CXX static library ../../../lib/libgtest_main.a
[ 41%] Built target gtest_main
[ 43%] Building CXX object _deps/fmt-build/CMakeFiles/fmt.dir/src/format.cc.o
[ 45%] Building CXX object _deps/fmt-build/CMakeFiles/fmt.dir/src/os.cc.o
[ 47%] Linking CXX static library libfmt.a
[ 47%] Built target fmt
[ 49%] Building CXX object obj/src/CMakeFiles/usdObj.dir/cmake_pch.hxx.gch
[ 50%] Building CXX object obj/src/CMakeFiles/usdObj.dir/debugCodes.cpp.o
[ 52%] Building CXX object obj/src/CMakeFiles/usdObj.dir/fileFormat.cpp.o
[ 54%] Building CXX object obj/src/CMakeFiles/usdObj.dir/obj.cpp.o
/home/ubuntu/USD-Fileformat-plugins/obj/src/obj.cpp: In function ‘int adobe::usd::addImage(adobe::usd::Obj&, const string&, std::unordered_map<std::basic_string<char>, int>&, const string&, bool)’:
/home/ubuntu/USD-Fileformat-plugins/obj/src/obj.cpp:1070:37: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 1070 |                                   *(reinterpret_cast<std::vector<char>*>(&image.image)))) {
      |                                    ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/USD-Fileformat-plugins/obj/src/obj.cpp: In function ‘bool adobe::usd::readFileContents(const string&, std::vector<char>&)’:
/home/ubuntu/USD-Fileformat-plugins/obj/src/obj.cpp:85:10: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   85 |     fread(buffer.data(), length, 1, file);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 56%] Building CXX object obj/src/CMakeFiles/usdObj.dir/objExport.cpp.o
[ 58%] Building CXX object obj/src/CMakeFiles/usdObj.dir/objImport.cpp.o
[ 60%] Building CXX object obj/src/CMakeFiles/usdObj.dir/objResolver.cpp.o
[ 62%] Linking CXX shared library libusdObj.so
[ 62%] Built target usdObj
[ 64%] Building CXX object obj/tests/CMakeFiles/objSanityTests.dir/sanityTests.cpp.o
[ 66%] Linking CXX executable objSanityTests
/usr/bin/ld: CMakeFiles/objSanityTests.dir/sanityTests.cpp.o: in function `OBJSanityTests_LoadCube_Test::TestBody()':
sanityTests.cpp:(.text+0xae): undefined reference to `pxrInternal_v0_24__pxrReserved__::UsdStage::Open(std::string const&, pxrInternal_v0_24__pxrReserved__::UsdStage::InitialLoadSet)'
collect2: error: ld returned 1 exit status
gmake[2]: *** [obj/tests/CMakeFiles/objSanityTests.dir/build.make:117: obj/tests/objSanityTests] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:454: obj/tests/CMakeFiles/objSanityTests.dir/all] Error 2
gmake: *** [Makefile:166: all] Error 2

Thank you for providing the complete build log. First, I’d like to ensure that you are using the -Dpxr_ROOT flag to point to your local USD build directory in your cmake call. Although CMake typically requires this to configure correctly, it’s good to double-check.

Regarding the specific error with the test, it appears there’s an issue with locating the USD libraries. Please verify your environment settings; you should add the paths <USD_INSTALL_PATH>/bin, <USD_INSTALL_PATH>/lib, and <USD_INSTALL_PATH>/lib64 to your LD_LIBRARY_PATH, and <USD_INSTALL_PATH>/lib/python to your PYTHONPATH. For example:

export LD_LIBRARY_PATH=<USD_INSTALL_PATH>/bin:<USD_INSTALL_PATH>/lib:<USD_INSTALL_PATH>/lib64:$LD_LIBRARY_PATH
export PYTHONPATH=<USD_INSTALL_PATH>/lib/python:$PYTHONPATH

I will update the README to include the lib64 directory since it appears this was omitted in the initial setup instructions.

There is also a note specifically when building on linux to set the following cmake variable: -DUSD_FILEFORMATS_ENABLE_CXX11_ABI=ON

Please let me know if this helps.

Thanks for this, I didn’t have LD_LIBRARY_PATH set nor did I have the Linux specific variable set, which was most likely the main issue.

1 Like