Skip to content

Cannot build mathematical with native extensions #227

@samkellett

Description

@samkellett

When adding the mathematical package to a Gemfile, like so:

source 'https://rubygems.org'

gem 'mathematical', '~> 1.6', '>= 1.6.7'

And run the following command:

bazel run @ruby//:bundle --java_runtime_version=remotejdk_11 -- install

I get an error which I think is that it cannot find lxml2 (which is installed via apt install libxml2-dev on my system):

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/home/samkellett/.cache/bazel/_bazel_samkellett/ba57479d3fc58ccb58079217d732fa88/external/rules_ruby++ruby+ruby/dist/lib/ruby/gems/shared/gems/mathematical-1.6.20/ext/mathematical
/home/samkellett/.cache/bazel/_bazel_samkellett/ba57479d3fc58ccb58079217d732fa88/external/rules_ruby++ruby+ruby/dist/bin/jruby
-I
/home/samkellett/.cache/bazel/_bazel_samkellett/ba57479d3fc58ccb58079217d732fa88/external/rules_ruby++ruby+ruby/dist/lib/ruby/stdlib
extconf.rb
checking for cmake... yes
checking for main() in -lxml2... *** 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=/home/samkellett/.cache/bazel/_bazel_samkellett/ba57479d3fc58ccb58079217d732fa88/external/rules_ruby++ruby+ruby/dist/bin/jruby
	--with-xml2lib
	--without-xml2lib
RuntimeError: The compiler failed to generate an executable file.
You have to install development tools first

mkmf.log contains the following info:

find_executable: checking for cmake... -------------------- yes

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

" -o conftest -I/include/universal-java11 -I/home/samkellett/.cache/bazel/_bazel_samkellett/ba57479d3fc58ccb58079217d732fa88/external/rules_ruby++ruby+ruby/dist/lib/ruby/include/ruby/backward -I/home/samkellett/.cache/bazel/_bazel_samkellett/ba57479d3fc58ccb58079217d732fa88/external/rules_ruby++ruby+ruby/dist/lib/ruby/include -I.     -fno-omit-frame-pointer -fno-strict-aliasing  -fexceptions  conftest.c  -L. -L/home/samkellett/.cache/bazel/_bazel_samkellett/ba57479d3fc58ccb58079217d732fa88/external/rules_ruby++ruby+ruby/dist/lib    -m64      "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <ruby.h>
4: int main(int argc, char **argv)
5: {
6:   return 0;
7: }
/* end */

I've reproduced this on both Linux and macOS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions