Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing required module 'mysqlclient' #26

Open
xingcxb opened this issue Jun 11, 2018 · 9 comments
Open

Missing required module 'mysqlclient' #26

xingcxb opened this issue Jun 11, 2018 · 9 comments

Comments

@xingcxb
Copy link

xingcxb commented Jun 11, 2018

import PerfectMySQL 出现Missing required module 'mysqlclient'
本地用homebrew安装过mysql,请问这是为什么

@xingcxb
Copy link
Author

xingcxb commented Jun 11, 2018

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"]),
]
)

@RockfordWei
Copy link
Contributor

@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

@RockfordWei
Copy link
Contributor

@xingcxb brew switch mysql 5.7.21

@xingcxb
Copy link
Author

xingcxb commented Jun 25, 2018

一个不小心版本过高了。。。
-I/usr/local/Cellar/mysql/8.0.11/include/mysql -L/usr/local/Cellar/mysql/8.0.11/lib -lmysqlclient

@RockfordWei
Copy link
Contributor

#31

@xingcxb
Copy link
Author

xingcxb commented Jun 26, 2018

@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)

@RockfordWei
Copy link
Contributor

上面的链接就是修复方案,等待审核,同时兼容MySQL 5.7.12和8.0.11

@xingcxb
Copy link
Author

xingcxb commented Jun 26, 2018

@RockfordWei 好的,谢谢您的帮助

@zhangxiaoyuheshui
Copy link

@xingcxb 你好,Missing required module 'mysqlclient', 这个问题怎么解决的啊,没看懂你们说的解决方法,能详细些吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants