我试图通过将其安装在Ubuntu服务器上来使用Swift作为后端。我按照这些说明操作: http://www.sitepoint.com/server-side-swift-with-perfect/ 不幸的是,当我做了以下事情时:
git clone https://github.com/PerfectlySoft/Perfect.git
cd Perfect/PerfectLib
make
sudo make install
运行“make”时出错。错误如下:
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "curl_support.hpp"
^
/home/chris/Perfect/PerfectLib/linked/cURL_Linux/curl_support.hpp:30:10:
error: 'curl/curl.h' file not found
#include "curl/curl.h"
^
cURL.swift:26:8: error: could not build Objective-C module 'cURL'
import cURL
我在这里尝试了所有不同的Swift快照: https://swift.org/download/#apple-platforms 但仍然没有。 请任何人可以帮忙吗?我正在使用Ubuntu 14.04
答案 0 :(得分:4)
您需要安装curl库才能在您的系统上安装它:)
sudo apt-get install curl
可以解决您的问题。
我个人使用这个设置我的虚拟机的vagrantfile(所以我不会误解我的常规Linux设置)
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
## 1 get the ubuntu image
config.vm.box = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.provision "shell", inline: <<-SHELL
## 2 Install all necessary dependencies
sudo apt-get --assume-yes install clang libssl-dev libevent-dev libsqlite3-dev libicu-dev uuid-dev libcurl4-openssl-dev git
## 3 get the swift snapshot
curl -O https://swift.org/builds/ubuntu1404/swift-2.2-SNAPSHOT-2015-12-01-b/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04.tar.gz
## 4 unpack
tar zxf swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04.tar.gz
## 5 add swift snapshot to PATH
echo "export PATH=/home/vagrant/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/bin:\"${PATH}\"" >> .profile
echo "Swift has successfully installed on Linux"
## 5.5 create tiny script that will install all the Perfect Libs and have them accessible for the non-sudo user
echo "git clone https://github.com/PerfectlySoft/Perfect.git
cd Perfect/PerfectLib
make
sudo make install
cd ../PerfectServer
make" >> compilePerfectLib.sh
chmod a+x compilePerfectLib.sh
echo "Remember to run ./compilePerfectLib.sh after logging into the VM"
SHELL
config.vm.network :public_network #, bridge: "wlan0"
config.vm.network :forwarded_port, guest: 8181, host: 8181
config.vm.boot_timeout = 300
end
然后在执行vagrant ssh
并且您已登录VM(虚拟机)后,您需要sh ./compilePerfectLib.sh
并且这将设置您的环境:)