cmake-rs icon indicating copy to clipboard operation
cmake-rs copied to clipboard

Suggestion: more output on error for troubleshooting

Open kazuki0824 opened this issue 4 years ago • 0 comments
trafficstars

If you call this from build.rs and it terminates in error, the output will be too small to be useful like below.

Caused by: process didn't exit successfully: C:\Users\kazuk\Desktop\recisdb-rust\target\debug\build\libarib25-sys-2f57403dcdef0bcc\build-script-build (exit code: 101) --- stderr thread 'main' panicked at ' command did not execute successfully, got: exit code: 1 build script failed, must exit now', C:\Users\kazuk.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.45\src\lib.rs:894:5
stack backtrace: ..........

I suggest that we print an additional output to make it easier to reproduce the error. This can be done by simply changing here; https://github.com/alexcrichton/cmake-rs/blob/9af8515c781fc2a6163d60315a33485e45543e64/src/lib.rs#L940 to

    eprintln!("running: {:?}", cmd);

. By this change, we can see what is now executed like:

Caused by: process didn't exit successfully: C:\Users\kazuk\Desktop\recisdb-rust\target\debug\build\libarib25-sys-2f57403dcdef0bcc\build-script-build (exit code: 101) --- stderr running: "cmake" "-Wdev" "--debug-output" "C:\Users\kazuk\Desktop\recisdb-rust\libarib25-sys\./libarib25" "-Thost=x64" "-Ax64" "-G" "Visual Studio 16" "-DCMAKE_INSTALL_PREFIX=C:\Users\kazuk\Desktop\recisdb-rust\target\debug\build\libarib25-sys-e0102d33ba4baf38\out" "-DCMAKE_C_FLAGS= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS= -nologo -MD -Brepro" "-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" running: "cmake" "--build" "." "--target" "install" "--config" "Debug" "--" "/m:4" thread 'main' panicked at ' command did not execute successfully, got: exit code: 1 build script failed, must exit now', C:\Users\kazuk.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.45\src\lib.rs:894:5
stack backtrace:

But that is just a workaround and I bet there's more appropriate way to fix it. I'm welcome to any discussion and suggestion. Thank you.

kazuki0824 avatar Sep 17 '21 09:09 kazuki0824