Description
I am using this crate to compile CMake projects using the x86_64-fortanix-unknown-sgx
target to run under Intel SGX, and the latest update to this crate (v0.1.49
) is causing the following errors that weren't present in the previous version:
System is unknown to cmake, create:
Platform/unknown to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately:
RUN_RESULT (advanced)
RUN_RESULT__TRYRUN_OUTPUT (advanced)
I believe this is likely due to the changes made in #158. These result in -DCMAKE_SYSTEM_NAME=unknown
being passed to CMake, which it does not understand.
In my own crates I am able to fix this by overriding the variables manually as follows:
if env::var("CARGO_CFG_TARGET_ENV").unwrap() == "sgx" {
config.define("CMAKE_CROSSCOMPILING", "OFF");
config.define("CMAKE_SYSTEM_NAME", "Linux");
config.define("CMAKE_SYSTEM_PROCESSOR", "x86_64");
}
But I might not always have the option of making this modification for any third-party crates.
I'm not sure what the correct fix for this would be, possibly just disabling the setting of the cross-compile variables when the x86_64-fortanix-unknown-sgx
target is being used?