+28
.github/SQLX_AND_CROSS_COMPILATION.md
+28
.github/SQLX_AND_CROSS_COMPILATION.md
···
36
36
37
37
```toml
38
38
# Root Cargo.toml
39
+
tokio = { version = "1.0", features = [
40
+
"rt-multi-thread",
41
+
"macros",
42
+
"time", # Required for tokio::time module
43
+
"net", # Required for networking
44
+
"sync", # Required for synchronization primitives
45
+
] }
46
+
39
47
sqlx = { version = "0.8", features = [
40
48
"runtime-tokio",
41
49
"postgres",
···
52
60
53
61
tokio-tungstenite = { version = "*", default-features = false, features = [
54
62
"rustls-tls-webpki-roots", # Instead of default native-tls
63
+
"connect", # For connect_async function
64
+
"handshake", # For accept_async function (tests)
55
65
] }
56
66
```
57
67
···
162
172
- Check that `PKG_CONFIG_ALLOW_CROSS=1` is set
163
173
- Verify no dependencies are pulling in OpenSSL (use `cargo tree | grep openssl`)
164
174
175
+
### tokio-tungstenite Import Errors
176
+
If you see "unresolved import `tokio_tungstenite::connect_async`" errors:
177
+
- Ensure the `connect` feature is enabled for client functionality
178
+
- Add the `handshake` feature if using `accept_async` for server functionality
179
+
- Check that `default-features = false` is set to avoid OpenSSL dependencies
180
+
181
+
### tokio Module Errors
182
+
If you see "could not find `time` in `tokio`" or similar errors:
183
+
- Ensure tokio workspace dependency includes required features: `time`, `net`, `sync`
184
+
- These features are often included in default features but must be explicit when using `default-features = false`
185
+
165
186
### SQLx Offline Errors
166
187
- Run `./scripts/setup-sqlx-offline.sh` after any SQL query changes
167
188
- Ensure `.sqlx` directory exists in workspace root
···
177
198
- Default to OpenSSL (use rustls variants)
178
199
- Require system libraries not available in cross containers
179
200
- Have complex native build requirements
201
+
202
+
### Common Feature Configuration Issues
203
+
When disabling default features to avoid OpenSSL:
204
+
- `tokio`: Must explicitly enable `time`, `net`, `sync` features for common functionality
205
+
- `tokio-tungstenite`: Must explicitly enable `connect` and `handshake` features
206
+
- `reqwest`: Must explicitly enable required features like `json`, `stream`, `gzip`
207
+
- `sqlx`: Use `tls-rustls` instead of default OpenSSL TLS
180
208
181
209
Always test cross-compilation locally before pushing changes.
+9
-1
Cargo.toml
+9
-1
Cargo.toml
···
9
9
10
10
[workspace.dependencies]
11
11
# Shared dependencies
12
-
tokio = { version = "1.0", features = ["rt-multi-thread", "macros"] }
12
+
tokio = { version = "1.0", features = [
13
+
"rt-multi-thread",
14
+
"macros",
15
+
"time",
16
+
"net",
17
+
"sync",
18
+
] }
13
19
axum = { version = "0.8", features = ["macros"] }
14
20
tower-http = { version = "0.6", features = ["cors"] }
15
21
sqlx = { version = "0.8", features = [
···
38
44
dotenvy = "0.15"
39
45
tokio-tungstenite = { version = "*", default-features = false, features = [
40
46
"rustls-tls-webpki-roots",
47
+
"connect",
48
+
"handshake",
41
49
] }
42
50
atrium-api = "0.25"
43
51
chrono = "0.4"