Bug 379427

Summary: 'C:\Program' not recognized as internal or external command in compilation of zlib.
Product: [Unmaintained] kde-windows Reporter: R030t1
Component: buildsystemAssignee: KDE-Windows <kde-windows>
Status: RESOLVED NOT A BUG    
Severity: critical CC: vonreth
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: log-C_KDE.txt

Description R030t1 2017-05-02 02:42:50 UTC
Created attachment 105306 [details]
log-C_KDE.txt

I can guess what is causing this (a typo) but am not really aware of any way to fix it. This only occurs when using MSVCC - I switched from MinGW to avoid Bug 379142.
Comment 1 Kevin Funk 2017-05-02 22:53:55 UTC
Error:
2017-05-01 19:35:51,534 INFO FAILED: zlib1rc.obj
2017-05-01 19:35:51,534 INFO cmd.exe /C "cd /D R:\build\win32libs\zlib\work\msvc2015-RelWithDebInfo-1.2.8 && "C:\Program Files\mingw-w64\x86_64-6.3.0-win32-seh-rt_v5-rev1\mingw64\bin\windres.exe" -D GCC_WINDRES -I R:/build/win32libs/zlib/work/zlib-1.2.8 -I R:/build/win32libs/zlib/work/msvc2015-RelWithDebInfo-1.2.8 -o R:/build/win32libs/zlib/work/msvc2015-RelWithDebInfo-1.2.8/zlib1rc.obj -i R:/build/win32libs/zlib/work/zlib-1.2.8/win32/zlib1.rc"
2017-05-01 19:35:51,534 INFO 'C:\Program' is not recognized as an internal or external command,
2017-05-01 19:35:51,534 INFO 
2017-05-01 19:35:51,534 INFO operable program or batch file.
2017-05-01 19:35:51,534 INFO 
2017-05-01 19:35:51,534 INFO C:\Program Files\mingw-w64\x86_64-6.3.0-win32-seh-rt_v5-rev1\mingw64\bin\windres.exe: preprocessing failed.
2017-05-01 19:35:51,534 INFO
Comment 2 Kevin Funk 2017-05-02 23:28:57 UTC
Upstream issue in zlib: From the root CMakeLists.txt:
```
    add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
                       COMMAND ${CMAKE_RC_COMPILER}
                            -D GCC_WINDRES
                            -I ${CMAKE_CURRENT_SOURCE_DIR}
                            -I ${CMAKE_CURRENT_BINARY_DIR}
                            -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
                            -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
```

=> MinGW Makefiles code generated by CMake does not properly escape the path containing spaces for CMAKE_RC_COMPILER, thus fails the compilation.

Fix: Don't install MinGW in a path containing spaces. It's as easy as that. The MinGW project itself recommends against it, see e.g.:
  http://stackoverflow.com/questions/5999507/mingw-make-cant-handle-spaces-in-path
Comment 3 R030t1 2017-05-03 02:31:01 UTC
Per the submission comment I was trying to use MSVCC - any idea why MinGW was pulled in? Any idea why MinGW compiles the exact same package successfully when installed in that location if MinGW is set explicitly?
Comment 4 R030t1 2017-05-03 02:33:13 UTC
I am confused because the installer defaults to "C:\Program Files" and because many Unix programs support spaces in file names (note the linked article is a decade old). Also, I told the setup script to use the Microsoft C compiler.
Comment 5 Hannah von Reth 2017-05-03 07:41:01 UTC
Please remove mingw-w64 6.3 from your path.
We only support the mings version installed by craft.