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

Compilation errors not shown in output

Open ennis opened this issue 2 years ago • 2 comments

Version: 1.0.79 OS: Windows 11 x64 with MSVC (with french language module)

This build script: https://github.com/ennis/openimageio-rs/blob/master/openimageio-sys/build.rs produces the following output:

The following warnings were emitted during compilation:
warning: cl�: Ligne de commande warning D9002�: option '-std=c++17' inconnue ignor�e
warning: cl�: Ligne de commande warning D9002�: option '-std=c++17' inconnue ignor�e
warning: cl�: Ligne de commande warning D9002�: option '-std=c++17' inconnue ignor�e
warning: cl�: Ligne de commande warning D9002�: option '-std=c++17' inconnue ignor�e
warning: cl�: Ligne de commande warning D9002�: option '-std=c++17' inconnue ignor�e
error: failed to run custom build command for `openimageio-sys v0.1.0 (C:\Users\Alexandre\devel\openimageio-rs\openimageio-sys)`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_TEST_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.
Caused by:
  process didn't exit successfully: `C:\Users\Alexandre\devel\openimageio-rs\target\debug\build\openimageio-sys-62699496145a9d69\build-script-build` (exit code: 1)
  --- stderr
  trying to detect/fetch OpenImageIO via vcpkg...
  found OpenImageIO through vcpkg
  -> libs: ["C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\OpenImageIO.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\OpenImageIO_Util.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\zlib.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\tiff.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\lzma.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\jpeg.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\turbojpeg.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\Iex-3_1.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\IlmThread-3_1.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\OpenEXR-3_1.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\OpenEXRCore-3_1.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\OpenEXRUtil-3_1.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\Imath-3_1.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\libpng16.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\fmt.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\boost_thread-vc140-mt.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\boost_system-vc140-mt.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\boost_regex-vc140-mt.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\boost_container-vc140-mt.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\boost_exception-vc140-mt.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\boost_date_time-vc140-mt.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\boost_chrono-vc140-mt.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\boost_atomic-vc140-mt.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\boost_stacktrace_noop-vc140-mt.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\boost_stacktrace_windbg-vc140-mt.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\boost_stacktrace_windbg_cached-vc140-mt.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\boost_random-vc140-mt.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\boost_filesystem-vc140-mt.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\boost_coroutine-vc140-mt.lib", "C:\\vcpkg\\installed\\x64-windows-static-md\\lib\\boost_context-vc140-mt.lib"]
  -> link paths: ["C:\\vcpkg\\installed\\x64-windows-static-md\\lib"]
  -> include paths: ["C:\\vcpkg\\installed\\x64-windows-static-md\\include"]
  -> DLLs: []
  -> DLL paths: []
  clang version 15.0.4
  Target: x86_64-pc-windows-msvc
  Thread model: posix
  InstalledDir: 
  ignoring nonexistent directory "lib\clang\15.0.4\include"
  #include "..." search starts here:
  #include <...> search starts here:
   C:\vcpkg\installed\x64-windows-static-md\include
   C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include
   C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\atlmfc\include
   C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt
   C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared
   C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um
   C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\winrt
   C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt
  End of search list.
  error occurred: Command "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.32.31326\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-Z7" "-Brepro" "-I" "src/glue" "-I" "C:\\vcpkg\\installed\\x64-windows-static-md\\include" "-W4" "-std=c++17" "-DOIIO_STATIC_DEFINE" "-FoC:\\Users\\Alexandre\\devel\\openimageio-rs\\target\\debug\\build\\openimageio-sys-fdd0f34cca1069aa\\out\\src/glue/imagecache.o" "-c" "src/glue/imagecache.cpp" with args "cl.exe" did not execute successfully (status code exit code: 2).
Process finished with exit code 101

If I compile the file separately I can see the compilation errors:

src/glue/imagecache.cpp(9): error C2027: utilisation du type non défini 'OpenImageIO_v2_4::ImageCache'
C:\vcpkg\installed\x64-windows-static-md\include\OpenImageIO/imagebuf.h(27): note: voir la déclaration de 'OpenImageIO_v2_4::ImageCache'
src/glue/imagecache.cpp(9): error C3861: 'create' : identificateur introuvable
src/glue/imagecache.cpp(13): error C2027: utilisation du type non défini 'OpenImageIO_v2_4::ImageCache'
C:\vcpkg\installed\x64-windows-static-md\include\OpenImageIO/imagebuf.h(27): note: voir la déclaration de 'OpenImageIO_v2_4::ImageCache'
src/glue/imagecache.cpp(13): error C3861: 'destroy' : identificateur introuvable
src/glue/imagecache.cpp(17): error C2027: utilisation du type non défini 'OpenImageIO_v2_4::ImageCache'
...

Curiously the script still prints the warnings for the invalid command line parameters (warning: cl�: Ligne de commande warning D9002�: option '-std=c++17' inconnue ignor�e), but compilation warning and errors are not reported.

It works fine (it reports the errors) if I install the VS english language pack and set that as the default language, so I suppose this is a problem related to non-UTF8 output being silently dropped somehow.

ennis avatar May 17 '23 20:05 ennis

Hm, I recently made some changes so that rustc itself attempts to convert the output to UTF-8. Maybe something similar can be done for cc-rs.

That said, it seems bad that it's being silently dropped. I'm not immediately sure why that is.

ChrisDenton avatar May 17 '23 20:05 ChrisDenton

Yes, this is a problem with the Visual Studio language pack. cc-rs silently drop cl.exe's stdout when the language is not english. To propertly see all the errors the user must install the English language pack in the Visual Studio Installer and set the env var VSLANG=1033 to activate it in the current shell.

Check this related issue in other repo https://github.com/pyca/cryptography/issues/9746#issuecomment-1775911491

HMaker avatar Oct 23 '23 19:10 HMaker