|
4 | 4 | # IMPORTANT: Cross-compilation runs ON x86_64 hosts, so protoc must be x86_64 |
5 | 5 | # even when cross-compiling FOR ARM targets. Protoc runs during build.rs, |
6 | 6 | # which executes on the host, not the target architecture. |
| 7 | +# |
| 8 | +# NOTE: We install clang-14 because bindgen 0.72+ requires clang 11+ |
| 9 | +# (uses clang_Type_getValueType which was added in clang 11). |
| 10 | +# The default cross images have clang 10 which is too old. |
7 | 11 |
|
8 | 12 | [build.env] |
9 | | -passthrough = ["PROTOC"] |
| 13 | +passthrough = ["PROTOC", "LIBCLANG_PATH", "LLVM_CONFIG_PATH"] |
10 | 14 |
|
11 | 15 | # All targets use x86_64 protoc because cross builds run on x86_64 hosts |
12 | 16 | [target.x86_64-unknown-linux-gnu] |
13 | 17 | pre-build = [ |
14 | | - "apt-get update && apt-get install -y curl unzip", |
| 18 | + "apt-get update && apt-get install -y curl unzip wget gnupg software-properties-common", |
| 19 | + "wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -", |
| 20 | + "add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main'", |
| 21 | + "apt-get update && apt-get install -y clang-14 libclang-14-dev", |
| 22 | + "ln -sf /usr/bin/clang-14 /usr/bin/clang", |
15 | 23 | "curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.3/protoc-28.3-linux-x86_64.zip", |
16 | 24 | "unzip protoc-28.3-linux-x86_64.zip -d /usr/local", |
17 | 25 | "chmod +x /usr/local/bin/protoc", |
18 | 26 | "rm protoc-28.3-linux-x86_64.zip", |
19 | 27 | ] |
20 | 28 |
|
| 29 | +[target.x86_64-unknown-linux-gnu.env] |
| 30 | +LIBCLANG_PATH = "/usr/lib/llvm-14/lib" |
| 31 | +LLVM_CONFIG_PATH = "/usr/bin/llvm-config-14" |
| 32 | + |
21 | 33 | [target.x86_64-unknown-linux-musl] |
22 | | -# libclang-dev is required for librocksdb-sys build script |
23 | 34 | pre-build = [ |
24 | | - "apt-get update && apt-get install -y curl unzip libclang-dev", |
| 35 | + "apt-get update && apt-get install -y curl unzip wget gnupg software-properties-common", |
| 36 | + "wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -", |
| 37 | + "add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main'", |
| 38 | + "apt-get update && apt-get install -y clang-14 libclang-14-dev", |
| 39 | + "ln -sf /usr/bin/clang-14 /usr/bin/clang", |
25 | 40 | "curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.3/protoc-28.3-linux-x86_64.zip", |
26 | 41 | "unzip protoc-28.3-linux-x86_64.zip -d /usr/local", |
27 | 42 | "chmod +x /usr/local/bin/protoc", |
28 | 43 | "rm protoc-28.3-linux-x86_64.zip", |
29 | 44 | ] |
30 | 45 |
|
| 46 | +[target.x86_64-unknown-linux-musl.env] |
| 47 | +LIBCLANG_PATH = "/usr/lib/llvm-14/lib" |
| 48 | +LLVM_CONFIG_PATH = "/usr/bin/llvm-config-14" |
| 49 | + |
31 | 50 | [target.aarch64-unknown-linux-gnu] |
32 | 51 | pre-build = [ |
33 | | - "apt-get update && apt-get install -y curl unzip", |
| 52 | + "apt-get update && apt-get install -y curl unzip wget gnupg software-properties-common", |
| 53 | + "wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -", |
| 54 | + "add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main'", |
| 55 | + "apt-get update && apt-get install -y clang-14 libclang-14-dev", |
| 56 | + "ln -sf /usr/bin/clang-14 /usr/bin/clang", |
34 | 57 | "curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.3/protoc-28.3-linux-x86_64.zip", |
35 | 58 | "unzip protoc-28.3-linux-x86_64.zip -d /usr/local", |
36 | 59 | "chmod +x /usr/local/bin/protoc", |
37 | 60 | "rm protoc-28.3-linux-x86_64.zip", |
38 | 61 | ] |
39 | 62 |
|
| 63 | +[target.aarch64-unknown-linux-gnu.env] |
| 64 | +LIBCLANG_PATH = "/usr/lib/llvm-14/lib" |
| 65 | +LLVM_CONFIG_PATH = "/usr/bin/llvm-config-14" |
| 66 | + |
40 | 67 | [target.aarch64-unknown-linux-musl] |
41 | | -# libclang-dev is required for librocksdb-sys build script |
42 | 68 | pre-build = [ |
43 | | - "apt-get update && apt-get install -y curl unzip libclang-dev", |
| 69 | + "apt-get update && apt-get install -y curl unzip wget gnupg software-properties-common", |
| 70 | + "wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -", |
| 71 | + "add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main'", |
| 72 | + "apt-get update && apt-get install -y clang-14 libclang-14-dev", |
| 73 | + "ln -sf /usr/bin/clang-14 /usr/bin/clang", |
44 | 74 | "curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.3/protoc-28.3-linux-x86_64.zip", |
45 | 75 | "unzip protoc-28.3-linux-x86_64.zip -d /usr/local", |
46 | 76 | "chmod +x /usr/local/bin/protoc", |
47 | 77 | "rm protoc-28.3-linux-x86_64.zip", |
48 | 78 | ] |
49 | 79 |
|
| 80 | +[target.aarch64-unknown-linux-musl.env] |
| 81 | +LIBCLANG_PATH = "/usr/lib/llvm-14/lib" |
| 82 | +LLVM_CONFIG_PATH = "/usr/bin/llvm-config-14" |
| 83 | + |
50 | 84 | # ARMv7 targets are disabled because rquickjs doesn't have pre-built bindings for them |
51 | 85 | # Uncomment when/if rquickjs adds armv7 support |
52 | 86 | # [target.armv7-unknown-linux-gnueabihf] |
53 | | -# pre-build = [ |
54 | | -# "apt-get update && apt-get install -y curl unzip libclang-dev", |
55 | | -# "curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.3/protoc-28.3-linux-x86_64.zip", |
56 | | -# "unzip protoc-28.3-linux-x86_64.zip -d /usr/local", |
57 | | -# "chmod +x /usr/local/bin/protoc", |
58 | | -# "rm protoc-28.3-linux-x86_64.zip", |
59 | | -# ] |
60 | | - |
61 | 87 | # [target.armv7-unknown-linux-musleabihf] |
62 | | -# pre-build = [ |
63 | | -# "apt-get update && apt-get install -y curl unzip libclang-dev", |
64 | | -# "curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v28.3/protoc-28.3-linux-x86_64.zip", |
65 | | -# "unzip protoc-28.3-linux-x86_64.zip -d /usr/local", |
66 | | -# "chmod +x /usr/local/bin/protoc", |
67 | | -# "rm protoc-28.3-linux-x86_64.zip", |
68 | | -# ] |
|
0 commit comments