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

build_usd.py fails when building in debug mode #2231

Closed
Ben1138 opened this issue Feb 1, 2023 · 7 comments
Closed

build_usd.py fails when building in debug mode #2231

Ben1138 opened this issue Feb 1, 2023 · 7 comments

Comments

@Ben1138
Copy link

Ben1138 commented Feb 1, 2023

Description of Issue

I tried to use the build_usd.py script to build USD 23.02 without usd-view, examples, tools in Debug mode. I eventually want to build both, Debug and Release versions.

System Information (OS, Hardware)

Windows 10
Intel(R) Core(TM) i7-7820X
Python 3.11.1
Visual Studio 2022
CMake 3.25.2
NASM 2.16.01

Steps to Reproduce

  1. Pull this USD repo
  2. Checkout the release branch at tag v23.02
  3. Open Developer Command Prompt for VS 2022
  4. Navigate to USD\build_scripts
  5. Run build_usd.py with the build flags below. The output folder is named DEBUG.

Build Flags

--imaging --ptex --embree --openvdb --openimageio --opencolorio --alembic --hdf5 --materialx --no-draco --no-tools --no-prman --no-usdview --no-examples --no-tutorials --no-python --no-docs --build-monolithic --build-variant debug DEBUG -v

Now, when build_usd.py reaches alembic, I get an error that ILMBASE_ROOT is undefined and consequently the ilmbase libraries cannot be found (windows user name obfuscated):

INFO: Extracting archive to C:\Users\<USER>\git-repos\USD\build_scripts\DEBUG\src\alembic-1.7.10
INFO: Running "cmake -DCMAKE_INSTALL_PREFIX="C:\Users\<USER>\git-repos\USD\build_scripts\DEBUG" -DCMAKE_PREFIX_PATH="C:\Users\<USER>\git-repos\USD\build_scripts\DEBUG" -DCMAKE_BUILD_TYPE=Debug  -G "Visual Studio 17 2022" -A x64  -DUSE_BINARIES=OFF -DUSE_TESTS=OFF -DUSE_HDF5=ON -DHDF5_ROOT="C:\Users\<USER>\git-repos\USD\build_scripts\DEBUG" -DCMAKE_CXX_FLAGS="-D H5_BUILT_AS_DYNAMIC_LIB" "C:\Users\<USER>\git-repos\USD\build_scripts\DEBUG\src\alembic-1.7.10""
2023-02-01 18:12
cmake -DCMAKE_INSTALL_PREFIX="C:\Users\<USER>\git-repos\USD\build_scripts\DEBUG" -DCMAKE_PREFIX_PATH="C:\Users\<USER>\git-repos\USD\build_scripts\DEBUG" -DCMAKE_BUILD_TYPE=Debug  -G "Visual Studio 17 2022" -A x64  -DUSE_BINARIES=OFF -DUSE_TESTS=OFF -DUSE_HDF5=ON -DHDF5_ROOT="C:\Users\<USER>\git-repos\USD\build_scripts\DEBUG" -DCMAKE_CXX_FLAGS="-D H5_BUILT_AS_DYNAMIC_LIB" "C:\Users\<USER>\git-repos\USD\build_scripts\DEBUG\src\alembic-1.7.10"
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19044.
-- The C compiler identification is MSVC 19.34.31937.0
-- The CXX compiler identification is MSVC 19.34.31937.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Deprecation Warning at CMakeLists.txt:38 (CMAKE_MINIMUM_REQUIRED):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- CMAKE SYSTEM NAME: Windows
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Failed
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Failed
-- The install dir is C:/Users/<USER>/git-repos/USD/build_scripts/DEBUG
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
ILMBASE_ROOT is undefined
-- #define ILMBASE_VERSION_STRING "2.5.2"
CMake Error at cmake/Modules/FindIlmBase.cmake:157 (MESSAGE):
  ilmbase libraries (Half, Iex, IlmThread, Imath) not found, required
Call Stack (most recent call first):
  cmake/AlembicIlmBase.cmake:36 (FIND_PACKAGE)
  CMakeLists.txt:230 (INCLUDE)

Although all libs Half-2_5_d.dll, Iex-2_5_d.dll, IlmThread-2_5_d.dll and Imath-2_5_d.dll being present in USD\build_scripts\DEBUG\bin, aswell as their respective .lib counterparts in USD\build_scripts\DEBUG\lib...
I tried adding the bin and lib directories to PATH, invoking the CMake call manually with ILMBASE_ROOT pointing to USD\build_scripts\DEBUG, but nothing worked.

I hope someone can help with this or point me in the right direction.
Thanks!

@seando-adsk
Copy link
Contributor

You could try adding the following in the InstallAlembic() function in build.py:

        cmakeOptions += ['-DILMBASE_ROOT="{instDir}"'.format(instDir=context.instDir)]

        # Patch FindIlmBase to find debug libs.
        if context.buildDebug:
            PatchFile(os.path.join('cmake', 'Modules', 'FindIlmBase.cmake'),
                [('      ${COMPONENT}-${_ilmbase_libs_ver} ${COMPONENT}\n',
                  '      ${COMPONENT}-${_ilmbase_libs_ver}_d ${COMPONENT}\n')],
                  multiLineMatches=True)

@Ben1138
Copy link
Author

Ben1138 commented Feb 2, 2023

Thank you, the missing _d name postfix fixed the issue with Alembic and now it builds fine. That problem isn't restricted to Alembic though, now similar problems arise with OpenVDB and USD itself, which both also cannot find IlmBase / Imath respectively. This problem seems to be more widespread.

OpenVDB:

-- ----------------------------------------------------
-- ------------- Configuring OpenVDBCore --------------
-- ----------------------------------------------------
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
CMake Error at C:/Program Files/Python311/Lib/site-packages/cmake/data/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find IlmBase (missing: IlmBase_LIB_COMPONENTS Half) (found
  suitable version "2.5", minimum required is "2.2")
Call Stack (most recent call first):
  C:/Program Files/Python311/Lib/site-packages/cmake/data/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindIlmBase.cmake:262 (find_package_handle_standard_args)
  openvdb/CMakeLists.txt:61 (find_package)

USD:

-- Could NOT find Imath (missing: Imath_DIR)
-- Imath not found. Looking for OpenEXR instead.
CMake Error at C:/Program Files/Python311/Lib/site-packages/cmake/data/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find OpenEXR (missing: OPENEXR_LIBRARIES) (found version "2.5.2")
Call Stack (most recent call first):
  C:/Program Files/Python311/Lib/site-packages/cmake/data/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  cmake/modules/FindOpenEXR.cmake:94 (find_package_handle_standard_args)
  cmake/defaults/Packages.cmake:327 (find_package)
  CMakeLists.txt:23 (include)

Note how, although being a fallback option, OpenEXR is not found aswell, although being build and resolved fine when building OpenImageIO for example.

@Ben1138 Ben1138 changed the title build_usd.py fails when building alembic build_usd.py fails when building alembic in debug mode Feb 2, 2023
@Ben1138 Ben1138 changed the title build_usd.py fails when building alembic in debug mode build_usd.py fails when building in debug mode Feb 2, 2023
@seando-adsk
Copy link
Contributor

We don't build with OpenVDB, but it looks like it also has a FindIlmBase.cmake that you'll need to patch.

Sorry I don't know what happened with USD not being able to find OpenEXR.

Sean

@meshula
Copy link
Member

meshula commented Feb 2, 2023

The configuration of msvc debug builds is a bit complex. The _d suffix in OpenEXR (and many other projects) is meant to distinguish the choice of common runtime, since the debug and release variants are not compatible with each other.

There is a patch here that might help you ~ if you are able to try it out and let us know how far you get that would be helpful.

#2079

I notice that patch does not address any potential issues with OpenVdb.

@tallytalwar
Copy link
Contributor

Filed as internal issue #USD-7959

@Ben1138
Copy link
Author

Ben1138 commented Feb 8, 2023

It works 👍

Patching FindOpenEXR.cmake and build_usd.py as described in PR #2079 solved the issue of USD not finding OpenEXR. About OpenVDB, I just left it out (--no-openvdb).

When I patched FindOpenEXR.cmake I left out the if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" part, since I'm on Windows.
I didn't patch FindOpenImageIO.cmake though, since it built fine for me.

@FlorianZ
Copy link
Contributor

Closing this as a duplicate of #2079, which we are in progress on. Thanks everyone!

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

5 participants