5 July 2021 at 14:53 #19884mariatBlocked
I am facing some problems when building sofa from sources with the python3 plugin on windows10. I have partially solved it but my solution is still hacky.
To build Sofa I have followed the instruction at: https://www.sofa-framework.org/community/doc/getting-started/build/windows/
Here’s myexternal libraries:
Eigen3 – last version downloaded from https://gitlab.com/libeigen/eigen/
Boost – boost_1_76_0
sofa – stable version v20.12 (v20.12 https://github.com/sofa-framework/sofa.git sofa/src)
I could succesfully compile via:
mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release ../src cmake --build . --config Release cmake --install .
The python plugin is also compiled as I have downloaded the sources before running cmake.
Just a note (that I could not find in the documentation) when building using cmake and VS compiler via command line: The cmake –install step won’t work in Debug since it can’t find the gtest.dll. The reason is that the GTest dlls generated in debug are called gtest_d.dll.
When using VS compiler, using –config Release is necessary to compile in release when using VS compiler (using -DCMAKE_BUILD_TYPE=Release in the cmake step is not sufficient).
Anyhow, when using “cmake –build . –config Release” and “cmake –install .” everything compiles and install properly. However, when I try to launch the runSofa.exe it won’t launch as it misses a lot of .dlls. Basically, all the plugins’ dlls are not loaded. They are present in each plugin folder (<sofa_dir>\install\plugins\<PluginName>\bin) but are not seen when I try to launch the runSofa.exe.
My understanding is that the PluginManager should load them, but this doesn’t happen. If I manually add the SofaValidation.dll, SofaGraphComponent.dll, SofaGeneralLoader.dll,
SofaUserInteraction.dll to my <sofa_dir>\install\bin, I can launch runSofa.exe. However, adding things manually is a bit of a hacky solution, I guess there is something wrong that prevent my dlls from being accessible/correctly loaded when running the .exe file. Can you also reproduce this error?
Similarly, I also have problems launching sofaPython3 plugin from my python environemnt. I’ve added the <sofa_install>/bin dir to the Path environment variable but when I try to import Sofa I still get problems finding DLLs. I tried to copy all the DLLs generated in the <sofa_dir>\install folder and subfolders to a different folder location and add this folder to the Path environemnt variable and… everything works. So I really guess something is not properly copied in the bin folder during the make_install step.
The good new is that all these dlls copying workarounds seem to work. The bad new is that this is a very hacky solution. Any idea how to solve it/what might be wrong?
Thanks for the support!30 July 2021 at 12:03 #20106GuillaumeKeymaster
Hi, sorry for the very late answer.
However, adding things manually is a bit of a hacky solution, I guess there is something wrong that prevent my dlls from being accessible/correctly loaded when running the .exe file. Can you also reproduce this error?
I agree it looks like a hacky solution but actually it’s the way Windows works. On Linux and MacOS, each library/executable has a RPATH: a list of folder hints to search for dependencies. There is no RPATH on Windows, thus we have to copy DLLs…
In SOFA, DLLs copy (among other things) after the install step on Windows is provided by a script under tools/postinstall-fixup.
To auto-run this script you can set
Hope that helps,
Guillaume.4 August 2021 at 13:44 #20126mariatBlocked
thanks a lot for the reply.
Even after launching tools/postinstall-fixup/windows-postinstall-fixup.sh, I still have to copy some folders/files around, but after that everything runs smoothly.
This what I had to do to get everything working in Windows10:
1. configure and generate via the CMake GUI
2. In the build folder run:
>> cmake –build . –config Release
>> cmake –install .
3. Launch the tools/postinstall-fixup/windows-postinstall-fixup.sh as
>> windows-postinstall-fixup.sh my/sofa/build/repo my/sofa/install/repo
4. Copy the content of C:\Repo\sofa\build\install\bin\Release into C:\Repo\sofa\build\install\bin
5. Setting the environment variables to point to the correct paths
When using the Sofa in python3, I also had the following error when trying to initialize the GUI: “This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem”, which is a QT related issue that got fixed by setting the QT_QPA_PLATFORM_PLUGIN_PATH as:
os.environ[‘QT_QPA_PLATFORM_PLUGIN_PATH’] = “C:\\Repo\\sofa\\build\\install\\bin\\platforms”
in my python code.
Maria4 August 2021 at 17:56 #20127HugoKeymaster28 October 2021 at 11:21 #20703Julien D.Blocked
Hiii @matriatirindelli, I had exactly the same error when trying to initialize the GUI in a Python3 interpreter ! Thank you so much for your hints to solve this issue.
- You must be logged in to reply to this topic.