toland / patron

Ruby HTTP client based on libcurl
http://toland.github.com/patron/
MIT License
541 stars 73 forks source link

patron 0.6.0 fails to install with libcurl 7.19 #109

Closed tricknotes closed 8 years ago

tricknotes commented 8 years ago

patron couldn't be built with older libcurl since this commit https://github.com/toland/patron/commit/405dc9f015c58e0d12496a7a988763aaa97cd14e .

$ gem install patron -v '0.6.0'
Building native extensions.  This could take a while...
ERROR:  Error installing patron:
    ERROR: Failed to build gem native extension.

    current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/patron-0.6.0/ext/patron
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160413-18574-zgaw6i.rb extconf.rb
checking for curl-config... yes
checking for ruby/thread.h... yes
checking for rb_thread_blocking_region() in ruby.h... no
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/patron-0.6.0/mkmf.log

current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/patron-0.6.0/ext/patron
make "DESTDIR=" clean

current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/patron-0.6.0/ext/patron
make "DESTDIR="
compiling session_ext.c
session_ext.c: In function ‘session_alloc’:
session_ext.c:180: warning: ISO C forbids braced-groups within expressions
session_ext.c: In function ‘each_http_header’:
session_ext.c:269: warning: unused variable ‘curl’
session_ext.c: In function ‘set_options_from_request’:
session_ext.c:375: warning: ISO C90 forbids mixed declarations and code
session_ext.c:396: warning: ISO C90 forbids mixed declarations and code
session_ext.c:438:3: warning: C++ style comments are not allowed in ISO C90
session_ext.c:438:3: warning: (this will be reported only once per input file)
session_ext.c:464: error: ‘CURLOPT_ACCEPT_ENCODING’ undeclared (first use in this function)
session_ext.c:464: error: (Each undeclared identifier is reported only once
session_ext.c:464: error: for each function it appears in.)
session_ext.c:464: warning: type defaults to ‘int’ in declaration of ‘_curl_opt’
make: *** [session_ext.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.3.0/gems/patron-0.6.0 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/patron-0.6.0/gem_make.out

This problem is caused by the CURLOPT_ACCEPT_ENCODING variable.

This option was called CURLOPT_ENCODING before 7.21.6

Are there any chance to work on older libcurl?

toland commented 8 years ago

@tricknotes Out of curiosity, what OS are you using and what version of libcurl?

This looks like an easy fix, and I think we can get this done for you. But at some point we will have to stop supporting very old versions of libcurl. (7.21.6 came out almost exactly 5 years ago.) It is helpful to know which versions of libcurl are still common and which OSs have older versions.

julik commented 8 years ago

Apparently your CURL version does not support CURLOPT_ACCEPT_ENCODING, which has been put in recently. I will place it under an ifdef guard

julik commented 8 years ago

@tricknotes can you verify that the branch in the pull request under this issue solves your problem please?

tricknotes commented 8 years ago

@toland

$ cat /etc/redhat-release
CentOS release 6.2 (Final)

I know that this is too old version ...

@julik Great thanks! I'll try it within hours. Please wait a moment.

tricknotes commented 8 years ago

@julik https://github.com/toland/patron/pull/110 works fine for me :sunny:

$ cat Gemfile
source 'https://rubygems.org'

gem 'patron', github: 'julik/patron', branch: 'conditional-accept-encoding'
$ bundle exec ruby -e "require 'patron'; puts Patron::VERSION"
0.6.0
julik commented 8 years ago

👍 @toland I will merge, can you release 0.6.1 please?

toland commented 8 years ago

@julik Will do.

toland commented 8 years ago

The release is done. 0.6.1 is on rubygems.

tricknotes commented 8 years ago

Thanks for your awesome work!