aswf-docker
aswf-docker copied to clipboard
Change MaterialX to shared libs
Found this in ci-vfxall_2022
.
Currently MaterialX seems to be build as static lib, which does not end up in /usr/local/lib
.
It will however leave traces in pxrTargets.cmake
, for example:
INTERFACE_LINK_LIBRARIES "tf;sdr;usdMtlx;usdShade;hd;hdMtlx;usdImaging;/usr/local/lib/libMaterialXCore.a;/usr/local/lib/libMaterialXFormat.a;/usr/local/lib/libMaterialXGenGlsl.a;/usr/local/lib/libMaterialXGenOsl.a;/usr/local/lib/libMaterialXGenShader.a;/usr/local/lib/libMaterialXRender.a;/usr/local/lib/libMaterialXRenderGlsl.a;/usr/local/lib/libMaterialXRenderHw.a;/usr/local/lib/libMaterialXRenderOsl.a"
This causes subsequent builds that use the cmake config to try to link against it.
I wonder if we should rather move to shader libs, or at least provide the static libraries.
The related crash might be fixed with the shared build.
Sadly, this option was added in 1.38.3 according to: https://github.com/AcademySoftwareFoundation/MaterialX/releases/tag/v1.38.3
And the XML Reader API changed in that version, I believe as such it requires USD 22.08 and MaterialX >1.38.3.
It seems that the MaterialX library is being built as a static library, which means that the library files are not being placed in the /usr/local/lib directory. Instead, the library files are being left in the pxrTargets.cmake file, which causes subsequent builds that use the CMake configuration to try to link against them.
One solution to this issue could be to move to using shader libraries, which are typically shared libraries that can be easily shared between multiple projects. This would make it easier to manage the library files and would eliminate the need to include them in the pxrTargets.cmake file.
Another solution could be to provide the static libraries in a separate location, such as /usr/local/lib, so that they can be easily found and linked to by other projects. This would require updating the CMake configuration to specify the correct library path and linking against the correct libraries.
It's also possible to provide both options, static and shared libraries, and let the users choose which one to use.
Ultimately, the best solution will depend on the specific requirements of the project and the needs of the users. It's important to consider the trade-offs between different options and to communicate any changes clearly to the community.
MaterialX is indeed built as a static lib, as I left it as the default. I'd be happy to change this, but note that I just fixed an issue where materialx files where completely missing from ci-vfxall
images.
Here's what you get in the newly released image:
docker run -it --rm aswf/ci-vfxall:2022-clang14.3
[root@e23d9733a6b7 aswf]# cd /usr/local
[root@e23d9733a6b7 local]# find .|grep libMat
./lib/libMaterialXRenderOsl.a
./lib/libMaterialXGenOsl.a
./lib/libMaterialXRender.a
./lib/libMaterialXGenMdl.a
./lib/libMaterialXGenGlsl.a
./lib/libMaterialXCore.a
./lib/libMaterialXGenShader.a
./lib/libMaterialXRenderGlsl.a
./lib/libMaterialXFormat.a
./lib/libMaterialXRenderHw.a
This is now addressed in 2024 VFX platform releases, MaterialX is now built as shared libraries.
./lib/libMaterialXRender.so
./lib/libMaterialXRender.so.1
./lib/libMaterialXFormat.so
./lib/libMaterialXFormat.so.1
./lib/libMaterialXGenMsl.so.1
./lib/libMaterialXGenGlsl.so.1.38.8
./lib/libMaterialXRenderGlsl.so
./lib/libMaterialXRenderOsl.so
./lib/libMaterialXGenShader.so.1
./lib/libMaterialXRenderHw.so
./lib/libMaterialXGenShader.so
./lib/libMaterialXCore.so.1
./lib/libMaterialXRenderOsl.so.1
./lib/libMaterialXGenGlsl.so
./lib/libMaterialXGenOsl.so
./lib/libMaterialXRenderHw.so.1.38.8
./lib/libMaterialXRenderGlsl.so.1
./lib/libMaterialXGenMdl.so.1
./lib/libMaterialXRenderGlsl.so.1.38.8
./lib/libMaterialXGenGlsl.so.1
./lib/libMaterialXGenMdl.so
./lib/libMaterialXGenOsl.so.1
./lib/libMaterialXRenderOsl.so.1.38.8
./lib/libMaterialXGenOsl.so.1.38.8
./lib/libMaterialXCore.so.1.38.8
./lib/libMaterialXCore.so
./lib/libMaterialXRenderHw.so.1
./lib/libMaterialXGenMsl.so.1.38.8
./lib/libMaterialXFormat.so.1.38.8
./lib/libMaterialXGenMdl.so.1.38.8
./lib/libMaterialXRender.so.1.38.8
./lib/libMaterialXGenMsl.so
./lib/libMaterialXGenShader.so.1.38.8