Swift Package 下载慢解决方法

Meqt

Date: Sun Feb 26 17:11:43 CST 2023


I first thought would be a problem with Xcode itself, but I’m not not much sure about it. I then have a new Proxy provider, and it fix the problem, it would take me a few seconds to have all the packages updated after launch Xcode on the project. Still, I’m not sure what happened, after I shift back to my old Proxy provider, it still works, but this time I’m at school, not home. One thing I can think out lead to this change is that I load this project with Clone an existing project at Xcode open panel and configured my personal access token. Besides, I didn’t clone it from command line but cloned it using Xcode. And I can’t push it in Terminal, I can push it with Xcode only, but fetch and pull is ok.

1
git config --list

it

尝试Swift Server,需要Vapor库,在Xcode中新建Package项目后,修改Package.swift中的dependency后,Xcode开始加载库,我开了代理,但加载库的速度仍然极慢。

手动加载库

在Termial中cd到Package项目根目录下,设置当前终端的HTTP代理

1
export https_proxy=http://127.0.0.1:7890

7890为我开的代理的端口号,端口号因自己的代理而异。
然后在项目的根目录下运行

1
swift build

效果如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
Fetching https://github.com/vapor/vapor.git from cache
Fetched https://github.com/vapor/vapor.git (3.05s)
Computing version for https://github.com/vapor/vapor.git
Computed https://github.com/vapor/vapor.git at 4.69.2 (0.62s)
Fetching https://github.com/vapor/websocket-kit.git from cache
Fetching https://github.com/vapor/multipart-kit.git from cache
Fetching https://github.com/apple/swift-algorithms.git from cache
Fetched https://github.com/vapor/websocket-kit.git (5.62s)
Fetched https://github.com/apple/swift-algorithms.git (5.62s)
Fetching https://github.com/apple/swift-log.git from cache
Fetching https://github.com/apple/swift-metrics.git from cache
Fetched https://github.com/vapor/multipart-kit.git (5.63s)
Fetching https://github.com/apple/swift-nio-extras.git from cache
Fetched https://github.com/apple/swift-nio-extras.git (10.99s)
Fetching https://github.com/apple/swift-nio-http2.git from cache
Fetched https://github.com/apple/swift-metrics.git (11.61s)
Fetching https://github.com/apple/swift-nio-ssl.git from cache
Fetched https://github.com/apple/swift-log.git (11.61s)
Fetching https://github.com/apple/swift-nio.git from cache
Fetched https://github.com/apple/swift-nio-http2.git (43.83s)
Fetching https://github.com/swift-server/swift-backtrace.git
Fetched https://github.com/swift-server/swift-backtrace.git (8.10s)
Fetching https://github.com/vapor/routing-kit.git from cache
Fetched https://github.com/vapor/routing-kit.git (2.91s)
Fetching https://github.com/apple/swift-crypto.git from cache
Fetched https://github.com/apple/swift-nio-ssl.git (85.27s)
Fetching https://github.com/vapor/console-kit.git from cache
Fetched https://github.com/vapor/console-kit.git (1.93s)
Fetching https://github.com/vapor/async-kit.git from cache
Fetched https://github.com/vapor/async-kit.git (3.11s)
Fetching https://github.com/swift-server/async-http-client.git from cache
Fetched https://github.com/swift-server/async-http-client.git (2.11s)
warning: skipping cache due to an error: Couldn’t fetch updates from remote repositories:
fatal: unable to access 'https://github.com/apple/swift-crypto.git/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
Fetched https://github.com/apple/swift-crypto.git (159.04s)
Fetched https://github.com/apple/swift-nio.git (470.00s)
Computing version for https://github.com/apple/swift-algorithms.git
Computed https://github.com/apple/swift-algorithms.git at 1.0.0 (1.52s)
Fetching https://github.com/apple/swift-numerics
Fetched https://github.com/apple/swift-numerics (14.88s)
Computing version for https://github.com/vapor/routing-kit.git
Computed https://github.com/vapor/routing-kit.git at 4.6.0 (0.69s)
Computing version for https://github.com/vapor/async-kit.git
Computed https://github.com/vapor/async-kit.git at 1.16.0 (0.60s)
Computing version for https://github.com/apple/swift-nio.git
Computed https://github.com/apple/swift-nio.git at 2.48.0 (0.65s)
Fetching https://github.com/apple/swift-atomics.git
Fetching https://github.com/apple/swift-collections.git
Fetched https://github.com/apple/swift-atomics.git (144.71s)
Fetched https://github.com/apple/swift-collections.git (144.71s)
Computing version for https://github.com/apple/swift-atomics.git
Computed https://github.com/apple/swift-atomics.git at 1.0.3 (1.06s)
Computing version for https://github.com/apple/swift-numerics
Computed https://github.com/apple/swift-numerics at 1.0.2 (0.62s)
Computing version for https://github.com/apple/swift-collections.git
Computed https://github.com/apple/swift-collections.git at 1.0.4 (0.62s)
Computing version for https://github.com/vapor/multipart-kit.git
Computed https://github.com/vapor/multipart-kit.git at 4.5.2 (1.22s)
Computing version for https://github.com/apple/swift-log.git
Computed https://github.com/apple/swift-log.git at 1.5.2 (0.61s)
Computing version for https://github.com/apple/swift-nio-http2.git
Computed https://github.com/apple/swift-nio-http2.git at 1.23.1 (0.64s)
Computing version for https://github.com/apple/swift-metrics.git
Computed https://github.com/apple/swift-metrics.git at 2.3.3 (1.07s)
Computing version for https://github.com/swift-server/swift-backtrace.git
Computed https://github.com/swift-server/swift-backtrace.git at 1.3.3 (0.61s)
Computing version for https://github.com/swift-server/async-http-client.git
Computed https://github.com/swift-server/async-http-client.git at 1.13.2 (0.62s)
Fetching https://github.com/apple/swift-nio-transport-services.git
Fetched https://github.com/apple/swift-nio-transport-services.git (5.95s)
Computing version for https://github.com/apple/swift-nio-extras.git
Computed https://github.com/apple/swift-nio-extras.git at 1.15.0 (0.60s)
Computing version for https://github.com/apple/swift-nio-ssl.git
Computed https://github.com/apple/swift-nio-ssl.git at 2.23.0 (0.66s)
Computing version for https://github.com/apple/swift-nio-transport-services.git
Computed https://github.com/apple/swift-nio-transport-services.git at 1.15.0 (0.60s)
Computing version for https://github.com/vapor/websocket-kit.git
Computed https://github.com/vapor/websocket-kit.git at 2.6.1 (0.62s)
Computing version for https://github.com/vapor/console-kit.git
Computed https://github.com/vapor/console-kit.git at 4.6.0 (0.62s)
Computing version for https://github.com/apple/swift-crypto.git
Computed https://github.com/apple/swift-crypto.git at 2.2.4 (0.62s)
Creating working copy for https://github.com/vapor/multipart-kit.git
Working copy of https://github.com/vapor/multipart-kit.git resolved at 4.5.2
Creating working copy for https://github.com/apple/swift-nio.git
Working copy of https://github.com/apple/swift-nio.git resolved at 2.48.0
Creating working copy for https://github.com/swift-server/async-http-client.git
Working copy of https://github.com/swift-server/async-http-client.git resolved at 1.13.2
Creating working copy for https://github.com/apple/swift-log.git
Working copy of https://github.com/apple/swift-log.git resolved at 1.5.2
Creating working copy for https://github.com/apple/swift-crypto.git
Working copy of https://github.com/apple/swift-crypto.git resolved at 2.2.4
Creating working copy for https://github.com/apple/swift-atomics.git
Working copy of https://github.com/apple/swift-atomics.git resolved at 1.0.3
Creating working copy for https://github.com/vapor/console-kit.git
Working copy of https://github.com/vapor/console-kit.git resolved at 4.6.0
Creating working copy for https://github.com/apple/swift-algorithms.git
Working copy of https://github.com/apple/swift-algorithms.git resolved at 1.0.0
Creating working copy for https://github.com/vapor/routing-kit.git
Working copy of https://github.com/vapor/routing-kit.git resolved at 4.6.0
Creating working copy for https://github.com/vapor/async-kit.git
Working copy of https://github.com/vapor/async-kit.git resolved at 1.16.0
Creating working copy for https://github.com/swift-server/swift-backtrace.git
Working copy of https://github.com/swift-server/swift-backtrace.git resolved at 1.3.3
Creating working copy for https://github.com/apple/swift-collections.git
Working copy of https://github.com/apple/swift-collections.git resolved at 1.0.4
Creating working copy for https://github.com/apple/swift-metrics.git
Working copy of https://github.com/apple/swift-metrics.git resolved at 2.3.3
Creating working copy for https://github.com/apple/swift-nio-extras.git
Working copy of https://github.com/apple/swift-nio-extras.git resolved at 1.15.0
Creating working copy for https://github.com/apple/swift-nio-http2.git
Working copy of https://github.com/apple/swift-nio-http2.git resolved at 1.23.1
Creating working copy for https://github.com/apple/swift-nio-ssl.git
Working copy of https://github.com/apple/swift-nio-ssl.git resolved at 2.23.0
Creating working copy for https://github.com/apple/swift-numerics
Working copy of https://github.com/apple/swift-numerics resolved at 1.0.2
Creating working copy for https://github.com/vapor/vapor.git
Working copy of https://github.com/vapor/vapor.git resolved at 4.69.2
Creating working copy for https://github.com/vapor/websocket-kit.git
Working copy of https://github.com/vapor/websocket-kit.git resolved at 2.6.1
Creating working copy for https://github.com/apple/swift-nio-transport-services.git
Working copy of https://github.com/apple/swift-nio-transport-services.git resolved at 1.15.0
Building for debugging...
[1354/1354] Linking MyServer
Build complete! (726.57s)

可以看到总时长是726.57s,但总算是下好了。

  • Post title:Swift Package 下载慢解决方法
  • Post author:Meqt
  • Create time:2023-01-31 21:21:50
  • Post link:https://meqtmac.github.io/2023/01/31/swiftPackage/
  • Copyright Notice:All articles in this blog are licensed under BY-NC-SA unless stating additionally.