Closed frenkel closed 7 years ago
Hi @frenkel, thanks for reporting this.
It looks like Nokogiri have specific support for OpenBSD in their extconf.rb
, let me see if there's a simple way to make mkmf
respect the CC
and CXX
environment variables based on this.
Could you please try adding the following to ext/re2/extconf.rb
after require 'mkmf'
to see if this remedies your issue?
RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
RbConfig::MAKEFILE_CONFIG['CXX'] = ENV['CXX'] if ENV['CXX']
See the sqlite3-ruby
extconf.rb
for another example of this.
I've released v1.1.0 which should hopefully fix this problem: please give it a whirl and let me know if it solves your issue.
Thank you and sorry for the late reply! Unfortunately it doesn't work. The mkmf.log contains the same commands, no mention of what I set in the CC and CXX environment variables.
"cc -I/usr/local/include/ruby-2.3/x86_64-openbsd -I/usr/local/include/ruby-2.3/ruby/backward -I/usr/local/include/ruby-2.3 -I. -DOPENSSL_NO_STATIC_ENGINE -I/usr/local/include -O2 -pipe -fPIC -Wall -Wextra -funroll-loops -x c++ -std=c++11 -c conftest.c"
cc1plus: error: unrecognized command line option "-std=c++11"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <re2/re2.h>
4: int main() { return 0; }
/* end */
"cc -I/usr/local/include/ruby-2.3/x86_64-openbsd -I/usr/local/include/ruby-2.3/ruby/backward -I/usr/local/include/ruby-2.3 -I. -DOPENSSL_NO_STATIC_ENGINE -I/usr/local/include -O2 -pipe -fPIC -Wall -Wextra -funroll-loops -x c++ -std=c++0x -c conftest.c"
cc1plus: error: unrecognized command line option "-std=c++0x"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <re2/re2.h>
4: int main() { return 0; }
/* end */
So I can reproduce this locally (e.g. in a virtual machine), could you please provide the exact version of OpenBSD, the appropriate commands, etc. and I'll see what I can do?
Thank you! Just install OpenBSD 6.1 and run the following command as root:
pkg_add -v ruby23 gcc
pkg_add -v -Dunsigned http://packages.ivaldi.nl/pub/OpenBSD/6.1-stable/packages/amd64/re2-20170601.tgz
and then as any normal user:
CC=egcc CXX=eg++ gem23 install --user-install re2 '~> 1.1.0'
Hi @frenkel, I think this should now be fixed in the newly-released 1.1.1.
I've tested it with the following on OpenBSD 6.1 in VirtualBox (with both gcc
and g++
installed via pkg_add
):
$ CC=egcc CXX=eg++ gem23 install re2
Please feel free to give it a go!
Great, thank you so much!
On OpenBSD we need to use egcc and eg++ from ports to compile re2 and therefore also the re2 gem. When I specify them using environment variables (
CC=egcc CXX=eg++ bundle
), this is completely ignored (snippet from mkmf.log):For other gems such as Nokogiri this works without problems.