加入收藏 | 设为首页 | 会员中心 | 我要投稿 湖南网 (https://www.hunanwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程 > 正文

mysql – Ruby的has_header方法在哪里查找头文件?

发布时间:2021-03-30 22:04:04 所属栏目:编程 来源:网络整理
导读:在CentOS 5.7呆板上,我无法安装最新版本的mysql2 gem;它找不到errmsg.h: /usr/bin/ruby extconf.rbchecking for rb_thread_blocking_region()... yeschecking for rb_wait_for_single_fd()... nochecking for mysql_query() in -lmysqlclient... yescheckin

在CentOS 5.7呆板上,我无法安装最新版本的mysql2 gem;它找不到errmsg.h:

/usr/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... no
checking for mysql_query() in -lmysqlclient... yes
checking for mysql.h... no
checking for mysql/mysql.h... yes
checking for errmsg.h... no
-----
errmsg.h is missing.  please check your installation of mysql and try again.
-----
*** extconf.rb failed ***

mysql头文件存在于/usr/include / mysql中.处事器上存在旧版本的gem,因此必需在一个点上乐成构建.

请留意,它在搜查mysql.h时失败,但在mysql / mysql.h上乐成.可是,对付errmsg.h,它不会一再此操纵.通过这个我猜它不是在看/usr/include,但我不确定.

我已经发掘了extconf.rb源代码并发明它正在行使have_header要领来定位头文件.我调试了执行,发明它正在探求“mysql / errmsg.h”的相对路径.但我没有找到任何表明它怎样将其扩展为绝对路径的文档.

那边& has_header怎样定位其头文件?

最佳谜底 我信托我找到了谜底.

好像has_header查察体系包括路径.假如未配置相干情形变量,则默认包括路径为/usr/local/include和/usr/include.

假如要手动配置它们,您可以执行以下操纵:

export C_INCLUDE_PATH=/usr/include/mysql/

纵然您正在编译C措施,假如头文件是C文件,那也是云云.另一方面,假如你的头文件是C而不是C,你会这样做:

export CPLUS_INCLUDE_PATH=/usr/include/mysql

虽然,您找到了办理要领,即在extconf.rb中包括dir_config(‘mysql’).这使您可以行使–with-mysql-include选项并手动提供路径.

这是我的来历:http://www.network-theory.co.uk/docs/gccintro/gccintro_23.html

这是统一个题目的更一样平常版本(有谜底):How to add a default include path for gcc in linux?

(编辑:湖南网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读