gpt4 book ai didi

ruby - 安装——mysql2 gem 在使用 rbenv 和 Ruby 1.8.7 的 OSX Mavericks 上失败

转载 作者:太空宇宙 更新时间:2023-11-03 16:51:51 24 4
gpt4 key购买 nike

经过无数次尝试,我设法在 OSX Mavericks(随 Ruby 2.0 一起提供)上使用 rbenv 安装了 Ruby 1.8.7。

但是我在安装 mysql2 时遇到了一个错误,这对我来说很难理解。有人可以指出我解决这个问题的方向吗?请看下面的输出:

$ sudo gem install mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.

/Users/myuser/.rbenv/versions/1.8.7-p370/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... no
checking for rb_hash_dup()... no
checking for rb_intern3()... no
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile

make
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myuser/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin13.0.0 -I. -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -I'/Users/myuser/.rbenv/versions/1.8.7-p370/include' -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I'/Users/myuser/.rbenv/versions/1.8.7-p370/include' -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include -I/usr/local/mysql/include -Os -g -fno-strict-aliasing -arch x86_64 -fno-common -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib -O3 -Wno-error=shorten-64-to-32 -pipe -fno-common -Wall -funroll-loops -c client.c
In file included from client.c:1:
./mysql2_ext.h:13: error: redefinition of typedef ‘ushort’
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/sys/types.h:91: error: previous declaration of ‘ushort’ was here
./mysql2_ext.h:14: error: redefinition of typedef ‘uint’
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/sys/types.h:92: error: previous declaration of ‘uint’ was here
client.c: In function ‘set_charset_name’:
client.c:1045: warning: unused variable ‘mysql2rb’
make: *** [client.o] Error 1


Gem files will remain installed in /Users/myuser/.rbenv/versions/1.8.7-p370/lib/ruby/gems/1.8/gems/mysql2-0.3.13 for inspection.
Results logged to /Users/myuser/.rbenv/versions/1.8.7-p370/lib/ruby/gems/1.8/gems/mysql2-0.3.13/ext/mysql2/gem_make.out

最佳答案

刚才我发现这个效果很好:

gem install mysql2 -- --with-cflags=\"-DHAVE_UINT\"

来源:Installing mysql2 gem - HAVE_UINT (ushort, uint type redefinition errors)

关于ruby - 安装——mysql2 gem 在使用 rbenv 和 Ruby 1.8.7 的 OSX Mavericks 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19598096/

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