您好,欢迎来到二三娱乐。
搜索
您的当前位置:首页Swift4Linux 纪实

Swift4Linux 纪实

来源:二三娱乐

I promise I will be back this winter.

Date Notes Swift

自从 Swift 开源以来,Swift 官方就不仅兼容了 macOS,而更是兼容了 Linux。而 Swift.org 也是以 Ubuntu 为例,但 Linux 操作系统常用作于后端,可能对于一些 iOS 开发者并不太熟悉,加上本身比较 Geek,通常需要我们配置很多。因此这里为纪实,即小结一些错误,以及对应的应对方式。一是做个笔记,方便自己查询,其次也是为了方便他人查询,后续会持续更新。

以下内容大部分以 Ubuntu 16.04 操作系统为准。

缺少 libpython2.7.so.1.0

/home/ubuntu/.swiftenv/versions/4.0/usr/bin/lldb: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
  • 解决方法:
sudo apt-get install libpython2.7

缺少 libcurl.so.4

/home/ubuntu/.swiftenv/versions/4.0/usr/bin/swift-package: error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory
  • 解决方法:
sudo apt-get install libcurl4-openssl-dev

SSH Key 自定义名称导致无权连接远程服务器

当采用 SSH 远程连接 Linux 服务器时,本机设定多个 SSH Keys 时,因为修改了默认的 id_rsa 名称,因此需要将密钥添加到 SSH 代理中,才可生效。

  • 解决方法:
ssh-add -K ~/.ssh/id_rsa_github

sudo 命令无效

Ubuntu 中仅使用 useradd 命令添加新用户时,未分配权限导致执行 sudo 命令无效,出现 ubuntu is not in the sudoers file. This incident will be reported.

  • 解决方法:

root 用户下,添加写入权限:

chmod u+w /etc/sudoers
vim /etc/sudoers

在以下内容后添加 ubuntu ALL=(ALL) ALL 一行(ubuntu 为新用户名)。

# User privilege specification
root    ALL=(ALL:ALL) ALL

最后撤销写入权限:

chmod u-w /etc/sudoers

主机名不识别

在 Ubuntu 中,如果 Hostname 没有明确为 localhost,可能会出现 sudo: unable to resolve host xxx 的警告。

  • 解决方法:

在 root 用户下修改 /etc/hosts,在 127.0.0.1 localhost 后添加 Hostname,即 127.0.0.1 localhost xxx

HomeBrew link 错误

Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied @ dir_s_mkdir - /usr/local/Frameworks
Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks
  • 解决方法:
sudo chown -R $(whoami) /usr/local

Copyright © 2019- yule263.com 版权所有 湘ICP备2023023988号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务