From: Stefan Salewski Date: 2013-10-17T16:34:47+02:00 Subject: [ruby-core:57918] Re: cxxflags for C++ library bindings not working for Ruby 1.9.x and 2.0? On Thu, 2013-10-17 at 22:34 +0900, Nobuyoshi Nakada wrote: > (13/10/17 22:03), Stefan Salewski wrote: > > My feeling is, that there is some problem in the handling of CXXFLAGS > > used for the C++ compiler. > > > > CGAL code need the flag -frounding-math. > > For Ruby 1.9.3 I gave > > $CFLAGS += " -frounding-math" > > > > in extconfig.rb, and "ruby extconfig.rb; make" was working fine. > > For Ruby 2.0 this was not working any more -- I found > > $CPPLAGS += " -frounding-math" > > working as entry in extconfig.rb. (But CPPLAGS are for preprocessor.) > > Could you show the generated Makefile? > I put my whole current project to http://www.ssalewski.de/tmp/Ruby/ That makefile is generated with Ruby 2.0 this way stefan@AMD64X2 ~/RAPOLLONIUS $ ruby extconf.rb checking for main() in -lCGAL... yes checking for main() in -lCGAL_Core... yes checking for main() in -lgmp... yes creating Makefile stefan@AMD64X2 ~/RAPOLLONIUS $ make compiling rcgal_apollonius.cpp linking shared-object rcgal_apollonius.so stefan@AMD64X2 ~/RAPOLLONIUS $ ruby test.rb -- Bye Hallo -- Up Down ### Up Down xxx Up Down yyy ["Up", "Down"] That way works, but the strange line $CPPFLAGS += " -frounding-math -std=c++11" in exconfig.rb is needed. With line $CXXFLAGS += " -frounding-math -std=c++11" I get stefan@AMD64X2 ~/RAPOLLONIUS $ ruby extconf.rb checking for main() in -lCGAL... yes checking for main() in -lCGAL_Core... yes checking for main() in -lgmp... yes *** 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}/lib64 --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/bin/ruby20 --with-CGALlib --without-CGALlib --with-CGAL_Corelib --without-CGAL_Corelib --with-gmplib --without-gmplib extconf.rb:6:in `
': undefined method `+' for nil:NilClass (NoMethodError) Without the line $CPPFLAGS += " -frounding-math -std=c++11" I get this Makefile http://www.ssalewski.de/tmp/Ruby/Makefile2 and have to call make with stefan@AMD64X2 ~/RAPOLLONIUS $ make cxxflags+=-frounding-math cxxflags +=-std=c++0x compiling rcgal_apollonius.cpp rcgal_apollonius.cpp: In function ���VALUE ag_alloc(VALUE)���: rcgal_apollonius.cpp:59:13: error: ���nullptr��� was not declared in this scope make: *** [rcgal_apollonius.o] Error 1 stefan@AMD64X2 ~/RAPOLLONIUS $ make cppflags+=-frounding-math cppflags +=-std=c++0x compiling rcgal_apollonius.cpp linking shared-object rcgal_apollonius.so stefan@AMD64X2 ~/RAPOLLONIUS $ ruby test.rb -- Bye Hallo -- Up Down ### Up Down xxx Up Down yyy ["Up", "Down"]