gpt4 book ai didi

mysql - 使用 ruby​​ 2.0.0 在 Windows 中安装 mysql ruby​​ gem 失败

转载 作者:太空宇宙 更新时间:2023-11-03 17:03:42 25 4
gpt4 key购买 nike

使用 chocolately 我已经安装了 ruby​​ 和 ruby​​.devkit

cinst ruby
cinst ruby.devkit

然后我按照 github wiki 上的说明进行操作并测试了 devkit,详见 point 5

gem install json --platform=ruby
ruby -rubygems -e "require 'json'; puts JSON.load('[42]').inspect"

这工作正常所以我假设我的 devkit 安装是正确的。但是,当我尝试像这样安装 mysql gem 时

gem install mysql --platform=ruby -- --with-mysql-dir=C:/mysql-connector-c-noinstall-6.0.2-win32

我得到以下错误

This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

C:/ruby200/bin/ruby.exe extconf.rb --with-mysql-dir=C:/mysql-connector-c-noinstall-6.0.2-win32
checking for main() in -llibmysql... 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:/ruby200/bin/ruby
--with-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib=${mysql-dir}/
--with-libmysqllib
--without-libmysqllib


Gem files will remain installed in C:/ruby200/lib/ruby/gems/2.0.0/gems/mysql-2.9.1 for inspection.
Results logged to C:/ruby200/lib/ruby/gems/2.0.0/gems/mysql-2.9.1/ext/mysql_api/gem_make.out

我的所有路径都是正确的,我是 following this tutorial .日志文件对我帮助不大,但就在这里。

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

"gcc -o conftest.exe -IC:/ruby200/include/ruby-2.0.0/i386-mingw32 -IC:/ruby200/include/ruby-2.0.0/ruby/backward -IC:/ruby200/include/ruby-2.0.0 -I. -IC:/mysql-connector-c-noinstall-6.0.2-win32/include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -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:/ruby200/lib -LC:\mysql-connector-c-noinstall-6.0.2-win32\lib\libmysql.dll -LC:/mysql-connector-c-noinstall-6.0.2-win32/ -L. -lmsvcrt-ruby200 -lshell32 -lws2_32 -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 */

相关问题


注意:我最终使用了 mysql2 gem 而不是它具有足够的功能来满足我的需要。


最佳答案

我现在也遇到了同样的问题。但修复了 ruby​​ 2.0.0

从 hear http://dev.mysql.com/downloads/connector/c/ 下载 mysql connector for c解压到一个目录然后

gem install mysql2 --platform=ruby -- --with-mysql-dir=C:/mysql-connector-c-noinstall-6.0.2-win32

关于mysql - 使用 ruby​​ 2.0.0 在 Windows 中安装 mysql ruby​​ gem 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17673612/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com