From: John Woods Date: 2013-10-17T13:16:55-05:00 Subject: [ruby-core:57924] Re: cxxflags for C++ library bindings not working for Ruby 1.9.x and 2.0? --bcaec51b9cfda2889804e8f3d224 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable I've also noticed this problem. I had to use a work-around to get it to work properly when I was trying to turn on a warning-to-error flag. Using ruby 2.0.0p195. John Woods SciRuby / NMatrix On Thu, Oct 17, 2013 at 9:34 AM, Stefan Salewski wrote: > 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 +=3D " -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 +=3D " -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 +=3D " -frounding-math -std=3Dc++11" > in exconfig.rb is needed. > > With line > $CXXFLAGS +=3D " -frounding-math -std=3Dc++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=3D${opt-dir}/include > --with-opt-lib > --without-opt-lib=3D${opt-dir}/lib64 > --with-make-prog > --without-make-prog > --srcdir=3D. > --curdir > --ruby=3D/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 +=3D " -frounding-math -std=3Dc++11" > I get this Makefile > http://www.ssalewski.de/tmp/Ruby/Makefile2 > and have to call make with > stefan@AMD64X2 ~/RAPOLLONIUS $ make cxxflags+=3D-frounding-math cxxflags > +=3D-std=3Dc++0x > compiling rcgal_apollonius.cpp > rcgal_apollonius.cpp: In function =91VALUE ag_alloc(VALUE)=92: > rcgal_apollonius.cpp:59:13: error: =91nullptr=92 was not declared in this > scope > make: *** [rcgal_apollonius.o] Error 1 > stefan@AMD64X2 ~/RAPOLLONIUS $ make cppflags+=3D-frounding-math cppflags > +=3D-std=3Dc++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"] > > > --bcaec51b9cfda2889804e8f3d224 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable
I've also noticed this problem. I had to use a work-ar= ound to get it to work properly when I was trying to turn on a warning-to-e= rror flag. Using ruby 2.0.0p195.

John Woods
Sc= iRuby / NMatrix


On Thu,= Oct 17, 2013 at 9:34 AM, Stefan Salewski <mail@ssalewski.de> wrote:
On T= hu, 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 CXXF= LAGS
> > used for the C++ compiler.
> >
> > CGAL code need the flag -frounding-math.
> > For Ruby 1.9.3 I gave
> > $CFLAGS +=3D " -frounding-math"
> >
> > in extconfig.rb, and "ruby extconfig.rb; make" was work= ing fine.
> > For Ruby 2.0 this was not working any more -- I found
> > $CPPLAGS +=3D " -frounding-math"
> > working as entry in extconfig.rb. (But CPPLAGS are for preprocess= or.)
>
> 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 +=3D " -frounding-math -std=3Dc++11"
in exconfig.rb is needed.

With line
$CXXFLAGS +=3D " -frounding-math -std=3Dc++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. =A0Check 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=3D${opt-dir}/include
--with-opt-lib
--without-opt-lib=3D${opt-dir}/lib64
--with-make-prog
--without-make-prog
--srcdir=3D.
--curdir
--ruby=3D/usr/bin/ruby20
--with-CGALlib
--without-CGALlib
--with-CGAL_Corelib
--without-CGAL_Corelib
--with-gmplib
--without-gmplib
extconf.rb:6:in `<main>': undefined method `+' for nil:NilCla= ss
(NoMethodError)

Without the line
$CPPFLAGS +=3D " -frounding-math -std=3Dc++11"
I get this Makefile
ht= tp://www.ssalewski.de/tmp/Ruby/Makefile2
and have to call make with
stefan@AMD64X2 ~/RAPOLLONIUS $ make cxxflags+=3D-frounding-math cxxflags +=3D-std=3Dc++0x
compiling rcgal_apollonius.cpp
rcgal_apollonius.cpp: In function =91VALUE ag_alloc(VALUE)=92:
rcgal_apollonius.cpp:59:13: error: =91nullptr=92 was not declared in this scope
make: *** [rcgal_apollonius.o] Error 1
stefan@AMD64X2 ~/RAPOLLONIUS $ make cppflags+=3D-frounding-math cppflags +=3D-std=3Dc++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"]



--bcaec51b9cfda2889804e8f3d224--