Open
Description
Describe the bug
When importing an FMU and the Hopsan document path contains a comma, the linking stage fails.
To Reproduce
- Make sure the Hopsan directory contains a comma
- Import an FMU
Expected behavior
Import should be successful.
Screenshots, Model or Data files
Loaded hopsangenerator
Writing compilation script...
Calling compiler utility:
Work Directory: C:/Users/fasx1039/OneDrive - Xylem, Inc/Documents/Hopsan/import/FMU/BouncingBall
Output file: BouncingBall.dll
Source files: BouncingBall.cpp
Compiler flags: -I"C:/Program Files/Hopsan/HopsanCore/include" -fPIC -w -Wl,--rpath,"C:/Users/fasx1039/OneDrive - Xylem, Inc/Documents/Hopsan/import/FMU/BouncingBall" -DHOPSAN_BUILD_TYPE_RELEASE -DHOPSANCORE_DLLIMPORT -I"C:/Program Files/Hopsan/dependencies/fmilibrary/include" -I"C:/Program Files/Hopsan/bin/..//dependencies/fmilibrary/include"
Linker flags: -L"C:/Program Files/Hopsan/bin" -L"C:/Program Files/Hopsan/lib" -lhopsancore -L"C:/Program Files/Hopsan/dependencies/fmilibrary/lib" -llibfmilib_shared -L"C:/Program Files/Hopsan/bin/..//dependencies/fmilibrary/lib" -llibfmilib_shared -shared
Compiling please wait!
C:\Users\fasx1039\OneDrive - Xylem, Inc\Documents\Hopsan\import\FMU\BouncingBall>if exist BouncingBall.dll (del BouncingBall.dll )
C:\Users\fasx1039\OneDrive - Xylem, Inc\Documents\Hopsan\import\FMU\BouncingBall>g++ -I"C:/Program Files/Hopsan/HopsanCore/include" -fPIC -w -Wl,--rpath,"C:/Users/fasx1039/OneDrive - Xylem, Inc/Documents/Hopsan/import/FMU/BouncingBall" -DHOPSAN_BUILD_TYPE_RELEASE -DHOPSANCORE_DLLIMPORT -I"C:/Program Files/Hopsan/dependencies/fmilibrary/include" -I"C:/Program Files/Hopsan/bin/..//dependencies/fmilibrary/include" BouncingBall.cpp -L"C:/Program Files/Hopsan/bin" -L"C:/Program Files/Hopsan/lib" -lhopsancore -L"C:/Program Files/Hopsan/dependencies/fmilibrary/lib" -llibfmilib_shared -L"C:/Program Files/Hopsan/bin/..//dependencies/fmilibrary/lib" -llibfmilib_shared -shared -o BouncingBall.dll
C:/Program Files/Hopsan/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find Inc/Documents/Hopsan/import/FMU/BouncingBall: No such file or directory
collect2.exe: error: ld returned 1 exit status
Compilation failed.
Hopsan version (please complete the following information):
- OS: Windows 10
- Version: HopsanCore 64-bit, Version: 2.20.0.20220711.1354
HopsanGUI 64-bit, Version: 2.20.0.20220711.1354 - Build: Official
Additional information
Unfortunately the comma is part of the company name in the OneDrive location where Documents folder is. Changing the location of the Documents folder is not really feasible at scale.
One possible solution could be to use -Xlinker to specify rpath. See for example rust-lang/rust#38798.