metanorma / libemf2svg

Microsoft (MS) EMF to SVG conversion library
GNU General Public License v2.0
11 stars 2 forks source link

Long build path leads to a fail on Windows #18

Closed alexeymorozov closed 3 years ago

alexeymorozov commented 3 years ago

Github Actions compiles a gem in a pretty long path:

C:/hostedtoolcache/windows/Ruby/2.6.8/x64/lib/ruby/gems/2.6.0/gems/emf2svg-0.1.0/tmp/libemf2svg/

Which leads to an error in vcpkg:

Error: Building package libiconv:x64-windows failed with: BUILD_FAILED

https://github.com/metanorma/emf2svg-ruby/pull/2/checks?check_run_id=3454567981

@maxirmx May be there is some workaround which allows to avoid making a short path in every case?

maxirmx commented 3 years ago

It looks like a well known issue, at least for boost and qt5 builds )

There are multiply discussion threads: https://github.com/microsoft/vcpkg/issues/8272 https://gitmemory.com/issue/microsoft/vcpkg/8272/533767341 https://sourceforge.net/p/slam6d/discussion/939032/thread/6170824484/?limit=25 and many more

As far as I understood three solutions were offered:

  1. Moving vcpkg to a short path such as 'C:\vcpkg'
  2. Using the subst command
  3. Extending Windows server configuration from 260 character paths to 1024 character paths

I can probably implement approach number 1. It may take 3-4 days. Not sure if ruby can be configured to use file pathes shortened by subst. Number 3 means self-hosted runner which we do not want as far as I understand.

maxirmx commented 3 years ago

Correction I can move vcpkg to C:\vcpkg for GHA runners. However it won't work for 'ordinary' workstation since C:\ is normally write protected. So this approach is not good either.

alexeymorozov commented 3 years ago

Yes.. :(

It may work with subst paths since Ruby only runs cmake commands and passes the paths there:

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake '-GVisual Studio 16 2019' -DCMAKE_INSTALL_PREFIX=D:/a/emf2svg-ruby/emf2svg-ruby/ports/x86_64-w64-mingw32/libemf2svg/1.3.0 .
cmake --build D:/a/emf2svg-ruby/emf2svg-ruby/tmp/x86_64-w64-mingw32/ports/libemf2svg/1.3.0/libemf2svg --config Release --target emf2svg

And it worked if the build directory (UPD: with source) is moved to the C:\ root.

Also seems that it works if the build directory is moved to the temporary directory ($TMPDIR, %TEMP%). May be it would be suitable for us, will test.

https://github.com/metanorma/emf2svg-ruby/pull/2

alexeymorozov commented 3 years ago

The issue is currently resolved by placing a source/build folder in the OS default temporary directory.

Thank for help @maxirmx !