gpt4 book ai didi

mysql.h 丢失....(Ruby on Rails,OSX)

转载 作者:IT老高 更新时间:2023-10-29 00:04:53 25 4
gpt4 key购买 nike

我尝试了几个想法……没有一个奏效……我只是想将 mysql2 安装为 gem。我的 mysql 正在工作,但每次我的系统都说 mysql.h 丢失了......有人有想法吗?现在很郁闷...

我正在使用 osx 10.8.3、ruby 1.9.3、rails 3.2.13 和自制软件。

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

/Users/gadreel/.rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql and try again.
-----
*** 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
--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=/Users/gadreel/.rvm/rubies/ruby-1.9.3-p429/bin/ruby
--with-mysql-config
--without-mysql-config

file `which mysql`
/usr/local/mysql/bin/mysql: Mach-O 64-bit executable x86_64

最佳答案

在 Mountain Lion Rails 安装(使用 Homebrew 和 RVM)中对我有用的是编辑/usr/local/Cellar/mysql/5.XX.XX/bin/mysql_config并从 cxflags 和 cxflags 选项中删除 -Wno-null-conversion -Wno-unused-private-field 如下:

之前:

cflags="-I$pkgincludedir  -Wall -Wno-null-conversion -Wno-unused-private-field -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!
cxxflags="-I$pkgincludedir -Wall -Wno-null-conversion -Wno-unused-private-field -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!

之后:

cflags="-I$pkgincludedir  -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!
cxxflags="-I$pkgincludedir -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!

在 gem install mysql2 之后顺利进行

注意:这可能是由于 5.6.10 之后对 mysql_config 进行了更改:http://bugs.mysql.com/bug.php?id=69645

关于mysql.h 丢失....(Ruby on Rails,OSX),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16657304/

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