[Scons-users] Bug report intelc tempfile
orenaud at coventor.com
orenaud at coventor.com
Fri Nov 29 11:02:48 EST 2019
Hi,
I hit a bug in SCons 3.1.1 when using the Intel C++ compiler on Windows. I found the reason for this bug, and a workaround. This is a regression from SCons 2.
The symptom is that any C++ file compiled with Intel compiler fails with this kind of error message:
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.4.210 Build 20170411
Copyright (C) 1985-2017 Intel Corporation. All rights reserved.
'cl: command line warning #10006: ignoring unknown option '/c
'; object file assumeding #10161: unrecognized source type 'modeler\concrete\fillFractionConcObjs\COctreeFragmentOps.cpp
'cl: command line warning #10006: ignoring unknown option '/TP
'cl: command line warning #10006: ignoring unknown option '/nologo
icl: command line warning #10157: ignoring option '/MP'; argument is of wrong type
'cl: command line warning #10006: ignoring unknown option '/G
'cl: command line warning #10006: ignoring unknown option '/EH
'cl: command line warning #10006: ignoring unknown option '/Z
' for '/W'; assuming '1'g #10127: invalid value '
'cl: command line warning #10006: ignoring unknown option '/MD
'cl: command line warning #10006: ignoring unknown option '/Z
icl: command line warning #10159: invalid argument for option '/Qvc'
icl: command line warning #10159: invalid argument for option '/Qstd'
'cl: command line warning #10006: ignoring unknown option '/O
' for option '/debug'or: Unrecognized keyword 'inline-debug-info
The command line that invokes icl is fine, and works well when run outside of SCons. I found that the problem is that SCons uses a tempfile to execute this command (icl @path/to/tempfile), and the content of this tempfile uses \r\r\n as end of lines. Note the two \r here.
When I look into the sources of SCons, I see that mslib.py, mslink.py and msvc.py set the env variable TEMPFILEARGJOIN to os.linesep, which on Windows is \r\n. The intelc SCons tool shares most of its env with the one from msvc, so it inherits that variable. The code that writes the tempfile (Platform/__init__.py) opens a tempfile in text mode (line 208), joins the arguments with TEMPFILEARGJOIN (\r\n), and writes the result to the tempfile (line 230). But because the tempfile is opened in text mode, the \n in \r\n gets converted to \r\n, and thus the actual newline written to the file is \r\r\n. For some reason, msvc is ok with this fancy newline, but intelc is not.
The workaround I use is to set TEMPFILEARGJOIN to \n. I think the real fix is probably to open the tempfile in binary mode instead of text.
Olivier Renaud
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20191129/b60ec7b9/attachment.html>
More information about the Scons-users
mailing list