ruby/psych

psych fails to install on windows

hurricup opened this issue · 1 comments

The same story with yaml.h

Installing https://packages.msys2.org/package/libyaml-devel?repo=msys&variant=x86_64
does not help, even if it provide necessary header file.

ERROR:  Error installing psych:
	ERROR: Failed to build gem native extension.

    current directory: C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/psych-5.0.1/ext/psych
C:/Ruby26-x64/bin/ruby.exe -I C:/Ruby26-x64/lib/ruby/2.6.0 -r ./siteconf20221220-27572-1r09of9.rb extconf.rb
checking for yaml.h... no
yaml.h not found
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=C:/Ruby26-x64/bin/$(RUBY_BASE_NAME)
	--with-libyaml-source-dir
	--without-libyaml-source-dir
	--with-yaml-0.1-config
	--without-yaml-0.1-config
	--with-pkg-config
	--without-pkg-config
	--with-libyaml-dir
	--without-libyaml-dir
	--with-libyaml-include
	--without-libyaml-include=${libyaml-dir}/include
	--with-libyaml-lib
	--without-libyaml-lib=${libyaml-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  C:/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/psych-5.0.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/psych-5.0.1 for inspection.
Results logged to C:/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/psych-5.0.1/gem_make.out

Problem persists for rubies 2.6 - 3.1
Here is mkmf.log for 3.1

PATH=".;C:/Ruby31-x64/lib;C:\Ruby31-x64\bin;C:\msys64\ucrt64\bin;C:\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Ruby31-x64\bin;C:\Ruby27-x64\bin;C:\Ruby30-x64\bin;C:\Ruby26-x64\bin;C:\Users\hurri\AppData\Local\Microsoft\WindowsApps;C:\Users\hurri\AppData\Local\JetBrains\Toolbox\scripts;;C:\Users\hurri\AppData\Local\Programs\Microsoft VS Code\bin" pkg-config --exists yaml-0.1
package configuration for yaml-0.1 is not found
find_header: checking for yaml.h... -------------------- no

PATH=".;C:/Ruby31-x64/lib;C:\Ruby31-x64\bin;C:\msys64\ucrt64\bin;C:\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Ruby31-x64\bin;C:\Ruby27-x64\bin;C:\Ruby30-x64\bin;C:\Ruby26-x64\bin;C:\Users\hurri\AppData\Local\Microsoft\WindowsApps;C:\Users\hurri\AppData\Local\JetBrains\Toolbox\scripts;;C:\Users\hurri\AppData\Local\Programs\Microsoft VS Code\bin" "gcc -o conftest.exe -IC:/Ruby31-x64/include/ruby-3.1.0/x64-mingw-ucrt -IC:/Ruby31-x64/include/ruby-3.1.0/ruby/backward -IC:/Ruby31-x64/include/ruby-3.1.0 -I. -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64  -DYAML_DECLARE_STATIC -O3 -fno-fast-math -fstack-protector-strong conftest.c  -L. -LC:/Ruby31-x64/lib -L. -pipe -s -fstack-protector-strong -Wl,--no-as-needed  -m64   -lx64-ucrt-ruby310  -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi -lbcrypt  "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7:   return !!argv[argc];
8: }
/* end */

PATH=".;C:/Ruby31-x64/lib;C:\Ruby31-x64\bin;C:\msys64\ucrt64\bin;C:\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Ruby31-x64\bin;C:\Ruby27-x64\bin;C:\Ruby30-x64\bin;C:\Ruby26-x64\bin;C:\Users\hurri\AppData\Local\Microsoft\WindowsApps;C:\Users\hurri\AppData\Local\JetBrains\Toolbox\scripts;;C:\Users\hurri\AppData\Local\Programs\Microsoft VS Code\bin" "gcc -IC:/Ruby31-x64/include/ruby-3.1.0/x64-mingw-ucrt -IC:/Ruby31-x64/include/ruby-3.1.0/ruby/backward -IC:/Ruby31-x64/include/ruby-3.1.0 -I. -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64  -DYAML_DECLARE_STATIC -O3 -fno-fast-math -fstack-protector-strong -m64  -c conftest.c"
conftest.c:5:10: fatal error: yaml.h: No such file or directory
    5 | #include <yaml.h>
      |          ^~~~~~~~
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <yaml.h>
/* end */

--------------------

And here is location in msys2:

$ find / -name 'yaml.h'
/usr/include/yaml.h

This worked for me:

pacman -S mingw-w64-ucrt-x86_64-libyaml