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

mysql.h is missing .... (Ruby on Rails, OSX)(mysql.h 丢失....(Ruby on Rails,OSX))
本文介绍了mysql.h 丢失....(Ruby on Rails,OSX)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I tried several ideas ... none of them worked ... I'm just trying to install mysql2 as a gem. My mysql is working, but every time my system says, that mysql.h is missing ... Has someone an idea? It's very frustrating now ...

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

I'm using osx 10.8.3, ruby 1.9.3, rails 3.2.13 and home-brew.

    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

推荐答案

使用像 Homebrew 或 MacPorts 可以很直接地解决这个问题.直接来自 Oracle 的 MySQL 二进制发行版和与 OS X 本身捆绑的发行版没有开发头文件,其中 mysql.h 就是其中之一.

Using a package manager like Homebrew or MacPorts makes it fairly straight-forward to fix this. The binary distribution of MySQL direct from Oracle and the one bundled with OS X itself does not have the development headers, of which mysql.h is one of them.

Homebrew 会这样修复它:

Homebrew would fix it like this:

brew install mysql

MacPorts 非常相似:

MacPorts is very similar:

sudo port install mysql

这两个安装库、命令行客户端和库的相关开发头文件.启用服务器是可选的.

Both of these install libraries, a command-line client and the associated development headers for the libraries. Enabling the server is optional.

作为替代方案,您可以从 Apple 直接从 Apple 获取源代码 并以您认为合适的方式安装它.

As an alternative, you can get the source direct from Apple and install it whatever way you see fit.

通常 Homebrew 是最好的选择.

Generally Homebrew is the best way to go.

这篇关于mysql.h 丢失....(Ruby on Rails,OSX)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)
SQL/MySQL: split a quantity value into multiple rows by date(SQL/MySQL:按日期将数量值拆分为多行)