vapor / mysql-kit

🐬 Pure Swift MySQL client built on non-blocking, event-driven sockets.
MIT License
222 stars 74 forks source link

mysql build error #63

Closed rafe-g closed 7 years ago

rafe-g commented 8 years ago

Getting build error when i run:

vapor build --mysql

Not much documentation on how to install any dependencies for this project in their [website][1]. From the stack trace, it seems im missing 'lmysqlclient' which im not sure if im supposed to add to the linker flags or is this something that needs to be added to the vapor config (im pretty new to vapor).

Any help greatly appreciated!

Here is the stack trace:

computer:Server user$ swift build -Xswiftc -I/usr/local/mysql/include -Xlinker -L/usr/local/mysql/lib -Xswiftc -DNOJSON Linking CLibreSSL Compile Swift Module 'TurnstileCrypto' (3 sources) Compile Swift Module 'Jay' (21 sources) Compile Swift Module 'SocksCore' (14 sources) Compile Swift Module 'Polymorphic' (2 sources) Compile Swift Module 'PathIndexable' (2 sources) Compile Swift Module 'libc' (1 sources) Compile Swift Module 'Core' (28 sources) ld: warning: directory not found for option '-L/usr/local/mysql/lib' Compile Swift Module 'Node' (22 sources) Compile Swift Module 'Socks' (5 sources) Compile Swift Module 'Fluent' (35 sources) Compile Swift Module 'Essentials' (2 sources) Compile Swift Module 'TLS' (7 sources) Compile Swift Module 'Console' (34 sources) Compile Swift Module 'Leaf' (34 sources) Compile Swift Module 'JSON' (8 sources) Compile Swift Module 'Turnstile' (13 sources) Compile Swift Module 'Random' (3 sources) Compile Swift Module 'Cipher' (2 sources) Compile Swift Module 'MySQL' (10 sources) Compile Swift Module 'TurnstileWeb' (8 sources) Compile Swift Module 'BCrypt' (1 sources) Compile Swift Module 'Hash' (3 sources) Compile Swift Module 'HMAC' (2 sources) Compile Swift Module 'FluentMySQL' (2 sources) Compile Swift Module 'URI' (10 sources) Compile Swift Module 'Transport' (8 sources) Compile Swift Module 'HTTP' (33 sources) Compile Swift Module 'SMTP' (21 sources) Compile Swift Module 'WebSockets' (14 sources) Compile Swift Module 'Settings' (10 sources) Compile Swift Module 'Cookies' (11 sources) Compile Swift Module 'Cache' (3 sources) Compile Swift Module 'Routing' (9 sources) Compile Swift Module 'HTTPRouting' (5 sources) Compile Swift Module 'Sessions' (6 sources) Compile Swift Module 'Auth' (14 sources) Compile Swift Module 'TypeSafeRouting' (3 sources) Compile Swift Module 'Vapor' (86 sources) Compile Swift Module 'VaporMySQL' (1 sources) Compile Swift Module 'App' (3 sources) Linking ./.build/debug/App ld: warning: directory not found for option '-L/usr/local/mysql/lib' ld: library not found for -lmysqlclient for architecture x86_64

:0: error: link command failed with exit code 1 (use -v to see invocation) :0: error: build had 1 command failures error: exit(1): /Applications/Xcode/10.0/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/user/test/Server/.build/debug.yaml
idelfonsog2 commented 8 years ago

I think somebody already mentioned in mysql #29

tanner0101 commented 8 years ago

Did you install MySQL through brew?

rafe-g commented 8 years ago

Yes so the fix is described here. for everyone who install mysql using homebrew the location will be different.

http://stackoverflow.com/questions/40248289/vapor-mysql-not-building/40249397#40249397

We should probably update the documentation to reflect this.

Also seems like almost everyone using mysql provider is running into the issue where you need to specify -DNOJSON. However is there a way to specify this using vapor? currently using vapor build --mysql fails because we cant pass in the -DNOJSON paramter.

tanner0101 commented 8 years ago

You need to prefix it to pass to the Swift compiler like so: -Xswiftc -DNOJSON

tanner0101 commented 7 years ago

Duplicate of https://github.com/vapor/mysql/issues/29