好久前尝试使用vapor遇到的坑,分享给遇到同样问题的同学
openssl失败
描述
SPM:
swift package build 通不过,找不到openssl,提示“#include <openssl/conf.h>”, import CTLS失败
Xcode:swift package generate-xcodeproj
使用Xcode打开也有相同的错误提示
find /usr/local -name conf.h寻找到/usr/local/Cellar/openssl/1.0.2l/include/openssl/conf.h
设置Header Search Paths: /usr/local/Cellar/openssl/1.0.2l/include
设置Library Search Paths: /usr/local/Cellar/openssl/1.0.2l/lib
再次编译提示找不到crypto......
~~~ swift build -Xswiftc -I/usr/local/opt/openssl/include -Xlinker -l/usr/local/opt/openssl/lib ~~~
~~~ swift package -Xswiftc -I/usr/local/opt/openssl/include -Xlinker -l/usr/local/opt/openssl/lib generate-xcodeproj ~~~
Xcode解决方法:
```
正确设置openssl路径
设置Header Search Paths: /usr/local/opt/openssl/include
设置Library Search Paths: /usr/local/opt/openssl/lib
```
添加mysql支持需修改Search Paths
添加设置Header Search Paths: /usr/local/Cellar/mysql/5.7.11/include /usr/local/Cellar/mysql/5.7.11/include/mysql
添加 设置Library Search Paths:/usr/local/Cellar/mysql/5.7.11/lib
初次的安装体验比不上perfect,折腾了好久