Closed timwaters closed 9 years ago
Seems to be a platform compiler thing: https://wiki.ubuntu.com/ToolChain/CompilerFlags#A-Wformat_-Wformat-security
Note: -Werror=format-security is turned on by default in 13.04 and later releases of Ubuntu.
Thanks for reporting this. It looks like the problem is coming from the SWIG-generated ruby bindings. You can see here that the SWIG bindings are generating code that violates that compiler flag. I might be able to override the compiler flag to get it to work until an upstream fix is pushed. Have you tried building the bindings on their own from the GDAL sources?
I was able to get it to build by editing the global ruby compiler flags. As a test, you can do the following:
Find your rbconfig.rb
file, this is located in a different place depending how you installed ruby. I just installed it from a package manager in my test VM.
find / -iname "rbconfig.rb"
Edit that file and remove -Werror=format-security
from CFLAGS
and CXXFLAGS
. Now try installing the gem and it should work.
I'm having trouble overriding CXXFLAGS
in the makefile config. I can override CFLAGS
, but not CXXFLAGS
. This gem compiles as C++ so we need to override CXXFLAGS
. I'm not sure how to accomplish this in the extconf.rb
file.
I'm guessing that either 1.) this code is currently broken in the GDAL distribution under this configuration, or 2.) When this code is compiled normally from the GDAL distribution, they're overriding this flag. Conceptually, what needs to happen is that flag should be removed when compiling the code, so either it's done globally in the rbconfig.rb
file, or done somehow in the extconf.rb
file in this repo. A patch would be welcome :)
I also tried overriding the cfflags - I was able to do so, but it didnt seem to make any difference. I was able to print out the cfflags, and they were not present in the mkkf.log file. Anyhow,
I changed the statements like:
rb_raise(rb_eRuntimeError, OGRErrMessages(result));
to
rb_raise(rb_eRuntimeError, "$1", OGRErrMessages(result));
and it was able to compile https://github.com/timwaters/gdal-ruby/commit/a7cc8c080742276b51e14584f0f6f54e689fef6a
I will try the rbconfig version now.
Yes, can confirm editing rbconfig.rb worked for me. Thanks!
(I tried changing CXXFLAGS like for CFLAGS but it seemed as if CXXFLAGS does not exist)
I successfully used this version from timewater https://github.com/timwaters/gdal-ruby/commit/a7cc8c080742276b51e14584f0f6f54e689fef6a
Could you create a pull-request out of this..?!
Well those changes made it compile, but I have not tested it - I'm rubbish at C++/C so I wouldn't rely on them
Sorry this took so long to get fixed. I made a change in 53852746941256091a62be673dce75723725c15b that makes it work on Ubuntu 14.04 without needing to patch the sources or the ruby config. A proper fix should be done upstream in GDAL (and possible it is already). Until I get time to update the binding code from upstream, this fix will have to do.
hmm, so I got an error installing this on 12.04 (in 14.04 it installed fine)
extconf.rb:16:in `<main>': undefined method `<<' for nil:NilClass (NoMethodError)
on the CXXFLAGS line
with ruby-1.9.3-p547
I note this comment in this file which may hint at it. https://github.com/Hanmac/rwx/blob/master/ext/extconf.rb#L45
Can you try version 0.0.7?
This should be resolved now with 1.0.0.
:+1:
Thank you
I'm seeing this now too:
I get a number of compiler errors when trying to install the gem. They all seem to be related to one thing though:
I am using this with a new Ubuntu LTS 14 Trusty install
Using Ruby 1.9.1 (ruby 1.9.3p484 )
installed libgdal-ruby from ubuntugis-unstable repository
gdal-config --version 1.11.0
(note, on a 12.04 ubuntu + rvm 1.9.3. gem was installed - using gdal 1.10.0)
Many thanks in advance for your help!
The gem_make.out file.