corrosion
corrosion copied to clipboard
Build Error with FetchContent Path
sure i've made an oversight of some kind here but I used the FetchContent path like so...
include(FetchContent)
FetchContent_Declare(Corrosion
GIT_REPOSITORY https://github.com/AndrewGaspar/corrosion.git
GIT_TAG master
)
FetchContent_MakeAvailable(Corrosion)
set(Rust_COMPILER ${3rdParty_SDIR}/rust/rustc/bin/rustc)
set(Rust_CARGO ${3rdParty_SDIR}/rust/cargo/bin/cargo)
ExternalProject_Add(cloudflarequiche
GIT_REPOSITORY https://github.com/cloudflare/quiche.git
GIT_TAG master
GIT_SHALLOW ON
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
corrosion_import_crate(MANIFEST_PATH ${3rdParty_SDIR}/cloudflarequiche/Cargo.toml)
add_dependencies(quicheperf quiche)
and getting this build error from cmake..
root@clr-df9e289c0de04eb2a0cfc75803a0b93e~/quicperf # cmake -S . -B build && cmake --build build
No such file or directory
CMake Error at build/_deps/corrosion-src/cmake/FindRust.cmake:159 (get_filename_component):
get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
build/_deps/corrosion-src/cmake/Corrosion.cmake:11 (find_package)
build/_deps/corrosion-src/CMakeLists.txt:59 (include)
-- Configuring incomplete, errors occurred!
See also "/root/quicperf/build/CMakeFiles/CMakeOutput.log".
My co-worker got the same error while opening my project in Qt Creator. I have not investigated yet. Did you find the root cause of it @victorstewart ?
i didn't so i came up with this other solution which works!
@ratijas
set(3rdParty_SDIR ${CMAKE_BINARY_DIR}/3rdparty/Source)
set(3rdParty_BDIR ${CMAKE_BINARY_DIR}/3rdparty/Build)
...
ExternalProject_Add(rust
URL https://static.rust-lang.org/dist/rust-1.51.0-x86_64-unknown-linux-gnu.tar.gz
DOWNLOAD_NAME rust
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Add(quiche
DEPENDS rust
GIT_REPOSITORY https://github.com/cloudflare/quiche.git
GIT_TAG its-the-final-saltdown
GIT_SHALLOW ON
CONFIGURE_COMMAND ""
BUILD_IN_SOURCE ON
BUILD_COMMAND ${CMAKE_COMMAND} -E env RUSTC=${3rdParty_SDIR}/rust/rustc/bin/rustc ${CMAKE_COMMAND} -E env RUSTFLAGS=-L${3rdParty_SDIR}/rust/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib ${3rdParty_SDIR}/rust/cargo/bin/cargo build --features ffi --release
INSTALL_COMMAND ""
)
FetchContent_MakeAvailable(Corrosion) set(Rust_COMPILER ${3rdParty_SDIR}/rust/rustc/bin/rustc) set(Rust_CARGO ${3rdParty_SDIR}/rust/cargo/bin/cargo)
The Rust_XXX
variables must be set before Corrosion or FindRust is included, in this case via FetchContent_MakeAvailable
.
I suspect you did not have Rust available in PATH, and since the Rust_
variable was also not set when FindRust
was run, FindRust
failed with this cryptic error. I'll add some additional checks and error messages, which should help in the future.
A helpful error message should now be printed if Rust_COMPILER
is not set and rustc
not found in PATH.