msys2 / MINGW-packages

Package scripts for MinGW-w64 targets to build under MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
2.21k stars 1.19k forks source link

Failure installing an extension of asciidoctor (mathematical) #6425

Open angelog0 opened 4 years ago

angelog0 commented 4 years ago

I need asciidoctor-mathematical but it fails as reported below. Maybe a missing package?

TIA, Angelo

From MINGW64 shell:

$ gem install asciidoctor-mathematical
Building native extensions. This could take a while...
ERROR:  Error installing asciidoctor-mathematical:
        ERROR: Failed to build gem native extension.

    current directory: C:/msys64/mingw64/lib/ruby/gems/2.7.0/gems/mathematical-1.6.13/ext/mathematical
C:/msys64/mingw64/bin/ruby.exe -I C:/msys64/mingw64/lib/ruby/2.7.0 -r ./siteconf20200427-884-1169byz.rb extconf.rb
checking for cmake... yes
checking for -lxml2... yes
checking for -lpangocairo-1.0... yes
checking for libxml/tree.h in /include/libxml2,/usr/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
checking for libxml/parser.h in /include/libxml2,/usr/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
checking for libxml/xpath.h in /include/libxml2,/usr/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
checking for libxml/xpathInternals.h in /include/libxml2,/usr/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
-- Building for: NMake Makefiles
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:17 (project):
  The CMAKE_C_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.

CMake Error at CMakeLists.txt:17 (project):
  The CMAKE_CXX_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

-- Configuring incomplete, errors occurred!
See also "C:/msys64/mingw64/lib/ruby/gems/2.7.0/gems/mathematical-1.6.13/ext/mathematical/mtex2MML/build/CMakeFiles/CMak
eOutput.log".
See also "C:/msys64/mingw64/lib/ruby/gems/2.7.0/gems/mathematical-1.6.13/ext/mathematical/mtex2MML/build/CMakeFiles/CMak
eError.log".
make: ***  Nessuna regola per generare l'obiettivo «libmtex2MML_static».  Arresto.
*** 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:/msys64/mingw64/bin/$(RUBY_BASE_NAME)
        --with-xml2-dir
        --without-xml2-dir
        --with-xml2-include
        --without-xml2-include=${xml2-dir}/include
        --with-xml2-lib
        --without-xml2-lib=${xml2-dir}/lib
        --with-xml2lib
        --without-xml2lib
        --with-pangocairo-1.0-dir
        --without-pangocairo-1.0-dir
        --with-pangocairo-1.0-include
        --without-pangocairo-1.0-include=${pangocairo-1.0-dir}/include
        --with-pangocairo-1.0-lib
        --without-pangocairo-1.0-lib=${pangocairo-1.0-dir}/lib
        --with-pangocairo-1.0lib
        --without-pangocairo-1.0lib
        --use-system-mtex2MML
C:/msys64/mingw64/lib/ruby/2.7.0/fileutils.rb:491:in `realpath': No such file or directory @ realpath_rec - C:/msys64/mi
ngw64/lib/ruby/gems/2.7.0/gems/mathematical-1.6.13/ext/mathematical/mtex2MML/build/libmtex2MML.a (Errno::ENOENT)
        from C:/msys64/mingw64/lib/ruby/2.7.0/fileutils.rb:491:in `copy_entry'
        from C:/msys64/mingw64/lib/ruby/2.7.0/fileutils.rb:468:in `block in cp_r'
        from C:/msys64/mingw64/lib/ruby/2.7.0/fileutils.rb:1588:in `block in fu_each_src_dest'
        from C:/msys64/mingw64/lib/ruby/2.7.0/fileutils.rb:1602:in `fu_each_src_dest0'
        from C:/msys64/mingw64/lib/ruby/2.7.0/fileutils.rb:1586:in `fu_each_src_dest'
        from C:/msys64/mingw64/lib/ruby/2.7.0/fileutils.rb:467:in `cp_r'
        from extconf.rb:80:in `<main>'

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

  C:/msys64/mingw64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/mathematical-1.6.13/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/msys64/mingw64/lib/ruby/gems/2.7.0/gems/mathematical-1.6.13 for inspection.
Results logged to C:/msys64/mingw64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/mathematical-1.6.13/gem_make.out
StarWolf3000 commented 4 years ago

There's nothing missing, at least I can't see anything missing.

The problem here is, gem and then cmake is somehow detecting the environment as Windows with Visual Studio, so cmake tries to configure for Visual C++ compiler cl.exe, which won't exist unless you install Visual Studio.

But cmake should never use the Visual Studio generators, when running in mingw, unless it is explicitely told to.

Make sure, mingw-w64-cmake is up-to-date and also show the output of $ which cmake.

angelog0 commented 4 years ago

As I wrote I did all in MSYS2-MINGW64 shell from which:

which cmake
/mingw64/bin/cmake

I have seen that the gem failure has left some garbage file, can I clean them with some command, say via gem?