Skip to content

Conversation

@TheButlah
Copy link

@TheButlah TheButlah commented Dec 9, 2025

Closes #259

use std::path::PathBuf;

const ENV_OPTEE_CLIENT_EXPORT: &str = "OPTEE_CLIENT_EXPORT";
const AARCH64: &str = "aarch64-unknown-linux-gnu";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The targets aren’t limited to aarch64-unknown-linux-gnu and x86_64-unknown-linux-gnu. They can also include arm-unknown-linux-gnueabihf (see: arm-unknown-optee.json) and other variants, such as aarch64-unknown-none for no_std tests. It would be better to detect the architecture from the target triple rather than relying on the entire triple string.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest using CARGO_CFG_TARGET_ARCH to significantly reduce the effort required here.

Copy link
Contributor

@ivila ivila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After reviewing the code, it seems the logic can be reduced to two parts.

First, there’s a check to ensure the target architecture is one of x86_64, aarch64, or arm.

Second, it reads the TARGET environment variable and constructs a Vec<String> containing OPTEE_CLIENT_EXPORT_{target}, OPTEE_CLIENT_EXPORT_{target_with_underscores}, and OPTEE_CLIENT_EXPORT, then checks whether any of them are defined in order.

The architecture check isn’t really necessary as developers generally know what they are doing, so I suggest we can focus directly on the second part instead.

@TheButlah TheButlah force-pushed the thebutlah/specialize-optee-client-env-var branch from 2febde7 to 2aeaa84 Compare January 9, 2026 05:37
@TheButlah TheButlah force-pushed the thebutlah/specialize-optee-client-env-var branch from 2aeaa84 to 81c52f6 Compare January 9, 2026 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support target-specific OPTEE_CLIENT_EXPORT env variables to simplify cross compilation

2 participants