Closed cooldome closed 5 years ago
Options in cfg or nimscript files loaded after nim/config/nim.cfg
can overwrite options in nim/config/nim.cfg
, but nim/config/nim.cfg
cannot overwrite these options.
Before commit df3d08b, $cpu.$os.vcc.*
options are not set in nim/config/nim.cfg
and vcc.*
options are always used in both native compile and cross compile.
So you can set vcc.options.always = "/INCORRECT"
in your project.cfg so that it appears in the command line when you set --cpu:i386
.
But that caused issue #10387.
After commit df3d08b, $cpu.$os.vcc.*
options are set in nim/config/nim.cfg
and vcc.*
options are used in only native compile not in cross compile.
If you are using x86_64 Nim and set --cpu:i386
option to do cross compile, your project.cfg need to use i386.windows.vcc.*
options instead of vcc.*
options.
For example:
i386.windows.vcc.options.always = "--platform:x86 /nologo /someoption"
I reverted "nim/config/nim.cfg" to commit df3d08b and tried to native compile and cross compile to i386 cpu with latest devel Nim on Windows 8.1.
vcc.options.always = "/incorrect"
set in nim.cfg
affects native compile but ignored in cross compile.
git checkout df3d08b config\nim.cfg
Both test.nim
and nim.cfg
are in same directory.
test.nim:
echo "foo"
nim.cfg:
vcc.options.always = "/incorrect"
Build log:
f:\temp>f:\project\nim-lang\Nim\bin\nim.exe c -r --cc:vcc --listcmd test.nim
Hint: used config file 'f:\project\nim-lang\Nim\config\nim.cfg' [Conf]
Hint: used config file 'C:\Users\root\AppData\Roaming\nim\nim.cfg' [Conf]
Hint: used config file 'f:\temp\nim.cfg' [Conf]
Hint: used config file 'f:\project\nim-lang\Nim\config\config.nims' [Conf]
Hint: system [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: test [Processing]
vccexe.exe /c /incorrect /If:\project\nim-lang\Nim\lib /If:\temp /Fof:\temp\nimcache\test\debug\stdlib_io.c.obj f:\temp\nimca
che\test\debug\stdlib_io.c
vccexe.exe /c /incorrect /If:\project\nim-lang\Nim\lib /If:\temp /Fof:\temp\nimcache\test\debug\stdlib_system.c.obj f:\temp\n
imcache\test\debug\stdlib_system.c
vccexe.exe /c /incorrect /If:\project\nim-lang\Nim\lib /If:\temp /Fof:\temp\nimcache\test\debug\test.c.obj f:\temp\nimcache\t
est\debug\test.c
Error: execution of an external compiler program 'vccexe.exe /c /incorrect /If:\project\nim-lang\Nim\lib /If:\temp /Fof:\temp
\nimcache\test\debug\stdlib_io.c.obj f:\temp\nimcache\test\debug\stdlib_io.c' failed with exit code: 2
Microsoft(R) C/C++ Optimizing Compiler Version 19.00.24210 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
cl : コマンド ライン warning D9002 : 不明なオプション '/incorrect' を無視します
stdlib_io.c
f:\project\nim-lang\Nim\lib\nimbase.h(493): error C2118: 添字が負の数です。..\lib\system\io.nim(119) raiseEIO
Error: unhandled exception: errno: 2 `No such file or directory` [IOError]
f:\temp>rmdir /s /q nimcache\test
f:\temp>f:\project\nim-lang\Nim\bin\nim.exe c -r --cc:vcc --cpu:i386 --listcmd test.nim
Hint: used config file 'f:\project\nim-lang\Nim\config\nim.cfg' [Conf]
Hint: used config file 'C:\Users\root\AppData\Roaming\nim\nim.cfg' [Conf]
Hint: used config file 'f:\temp\nim.cfg' [Conf]
Hint: used config file 'f:\project\nim-lang\Nim\config\config.nims' [Conf]
Hint: system [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: test [Processing]
vccexe.exe /c --platform:x86 /nologo /If:\project\nim-lang\Nim\lib /If:\temp /Fof:\temp\nimcache\test\debug\stdlib_io.c.obj f
:\temp\nimcache\test\debug\stdlib_io.c
vccexe.exe /c --platform:x86 /nologo /If:\project\nim-lang\Nim\lib /If:\temp /Fof:\temp\nimcache\test\debug\stdlib_system.c.o
bj f:\temp\nimcache\test\debug\stdlib_system.c
vccexe.exe /c --platform:x86 /nologo /If:\project\nim-lang\Nim\lib /If:\temp /Fof:\temp\nimcache\test\debug\test.c.obj f:\tem
p\nimcache\test\debug\test.c
Hint: vccexe.exe --platform:x86 /nologo /DEBUG /Zi /F33554432 /Fef:\temp\test.exe f:\temp\nimcache\test\debug\stdlib_io.c
.obj f:\temp\nimcache\test\debug\stdlib_system.c.obj f:\temp\nimcache\test\debug\test.c.obj [Exec]
Hint: operation successful (21247 lines compiled; 8.956 sec total; 19.965MiB peakmem; Debug Build) [SuccessX]
Hint: f:\temp\test.exe [Exec]
foo
set vcc options in cfg or nimscript files are now ignored, effectively they are always overriden by what is specifed in
nim/config/nim.cfg
.Example add to project.cfg a line:
it will not appear the command line arguments anymore.
Regression caused by commit df3d08b58b172dae6fe1f2ecb72db288166d211d