Building native gem 'curb' on 64 bit Windows 8.1 fails: 'checking for curl-config... no'

550 Views Asked by At
>gem install curb -- --with-curl-dir=C:/curl-7.43.0-win32/bin --with-curl-lib=C:/curl-7.43.0-win32/lib --with-curl-include=C:/curl-7.43.0-win32/include

I get the following error

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing curb:
        ERROR: Failed to build gem native extension.

        C:/Ruby21-x64/bin/ruby.exe extconf.rb --with-curl-dir=C:/curl-7.43.0-win
32/bin --with-curl-lib=C:/curl-7.43.0-win32/lib --with-curl-include=C:/curl-7.43
.0-win32/include
checking for curl-config... no
checking for main() in -lcurl... no
*** 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}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Ruby21-x64/bin/ruby
        --with-curl-dir
        --with-curl-include=${curl-dir}/include
        --with-curl-lib=${curl-dir}/lib
        --with-curllib
        --without-curllib
extconf.rb:18:in `<main>':   Can't find libcurl or curl/curl.h (RuntimeError)

  Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
  options to extconf.

I have researched this for hours and tried installing several different curl versions, making sure the curl directory is in my path. Using both mingw32 and windows command line, the error persists.

Also tried:

gem install curb --platform=mswin32

UPDATE

Below is the mkmf.log from the curb directory. What is it trying to tell me?

find_executable: checking for curl-config... -------------------- no

--------------------

have_library: checking for main() in -lcurl... -------------------- no

"x86_64-w64-mingw32-gcc -o conftest.exe -Ic:/Ruby21-x64/include/ruby-2.1.0/x64-mingw32 -Ic:/Ruby21-x64/include/ruby-2.1.0/ruby/backward -Ic:/Ruby21-x64/include/ruby-2.1.0 -I. -IC:/curl-7.40.0-devel-mingw32/include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -Lc:/Ruby21-x64/lib -LC:/curl-7.40.0-devel-mingw32/bin -L.      -lx64-msvcrt-ruby210  -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi  "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7:   return 0;
8: }
/* end */

"x86_64-w64-mingw32-gcc -o conftest.exe -Ic:/Ruby21-x64/include/ruby-2.1.0/x64-mingw32 -Ic:/Ruby21-x64/include/ruby-2.1.0/ruby/backward -Ic:/Ruby21-x64/include/ruby-2.1.0 -I. -IC:/curl-7.40.0-devel-mingw32/include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -Lc:/Ruby21-x64/lib -LC:/curl-7.40.0-devel-mingw32/bin -L.      -lx64-msvcrt-ruby210 -lcurl  -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi  "
conftest.c: In function 't':
conftest.c:16:32: warning: variable 'p' set but not used [-Wunused-but-set-variable]
c:/ruby21-x64/devkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/curl-7.40.0-devel-mingw32/bin/libcurl.dll when searching for -lcurl
c:/ruby21-x64/devkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/curl-7.40.0-devel-mingw32/bin/libcurl.dll when searching for -lcurl
c:/ruby21-x64/devkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lcurl
collect2.exe: error: ld returned 1 exit status
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <winsock2.h>
 4: #include <windows.h>
 5: 
 6: /*top*/
 7: extern int t(void);
 8: int main(int argc, char **argv)
 9: {
10:   if (argc > 1000000) {
11:     printf("%p", &t);
12:   }
13: 
14:   return 0;
15: }
16: int t(void) { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
/* end */

"x86_64-w64-mingw32-gcc -o conftest.exe -Ic:/Ruby21-x64/include/ruby-2.1.0/x64-mingw32 -Ic:/Ruby21-x64/include/ruby-2.1.0/ruby/backward -Ic:/Ruby21-x64/include/ruby-2.1.0 -I. -IC:/curl-7.40.0-devel-mingw32/include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -Lc:/Ruby21-x64/lib -LC:/curl-7.40.0-devel-mingw32/bin -L.      -lx64-msvcrt-ruby210 -lcurl  -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi  "
conftest.c: In function 't':
conftest.c:16:1: error: too few arguments to function 'main'
conftest.c:8:5: note: declared here
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <winsock2.h>
 4: #include <windows.h>
 5: 
 6: /*top*/
 7: extern int t(void);
 8: int main(int argc, char **argv)
 9: {
10:   if (argc > 1000000) {
11:     printf("%p", &t);
12:   }
13: 
14:   return 0;
15: }
16: int t(void) { main(); return 0; }
/* end */

--------------------

Also, I have curl-config executable in my path.

1

There are 1 best solutions below

1
On BEST ANSWER

With my setup (Win 8.1 64bit, ruby 2.16 64 bit), the following version of curl is required: curl-7.40.0-devel-mingw64

gem install curb -- --with-curl-lib=C:/curl-7.40.0-devel-mingw64/bin --with-curl-include=C:/curl-7.40.0-devel-mingw64/include

You also need the 64 bit ruby dev kit unzipped into your_ruby_directory/DevKit and the following or equivalent in youir path.

C:\Ruby21-x64\bin;C:\Ruby21-x64\DevKit\bin;C:\Ruby21-x64\DevKit\mingw\bin;C:\curl-7.40.0-devel-mingw64\bin;C:\Ruby21-x64\bin;C:\Ruby21-x64\DevKit\bin;C:\Ruby21-x64\DevKit\mingw\bin;

I had also ensured that the cygwin curl-config executable was in my path, though it is unclear if this was required.