2
>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

我收到以下错误

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.

我已经研究了几个小时并尝试安装几个不同的 curl 版本,确保 curl 目录在我的路径中。使用 mingw32 和 windows 命令行,错误仍然存​​在。

也试过:

gem install curb --platform=mswin32

更新

下面是来自遏制目录的 mkmf.log。它想告诉我什么?

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 */

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

另外,我的路径中有 curl-config 可执行文件。

4

1 回答 1

3

使用我的设置(Win 8.1 64 位,ruby 2.16 64 位),需要以下版本的 curl: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

您还需要将 64 位 ruby​​ 开发工具包解压缩到your_ruby_directory/DevKit您的路径中,并在您的路径中使用以下或等效项。

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;

我还确保 cygwin curl-config 可执行文件在我的路径中,但不清楚这是否需要。

于 2015-08-06T18:48:57.183 回答