bazel-contrib / bazel-contrib/rules_ruby

Cannot build mathematical with native extensions

Open
#227 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
50
Forks
22
Avg merge
9d 23h
Merged PRs (30d)
5

Description

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
4: int main(int argc, char **argv)
5: {
6: return 0;
7: }
/* end */
```

I've reproduced this on both Linux and macOS.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.