Missing required module 'mysqlclient'
xingcxb opened this issue · 9 comments
import PerfectMySQL 出现Missing required module 'mysqlclient'
本地用homebrew安装过mysql,请问这是为什么
package.swift 里面的内容
// swift-tools-version:4.0
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "Library",
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url:"https://github.com/PerfectlySoft/Perfect-MySQL.git",from:"3.1.2"),
//.package(url:"https://github.com/PerfectlySoft/Perfect-mysqlclient.git",from:"2.0.1")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "Library",
dependencies: ["PerfectMySQL"]),
]
)
@xingcxb 试一下 pkg-config mysqlclient --cflags --libs
,我的mac上显示是这个结果:
$ pkg-config mysqlclient --cflags --libs
-I/usr/local/Cellar/mysql/5.7.21/include/mysql -L/usr/local/Cellar/mysql/5.7.21/lib -lmysqlclient
@xingcxb brew switch mysql 5.7.21
一个不小心版本过高了。。。
-I/usr/local/Cellar/mysql/8.0.11/include/mysql -L/usr/local/Cellar/mysql/8.0.11/lib -lmysqlclient
@RockfordWei 进行build时出现
~/AppleWorkspaces/xtools/Library swift build Compile Swift Module 'PerfectCRUD' (26 sources) Compile Swift Module 'PerfectMySQL' (4 sources) /Users/symbol/AppleWorkspaces/xtools/Library/.build/checkouts/Perfect-MySQL.git-4976130768219902098/Sources/PerfectMySQL/MySQLStmt.swift:503:43: error: use of undeclared type 'my_bool' let isNullBuffers: UnsafeMutablePointer<my_bool> ^~~~~~~ /Users/symbol/AppleWorkspaces/xtools/Library/.build/checkouts/Perfect-MySQL.git-4976130768219902098/Sources/PerfectMySQL/MySQLStmt.swift:214:7: error: binary operator '==' cannot be applied to operands of type 'Int' and 'Bool' 0 == mysql_stmt_bind_param(ptr, paramBinds) else { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/symbol/AppleWorkspaces/xtools/Library/.build/checkouts/Perfect-MySQL.git-4976130768219902098/Sources/PerfectMySQL/MySQLStmt.swift:214:7: note: overloads for '==' exist with these partially matching parameter lists: (Bool, Bool), (Int, Int)
上面的链接就是修复方案,等待审核,同时兼容MySQL 5.7.12和8.0.11
@RockfordWei 好的,谢谢您的帮助
@xingcxb 你好,Missing required module 'mysqlclient', 这个问题怎么解决的啊,没看懂你们说的解决方法,能详细些吗?