asir66 opened a new issue, #240:
URL: https://github.com/apache/teaclave-trustzone-sdk/issues/240

   # Summary
   
   After October 17, 2025, all examples in the Teaclave TrustZone SDK that 
previously built successfully (including `hello_world-rs`) now fail to compile.
   There appear to be two separate issues:
   
   1. (no-std mode): Build fails because a dependency (`[email protected]`) 
requires a newer Rust compiler (rustc ≥ 1.82).
   → I found a potential workaround but would like confirmation from 
maintainers.
   
   2. (std mode): Build fails with `Cargo.lock file is missing from source dir`.
   → This issue persists across all tested Rust versions, and I cannot resolve 
it.
   
   # Environment
   
   - **Rustup:** rustup 1.28.2 (e4f3ad6f8 2025-04-28)
   - **Toolchain (from rust-toolchain.toml):** nightly-2024-05-15
   - **rustc:** 1.80.0-nightly (8387315ab 2024-05-14)
   - **Cargo:** 1.80.0-nightly (4de0094ac 2024-05-09)
   - **SDK Commit:** main (as of 2025-10-17)
   
   # Problem 1 — no-std mode build failure
   
   Previously, I was testing and improving the example serde-rs and everything 
worked fine before October 17.
   After October 18, `make` started failing with the following output:
   
   ```shell
   error: rustc 1.80.0-nightly is not supported by the following package:  
    [email protected] requires rustc 1.82  
   Either upgrade rustc or select compatible dependency versions with  
   `cargo update <name>@<current-ver> --precise <compatible-ver>`  
   where `<compatible-ver>` is the latest version supporting rustc 
1.80.0-nightly 
   make[1]: *** [Makefile:32: clippy] Error 101  
   make[1]: Leaving directory 
'/root/teaclave_sdk_src/examples/hello_world-rs/host'  
   make: *** [Makefile:32: host] Error 2  
   make: Leaving directory '/root/teaclave_sdk_src/examples/hello_world-rs'  
   root@7177de95871c:~/teaclave_sdk_src#
   ```
   
   ##  Dependency Analysis
   
   From cargo tree, the dependency chain shows that:
   
   ```shell
   acipher-rs v0.4.0 (/root/teaclave_sdk_src/examples/acipher-rs/host)  
   |-- libc v0.2.177  
   |-- optee-teec v0.6.0 (/root/teaclave_sdk_src/optee-teec)  
   |   |-- num_enum v0.7.4  
   |   |   |-- num_enum_derive v0.7.4 (proc-macro)  
   |   |   |   |-- proc-macro-crate v3.4.0  
   |   |   |   |   `-- toml_edit v0.23.7  
   |   |   |   |       |-- indexmap v2.12.0  // there
   ```
   And indexmap v2.12.0 explicitly requires rustc ≥ 1.82.
   
   Thus, with rustc 1.80.0-nightly (8387315ab 2024-05-14), builds will fail for 
all std-based examples.
   
   | Rustc Version | Date | Build Result |
   |---------------|------|---------------|
   | **1.80.0-nightly** (2024-05-14) | current default | ❌ fails (`indexmap` 
requires ≥1.82) |
   | **1.82.0-nightly** (2024-09-01) | manually set | ✅ all *no-std* examples 
build successfully |
   | **1.92.0-nightly** (2025-10-18) | latest | ⚠️ some examples fail with 
linker errors |
   
   ### Errors with Latest Nightly (1.92.0)
   
   When upgrading to nightly-2025-10-18, several examples (tcp_client-rs, 
udp_socket-rs, client_pool-rs, property-rs) fail with linker errors like:
   
   ```shell
    warning: `optee-utee` (lib) generated 3 warnings (run `cargo fix --lib -p 
optee-utee` to apply 2 suggestions)
   error: linking with `aarch64-linux-gnu-gcc` failed: exit status: 1
     |
     = note:  "aarch64-linux-gnu-gcc" "<1 object files omitted>" 
"-Wl,--as-needed" "-Wl,-Bstatic" "-lutee" "-lutils" 
"/tmp/rustcTX88kR/liboptee_utee_sys-1a3bc3df2f58c851.rlib" 
"<sysroot>/lib/rustlib/aarch64-unknown-linux-gnu/lib/libcompiler_builtins-*.rlib"
 "-L" "/tmp/rustcTX88kR/raw-dylibs" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" 
"-Wl,-z,noexecstack" "-L" 
"/root/teaclave_sdk_src/examples/property-rs/ta/target/aarch64-unknown-linux-gnu/release/build/ta-114a64b9bf200f26/out"
 "-L" "/opt/teaclave/optee/optee_os/out/arm-plat-vexpress/export-ta_arm64/lib" 
"-L" "<sysroot>/lib/rustlib/aarch64-unknown-linux-gnu/lib" "-o" 
"/root/teaclave_sdk_src/examples/property-rs/ta/target/aarch64-unknown-linux-gnu/release/deps/ta-2e7f14c1c2e49ffa"
 "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,--strip-debug" 
"-nodefaultlibs" 
"-T/root/teaclave_sdk_src/examples/property-rs/ta/target/aarch64-unknown-linux-gnu/release/build/ta-114a64b9bf200f26/out/ta.lds"
 "-e__ta_entry" "-pie" "-Os" "-Wl,--sort-section=al
 ignment" "-Wl,--dynamic-list=dyn_list"
     = note: some arguments are omitted. use `--verbose` to show all linker 
arguments
     = note: 
/usr/lib/gcc-cross/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/bin/ld: 
/root/teaclave_sdk_src/examples/property-rs/ta/target/aarch64-unknown-linux-gnu/release/deps/ta-2e7f14c1c2e49ffa.ta.bc8d6487cd5461d2-cgu.0.rcgu.o:
 in function `alloc::string::String::from_utf8_lossy':
             
/rustc/f46475914de626785090a05ae037578aaa119fc8/library/alloc/src/alloc.rs:(.text._ZN5alloc6string6String15from_utf8_lossy17h05bc5684232e90f0E+0x224):
 undefined reference to `_Unwind_Resume'
             
/usr/lib/gcc-cross/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/bin/ld: 
/root/teaclave_sdk_src/examples/property-rs/ta/target/aarch64-unknown-linux-gnu/release/deps/ta-2e7f14c1c2e49ffa.ta.bc8d6487cd5461d2-cgu.0.rcgu.o:
 in function `alloc::ffi::c_str::CString::_from_vec_unchecked':
             
/rustc/f46475914de626785090a05ae037578aaa119fc8/library/alloc/src/ffi/c_str.rs:(.text._ZN5alloc3ffi5c_str7CString19_from_vec_unchecked17he2c5654219718493E+0x108):
 undefined reference to `_Unwind_Resume'
             
/usr/lib/gcc-cross/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/bin/ld: 
/root/teaclave_sdk_src/examples/property-rs/ta/target/aarch64-unknown-linux-gnu/release/deps/ta-2e7f14c1c2e49ffa.ta.bc8d6487cd5461d2-cgu.0.rcgu.o:(.data.DW.ref.rust_eh_personality[DW.ref.rust_eh_personality]+0x0):
 undefined reference to `rust_eh_personality'
             collect2: error: ld returned 1 exit status
             
     = note: some `extern` functions couldn't be found; some native libraries 
may need to be installed or have their path specified
     = note: use the `-l` flag to specify native libraries to link
     = note: use the `cargo:rustc-link-lib` directive to specify the native 
libraries to link with Cargo (see 
https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)
   
   error: could not compile `ta` (bin "ta") due to 1 previous error
   make[1]: *** [Makefile:44: ta] Error 101
   make[1]: Leaving directory '/root/teaclave_sdk_src/examples/property-rs/ta'
   make: *** [Makefile:36: ta] Error 2
   make: Leaving directory '/root/teaclave_sdk_src/examples/property-rs'
   root@1aca596c71d5:~/teaclave_sdk_src/examples# 
   ```
   
   These appear to be missing unwind symbols for aarch64-unknown-linux-gnu, 
possibly caused by:
   
   Changes in panic/unwinding behavior in newer Rust versions, or
   
   Missing runtime libraries expected by the new toolchain.
   
   Even though the project already specifies panic = "abort", the linker still 
fails, suggesting a deeper target-spec compatibility issue.
   
   ### Question for maintainers
   
   Should we officially bump the toolchain version in the repository to nightly 
≥ 2024-09-01 to maintain compatibility with indexmap and related crates?
   
   # Problem 2 — std mode build failure
   
   Even after fixing the compiler version, all std-mode builds still fail with:
   
   ```
   make -C ta TARGET=aarch64-unknown-optee \
           CROSS_COMPILE=aarch64-linux-gnu- \
           BUILDER=xargo \
           FEATURES=""
   make[1]: Entering directory 
'/root/teaclave_sdk_src/examples/hello_world-rs/ta'
   error: Cargo.lock file is missing from source dir
   caused by: No such file or directory (os error 2)
   note: run with `RUST_BACKTRACE=1` for a backtrace
   make[1]: *** [Makefile:41: clippy] Error 1
   make[1]: Leaving directory 
'/root/teaclave_sdk_src/examples/hello_world-rs/ta'
   make: *** [Makefile:36: ta] Error 2
   make: Leaving directory '/root/teaclave_sdk_src/examples/hello_world-rs'
   root@98edc21f477c:~/teaclave_sdk_src# 
   ```
   
   This issue occurs across all tested Rust versions (1.80, 1.82, 1.92).
   I'm not very sure about the root cause and the proper fix for this issue.
   
   # Steps to reproduce:
   Modify [this 
line](https://github.com/apache/teaclave-trustzone-sdk/blob/3626935b1336fe4cabdb7d89ea1a21197faef87b/rust-toolchain.toml#L21)
    in the repository.
   The tested versions are mentioned above.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to