-
Notifications
You must be signed in to change notification settings - Fork 1
Make more efforts to detect system SUNDIALS libraries #1
Conversation
build.rs
Outdated
#[cfg(target_family = "wasm")] { | ||
(lib_loc, inc_dir, library_type) = build_vendored_sundials(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to cross compile to wasm to no avail. That being said, I'm no wasm expert and it doesn't work in current master. Could you test wasm builds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll start by adding WASM to the CI. Hopefully cmake supports it otherwise that would be the first step...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is your experience with WASM? On my machine, clang
does not succeed to compile the C code — but clearly, the path to stdio.h
(present in many sundials files) is probably not the one WASM wants... (like you, I'm far from being an expert in WASM).
...
Compiling sundials-sys v0.2.3 (/home/trch/software/Rust/Scientific/sundials-sys)
error: failed to run custom build command for `sundials-sys v0.2.3 (/home/trch/software/Rust/Scientific/sundials-sys)`
Caused by:
process didn't exit successfully: `/home/trch/software/Rust/Scientific/sundials-sys/target/debug/build/sundials-sys-95571e3a631130d5/build-script-build` (exit status: 101)
--- stdout
CMAKE_TOOLCHAIN_FILE_wasm32-unknown-unknown = None
CMAKE_TOOLCHAIN_FILE_wasm32_unknown_unknown = None
TARGET_CMAKE_TOOLCHAIN_FILE = None
CMAKE_TOOLCHAIN_FILE = None
CMAKE_GENERATOR_wasm32-unknown-unknown = None
CMAKE_GENERATOR_wasm32_unknown_unknown = None
TARGET_CMAKE_GENERATOR = None
CMAKE_GENERATOR = None
CMAKE_PREFIX_PATH_wasm32-unknown-unknown = None
CMAKE_PREFIX_PATH_wasm32_unknown_unknown = None
TARGET_CMAKE_PREFIX_PATH = None
CMAKE_PREFIX_PATH = None
CMAKE_wasm32-unknown-unknown = None
CMAKE_wasm32_unknown_unknown = None
TARGET_CMAKE = None
CMAKE = None
running: "cmake" "/home/trch/software/Rust/Scientific/sundials-sys/vendor" "-DCMAKE_INSTALL_LIBDIR=lib" "-DBUILD_STATIC_LIBS=OFF" "-DBUILD_SHARED_LIBS=ON" "-DBUILD_TESTING=OFF" "-DEXAMPLES_INSTALL=OFF" "-DEXAMPLES_ENABLE_C=OFF" "-DBUILD_ARKODE=ON" "-DBUILD_CVODE=ON" "-DBUILD_CVODES=OFF" "-DBUILD_IDA=ON" "-DBUILD_IDAS=OFF" "-DBUILD_KINSOL=ON" "-DOPENMP_ENABLE=OFF" "-DPTHREAD_ENABLE=OFF" "-DCMAKE_INSTALL_PREFIX=/home/trch/software/Rust/Scientific/sundials-sys/target/wasm32-unknown-unknown/debug/build/sundials-sys-0f90bc14c5fa37e0/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown" "-DCMAKE_C_COMPILER=/usr/bin/clang" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown" "-DCMAKE_CXX_COMPILER=/usr/bin/clang" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown" "-DCMAKE_ASM_COMPILER=/usr/bin/clang" "-DCMAKE_BUILD_TYPE=Debug"
-- The C compiler identification is Clang 14.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang - broken
-- Configuring incomplete, errors occurred!
...
--- stderr
/usr/include/stdio.h:27:10: fatal error: 'bits/libc-header-start.h' file not found
/usr/include/stdio.h:27:10: fatal error: 'bits/libc-header-start.h' file not found, err: true
CMake Error at /usr/share/cmake-3.25/Modules/CMakeTestCCompiler.cmake:70 (message):
The C compiler
"/usr/bin/clang"
is not able to compile a simple test program.
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understand it, because the sundials code expects some system resources, Emscripten should be used to compile it. A patch was merged on May 11 in the cmake crate for that. So, if I do
rustup target add wasm32-unknown-emscripten
cargo build --target wasm32-unknown-emscripten
I get
CMake Error at cmake/macros/SundialsCMakeMacros.cmake:89 (message):
************************************************************************
ERROR: No integer type of size 8 was found.
Tried int64_t__int64longlonglong.
Try setting the advanced option SUNDIALS_INDEX_TYPE.
************************************************************************
Call Stack (most recent call first):
cmake/SundialsIndexSize.cmake:45 (print_error)
cmake/SundialsSetupCompilers.cmake:21 (include)
CMakeLists.txt:161 (include)
thread 'main' panicked at '
command did not execute successfully, got: exit status: 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There may not be a way around that: emscripten-core/emscripten#11140 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately int64_t is currently not supported by emscripten (emscripten-core/emscripten#11140 (comment)), so cargo build --target wasm32-unknown-emscripten fails
This looks good to me as-is, even though I couldn't get the WASM to build. I'll merge and proceed to transfer the crate to you. |
There is a |
build.rs
to try to detect system Sundials libraries;