CentOS 上的 CLSQL 安装

发布于 2025-01-08 20:35:05 字数 902 浏览 0 评论 0原文

我想使用 CLSQL 从 SBCL 连接到 MySQL。我使用quicklisp (ql:quickload 'clsql) 加载CLSQL。但是,当调用 (clsql:connect '(...) :database-type :mysql) 时,它说:

无法加载外部库“libmysqlclient”、“libmysql”。 (搜索 CLSQL-SYS:FOREIGN-LIBRARY-SEARCH-PATHS)。

我在 CentOS 上,基本上我想做的是

  1. 用 yum 安装 mysql 客户端开发标头,这样 UFFI 可以在安装后找到它(我没能做到)
  2. ,能够连接到本地 MySQL 服务器(我想在 1 之后)完成后,它可以自动工作)。

我目前正在使用:

  • CentOS 5.7 Final(32 位)
  • SBCL 1.0.55
  • Quicklisp beta
  • yum 存储库:base、epel、extras、updates

我不只是问如何在 CentOS 上安装 MySQL 开发标头,因为这只能解决作为我问题的一部分,我仍然需要知道我的机器缺少什么。我也没有尝试从源代码构建 libmysqlclient/libmysql,因为我不知道 clsql 是否能够找到它。我认为不是。

如果我的问题在某种程度上没有抓住重点,我真的很抱歉,但广泛的谷歌搜索没有产生任何结果。如果有人告诉我他们无法在 CentOS 上安装 mysql 客户端开发头文件,我会嘲笑他们并告诉他们使用 yum 搜索,但我在 yum 和网上都找不到它。

我知道 ubuntu(和 debian)的解决方案,因为有一个 cl-sql 包,我也可以在那里轻松找到 mysql 标头,但我在 CentOS 上需要它。

提前致谢。

I want to connect to MySQL from SBCL using CLSQL. I loaded CLSQL using quicklisp (ql:quickload 'clsql). However, when calling (clsql:connect '(...) :database-type :mysql), it said:

Couldn't load foreign libraries "libmysqlclient", "libmysql". (searched CLSQL-SYS:FOREIGN-LIBRARY-SEARCH-PATHS).

I'm on CentOS, and basically what I want to do is

  1. Install mysql client development headers with yum, so UFFI can find it (which I failed to do)
  2. after installing, be able to connect to local MySQL server (I think after 1. is done, it could be working automatically).

I'm currently using:

  • CentOS 5.7 Final (32 bit)
  • SBCL 1.0.55
  • Quicklisp beta
  • yum repositories: base, epel, extras, updates

I didn't just ask about how to install MySQL development headers on CentOS, because that would solve only part of my problem, I would still need to know what's missing from my machine. I also didn't try to build libmysqlclient/libmysql from source, because I don't know whether clsql would be able then to find it or not. I think not.

I'm really sorry if my question somehow misses the point, but extensive googling didn't yield any results. If anyone told me they couldn't install mysql client development headers on CentOS, I would laugh at them and tell them to use yum search, but I couldn't find it neither with yum neither online.

I know the solution for ubuntu (and debian), because there is a cl-sql package and I can easily find mysql headers there too, but I need it on CentOS.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吾性傲以野 2025-01-15 20:35:05

不知何故,当你尝试某件事足够长的时间时,它就会完成;)

如果有人需要答案并偶然发现这个问题,这就是我所做的:

(ql:quickload 'clsql)

;tell clsql where to search for mysql libs
(push #P"/usr/lib/mysql" CLSQL-SYS:*FOREIGN-LIBRARY-SEARCH-PATHS*)

;add mysql libs to clsql library path [apparent from code :]
(clsql:push-library-path "/usr/lib/mysql/")

;directly tell uffi to load mysqlclient shared library
(uffi:load-foreign-library "/usr/lib/mysql/libmysqlclient.so")

当然,你可以将“/usr/lib/mysql”替换为 mysql 的不同路径图书馆,如果需要的话。

Somehow, when you try something long enough, it will get done ;)

Here's what I did if anyone needs an answer and stumbles upon this question:

(ql:quickload 'clsql)

;tell clsql where to search for mysql libs
(push #P"/usr/lib/mysql" CLSQL-SYS:*FOREIGN-LIBRARY-SEARCH-PATHS*)

;add mysql libs to clsql library path [apparent from code :]
(clsql:push-library-path "/usr/lib/mysql/")

;directly tell uffi to load mysqlclient shared library
(uffi:load-foreign-library "/usr/lib/mysql/libmysqlclient.so")

Of course, you can replace "/usr/lib/mysql" with a different path for mysql libraries, if needed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文