Perfect-MySQL icon indicating copy to clipboard operation
Perfect-MySQL copied to clipboard

Missing required module 'mysqlclient'

Open xingcxb opened this issue 7 years ago • 9 comments

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

xingcxb avatar Jun 11 '18 06:06 xingcxb

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 avatar Jun 11 '18 09:06 xingcxb

@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 avatar Jun 18 '18 13:06 RockfordWei

@xingcxb brew switch mysql 5.7.21

RockfordWei avatar Jun 20 '18 10:06 RockfordWei

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

xingcxb avatar Jun 25 '18 08:06 xingcxb

https://github.com/PerfectlySoft/Perfect-MySQL/pull/31

RockfordWei avatar Jun 25 '18 15:06 RockfordWei

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

xingcxb avatar Jun 26 '18 03:06 xingcxb

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

RockfordWei avatar Jun 26 '18 03:06 RockfordWei

@RockfordWei 好的,谢谢您的帮助

xingcxb avatar Jun 26 '18 03:06 xingcxb

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

zhangxiaoyuheshui avatar Aug 22 '18 08:08 zhangxiaoyuheshui