asciidoctor / asciidoctor-mathematical

An extension for Asciidoctor that converts the content of STEM blocks and inline macros using Mathematical.
MIT License
50 stars 45 forks source link

Failure to build mathematical on Windows #121

Open BjoernHaase-EH opened 1 year ago

BjoernHaase-EH commented 1 year ago

asciidoctor-mathematical does not seem to allow for beeing installed on Windows.

Unfortunately I got stuck in an environment, where I need a windows-native build of asciidoctor-mathematical for using asciidoctor at all in our projects.

The issue is that dockers are prohibited by the company IT's security guidelines.

After adding flex and bison to the msys environment I got so far that using "gem install". It seems that some ruby magic is executing CMAKE in its configuration for the native MSVC compiler. Afterwards the code is expecting to find a makefile, which is, obviously, not generated by CMAKE when being configured for MSVC (instead VS-Solution and project files are generated).

Any idea on how to fix this issue?

gem install asciidoctor-mathematical Temporarily enhancing PATH for MSYS/MINGW... Building native extensions. This could take a while... ERROR: Error installing asciidoctor-mathematical: ERROR: Failed to build gem native extension.

current directory: C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/mathematical-1.6.14/ext/mathematical

C:/Ruby32-x64/bin/ruby.exe extconf.rb checking for cmake... yes checking for -lxml2... no checking for -lpangocairo-1.0... no 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: Visual Studio 16 2019 -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19045. -- The C compiler identification is MSVC 19.29.30141.0 -- The CXX compiler identification is MSVC 19.29.30141.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Deprecation Warning at CMakeLists.txt:19 (cmake_minimum_required): Compatibility with CMake < 2.8.12 will be removed from a future version of CMake.

Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions.

-- Found BISON: C:/Ruby32-x64/msys64/usr/bin/bison.exe (found version "3.8.2") -- Found FLEX: C:/Ruby32-x64/msys64/usr/bin/flex.exe (found version "2.6.4") -- Performing Test COMPILER_HAS_DEPRECATED_ATTR -- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed -- Performing Test COMPILER_HAS_DEPRECATED -- Performing Test COMPILER_HAS_DEPRECATED - Success -- Found PythonInterp: C:/Anaconda3Envs/TGRE/python.exe (found version "3.11.3") -- Configuring done -- Generating done -- Build files have been written to: C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/mathematical-1.6.14/ext/mathematical/mtex2MML/build make: Keine Regel, um „libmtex2MML_static“ zu erstellen. Schluss. 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:/Ruby32-x64/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:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:1052:in realpath': No such file or directory @ realpath_rec - C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/mathematical-1.6.14/ext/mathematical/mtex2MML/build/libmtex2MML.a (Errno::ENOENT) from C:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:1052:incopy_entry' from C:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:1000:in block in cp_r' from C:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:2481:inblock in fu_each_src_dest' from C:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:2495:in fu_each_src_dest0' from C:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:2479:infu_each_src_dest' from C:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:999:in cp_r' from extconf.rb:80:in

'

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

C:/Ruby32-x64/lib/ruby/gems/3.2.0/extensions/x64-mingw-ucrt/3.2.0/mathematical-1.6.14/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/mathematical-1.6.14 for inspection. Results logged to C:/Ruby32-x64/lib/ruby/gems/3.2.0/extensions/x64-mingw-ucrt/3.2.0/mathematical-1.6.14/gem_make.out

BjoernHaase-EH commented 1 year ago

With

Set-Item -Path Env:CMAKE_GENERATOR -Value 'MinGW Makefiles' gem install asciidoctor-mathematical

I succeeded in making CMAKE use mingw (as seemingly expected by the "gem" system). Still now the system complains about a missing libxml2, even though libxml2 has been installed by using "pacman -S libxml2" in an MSYS shell...

I get the following output:

Temporarily enhancing PATH for MSYS/MINGW... Building native extensions. This could take a while... ERROR: Error installing asciidoctor-mathematical: ERROR: Failed to build gem native extension.

current directory: C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/mathematical-1.6.14/ext/mathematical

C:/Ruby32-x64/bin/ruby.exe extconf.rb checking for cmake... yes checking for -lxml2... no checking for -lpangocairo-1.0... no 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: MinGW Makefiles -- The C compiler identification is GNU 12.2.0 -- The CXX compiler identification is GNU 12.2.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Ruby32-x64/msys64/ucrt64/bin/gcc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Ruby32-x64/msys64/ucrt64/bin/g++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Deprecation Warning at CMakeLists.txt:19 (cmake_minimum_required): Compatibility with CMake < 2.8.12 will be removed from a future version of CMake.

Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions.

-- Found BISON: C:/Ruby32-x64/msys64/usr/bin/bison.exe (found version "3.8.2") -- Found FLEX: C:/Ruby32-x64/msys64/usr/bin/flex.exe (found version "2.6.4") -- Performing Test COMPILER_HAS_DEPRECATED_ATTR -- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success -- Found PythonInterp: C:/Anaconda3Envs/TGRE/python.exe (found version "3.11.3") -- Configuring done -- Generating done -- Build files have been written to: C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/mathematical-1.6.14/ext/mathematical/mtex2MML/build Microsoft Windows [Version 10.0.19045.3086] (c) Microsoft Corporation. Alle Rechte vorbehalten.

(C:\Anaconda3Envs\TGRE) C:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\mathematical-1.6.14\ext\mathematical\mtex2MML\build>Microsoft Windows [Version 10.0.19045.3086] (c) Microsoft Corporation. Alle Rechte vorbehalten.

(C:\Anaconda3Envs\TGRE) C:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\mathematical-1.6.14\ext\mathematical\mtex2MML\build> 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:/Ruby32-x64/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:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:1052:in realpath': No such file or directory @ realpath_rec - C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/mathematical-1.6.14/ext/mathematical/mtex2MML/build/libmtex2MML.a (Errno::ENOENT) from C:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:1052:incopy_entry' from C:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:1000:in block in cp_r' from C:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:2481:inblock in fu_each_src_dest' from C:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:2495:in fu_each_src_dest0' from C:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:2479:infu_each_src_dest' from C:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:999:in cp_r' from extconf.rb:80:in

'

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

C:/Ruby32-x64/lib/ruby/gems/3.2.0/extensions/x64-mingw-ucrt/3.2.0/mathematical-1.6.14/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/mathematical-1.6.14 for inspection. Results logged to C:/Ruby32-x64/lib/ruby/gems/3.2.0/extensions/x64-mingw-ucrt/3.2.0/mathematical-1.6.14/gem_make.out

The gem_make.out contents are:

current directory: C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/mathematical-1.6.14/ext/mathematical C:/Ruby32-x64/bin/ruby.exe extconf.rb checking for cmake... yes checking for -lxml2... no checking for -lpangocairo-1.0... no 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: MinGW Makefiles -- The C compiler identification is GNU 12.2.0 -- The CXX compiler identification is GNU 12.2.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Ruby32-x64/msys64/ucrt64/bin/gcc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Ruby32-x64/msys64/ucrt64/bin/g++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Deprecation Warning at CMakeLists.txt:19 (cmake_minimum_required): Compatibility with CMake < 2.8.12 will be removed from a future version of CMake.

Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions.

-- Found BISON: C:/Ruby32-x64/msys64/usr/bin/bison.exe (found version "3.8.2") -- Found FLEX: C:/Ruby32-x64/msys64/usr/bin/flex.exe (found version "2.6.4") -- Performing Test COMPILER_HAS_DEPRECATED_ATTR -- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success -- Found PythonInterp: C:/Anaconda3Envs/TGRE/python.exe (found version "3.11.3") -- Configuring done -- Generating done -- Build files have been written to: C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/mathematical-1.6.14/ext/mathematical/mtex2MML/build Microsoft Windows [Version 10.0.19045.3086] (c) Microsoft Corporation. Alle Rechte vorbehalten.

(C:\Anaconda3Envs\TGRE) C:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\mathematical-1.6.14\ext\mathematical\mtex2MML\build>Microsoft Windows [Version 10.0.19045.3086] (c) Microsoft Corporation. Alle Rechte vorbehalten.

(C:\Anaconda3Envs\TGRE) C:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\mathematical-1.6.14\ext\mathematical\mtex2MML\build> 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:/Ruby32-x64/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:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:1052:in realpath': No such file or directory @ realpath_rec - C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/mathematical-1.6.14/ext/mathematical/mtex2MML/build/libmtex2MML.a (Errno::ENOENT) from C:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:1052:incopy_entry' from C:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:1000:in block in cp_r' from C:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:2481:inblock in fu_each_src_dest' from C:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:2495:in fu_each_src_dest0' from C:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:2479:infu_each_src_dest' from C:/Ruby32-x64/lib/ruby/3.2.0/fileutils.rb:999:in cp_r' from extconf.rb:80:in

'

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

C:/Ruby32-x64/lib/ruby/gems/3.2.0/extensions/x64-mingw-ucrt/3.2.0/mathematical-1.6.14/mkmf.log

extconf failed, exit code 1