import MaterialX fails on Windows after cmake --install of a shared-library build
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- cmake, python
- Ambito
- build-system
Direzione di ricerca
Start with the install rules in CMakeLists.txt and python/CMakeLists.txt, then trace how the install prefix is used by the pip install step. Reproduce on Windows with a shared library build and Python enabled, then run python -c "import MaterialX" after installation. Done means the installed package can import successfully and cmake --install --prefix <other> installs Python files under the requested prefix.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Steps to reproduce
- On Windows, with Python 3.8 or later, configure with
-DMATERIALX_BUILD_SHARED_LIBS=ON -DMATERIALX_BUILD_PYTHON=ON.MATERIALX_INSTALL_PYTHONdefaults toON. - Run
cmake --build build --config Release, thencmake --install build --config Release. - Run
python -c "import MaterialX"from a new shell:
ImportError: DLL load failed while importing PyMaterialXCore: The specified module could not be found.
Cause
The last install step runs pip install . in <prefix>/python. That copies the extension modules into site-packages, but not the MaterialX DLLs they depend on, which are in <prefix>/bin. Since Python 3.8, Windows doesn't search PATH for an extension module's DLL dependencies. MaterialX/__init__.py has a fallback that calls os.add_dll_directory(<prefix>/bin), but it only runs when the package has no pip metadata, so it never runs for the copy pip installed. Wheels aren't affected, because pyproject.toml forces static libraries.
CI doesn't catch this, because the Windows_VS2022_x64_SharedLibs job runs with python: None.
A related problem with --prefix
The pip install step and python/CMakeLists.txt, which writes pyproject.toml directly into the install prefix, both use the prefix from configure time. So cmake --install --prefix <other> runs pip in the original install folder instead of the requested one.
Proposed fix
For Windows shared builds, copy the DLLs from <prefix>/bin into <prefix>/python/MaterialX before pip runs, so the installed package is self-contained. That's the same idea as delvewheel, minus the renaming of the DLLs. Also resolve the prefix at install time, and install pyproject.toml with an install rule. This is in use on our fork: https://github.com/metashade/MaterialX/pull/102. It adds about 180 MB to site-packages with the Slang libraries enabled. I can open a PR against main.
Related: #2503.
- Lingua principale
- C++
- Stelle
- 2.3k
- Fork
- 472
- Merge medio
- 1g 4h
- PR unite (30g)
- 7
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di AcademySoftwareFoundation/MaterialX
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
AcademySoftwareFoundation/MaterialX#3140 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
AcademySoftwareFoundation/MaterialX#3139 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
AcademySoftwareFoundation/MaterialX#3138 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
AcademySoftwareFoundation/MaterialX#3137 ·
I maintainer di solito rispondono entro 2 giorni
-
Cyclic 'inherit' on TargetDefs causes an infinite loop and unbounded memory growthForse già presa @shubhamrai9122-creator l’ha presa 33 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
AcademySoftwareFoundation/MaterialX#3096 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di AcademySoftwareFoundation/MaterialX
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
mw00/project-maya#1368 ·
I maintainer di solito rispondono entro 2 giorni
-
needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
[LLK][QSR][PERF] eltwise_binary: perf harness INIT enables direct indexing, production does notAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
tenstorrent/tt-metal#67662 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
maplibre/maplibre-native#5159 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement question
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
lbr-stack/lbr_fri_ros2_stack#420 · 1 commento ·