Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] test_distutils: fatal error LNK1158: cannot run 'rc.exe' #76148

Closed
vstinner opened this issue Nov 7, 2017 · 7 comments
Closed

[Windows] test_distutils: fatal error LNK1158: cannot run 'rc.exe' #76148

vstinner opened this issue Nov 7, 2017 · 7 comments
Labels
3.7 (EOL) end of life OS-windows tests Tests in the Lib/test dir

Comments

@vstinner
Copy link
Member

vstinner commented Nov 7, 2017

BPO 31967
Nosy @pfmoore, @db3l, @vstinner, @tjguk, @zware, @zooba

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2017-12-15.15:13:28.699>
created_at = <Date 2017-11-07.09:53:23.645>
labels = ['3.7', 'tests', 'OS-windows']
title = "[Windows] test_distutils: fatal error LNK1158: cannot run 'rc.exe'"
updated_at = <Date 2017-12-15.15:13:28.698>
user = 'https://github.com/vstinner'

bugs.python.org fields:

activity = <Date 2017-12-15.15:13:28.698>
actor = 'vstinner'
assignee = 'none'
closed = True
closed_date = <Date 2017-12-15.15:13:28.699>
closer = 'vstinner'
components = ['Tests', 'Windows']
creation = <Date 2017-11-07.09:53:23.645>
creator = 'vstinner'
dependencies = []
files = []
hgrepos = []
issue_num = 31967
keywords = []
message_count = 7.0
messages = ['305728', '305729', '305730', '305731', '305735', '305739', '308402']
nosy_count = 6.0
nosy_names = ['paul.moore', 'db3l', 'vstinner', 'tim.golden', 'zach.ware', 'steve.dower']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue31967'
versions = ['Python 3.7']

@vstinner
Copy link
Member Author

vstinner commented Nov 7, 2017

test_distutils failed on AMD64 Windows10 3.x buildbot:

http://buildbot.python.org/all/#/builders/3/builds/128

0:19:07 [165/407/1] test_distutils failed -- running: test_multiprocessing_spawn (377 sec)
xxmodule.c
xxmodule.obj : warning LNK4197: export 'PyInit_xx' specified multiple times; using first specification
Creating library d:\temp\tmp4zg7rpix\Debug\temp\tmp4zg7rpix\xx_d.cp37-win_amd64.lib and object d:\temp\tmp4zg7rpix\Debug\temp\tmp4zg7rpix\xx_d.cp37-win_amd64.exp
LINK : /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance
LINK : fatal error LNK1158: cannot run 'rc.exe'
foo.c
Creating library d:\temp\tmpy79shh6o\tempt\temp\tmpl63x182t\foo_d.cp37-win_amd64.lib and object d:\temp\tmpy79shh6o\tempt\temp\tmpl63x182t\foo_d.cp37-win_amd64.exp
LINK : /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance
LINK : fatal error LNK1158: cannot run 'rc.exe'
xxmodule.c
xxmodule.obj : warning LNK4197: export 'PyInit_xx' specified multiple times; using first specification
Creating library d:\temp\tmpkb4gpfw9\Debug\temp\tmpkb4gpfw9\xx_d.cp37-win_amd64.lib and object d:\temp\tmpkb4gpfw9\Debug\temp\tmpkb4gpfw9\xx_d.cp37-win_amd64.exp
LINK : /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance
LINK : fatal error LNK1158: cannot run 'rc.exe'
foo.c
Creating library d:\temp\tmppmjpg5zh\tempt\temp\tmpi1x5uxdd\foo_d.cp37-win_amd64.lib and object d:\temp\tmppmjpg5zh\tempt\temp\tmpi1x5uxdd\foo_d.cp37-win_amd64.exp
LINK : /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance
LINK : fatal error LNK1158: cannot run 'rc.exe'
xxmodule.c
xxmodule.obj : warning LNK4197: export 'PyInit_xx' specified multiple times; using first specification
Creating library build\temp.win-amd64-3.7-pydebug\Debug\xx_d.cp37-win_amd64.lib and object build\temp.win-amd64-3.7-pydebug\Debug\xx_d.cp37-win_amd64.exp
LINK : /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance
LINK : fatal error LNK1158: cannot run 'rc.exe'

D:\buildarea\3.x.bolen-windows10\build\build\test_python_2228>exit 1

D:\buildarea\3.x.bolen-windows10\build\build\test_python_2228>exit 0

(...)

======================================================================
ERROR: test_build_ext (distutils.tests.test_build_ext.BuildExtTestCase)
----------------------------------------------------------------------

Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\lib\distutils\_msvccompiler.py", line 519, in link
    self.spawn([self.linker] + ld_args)
  File "D:\buildarea\3.x.bolen-windows10\build\lib\distutils\_msvccompiler.py", line 542, in spawn
    return super().spawn(cmd)
  File "D:\buildarea\3.x.bolen-windows10\build\lib\distutils\ccompiler.py", line 909, in spawn
    spawn(cmd, dry_run=self.dry_run)
  File "D:\buildarea\3.x.bolen-windows10\build\lib\distutils\spawn.py", line 38, in spawn
    _spawn_nt(cmd, search_path, dry_run=dry_run)
  File "D:\buildarea\3.x.bolen-windows10\build\lib\distutils\spawn.py", line 81, in _spawn_nt
    "command %r failed with exit status %d" % (cmd, rc))
distutils.errors.DistutilsExecError: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1158

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\buildarea\3.x.bolen-windows10\build\lib\distutils\tests\test_build_ext.py", line 82, in test_build_ext
    cmd.run()
  File "D:\buildarea\3.x.bolen-windows10\build\lib\distutils\command\build_ext.py", line 339, in run
    self.build_extensions()
  File "D:\buildarea\3.x.bolen-windows10\build\lib\distutils\command\build_ext.py", line 448, in build_extensions
    self._build_extensions_serial()
  File "D:\buildarea\3.x.bolen-windows10\build\lib\distutils\command\build_ext.py", line 473, in _build_extensions_serial
    self.build_extension(ext)
  File "D:\buildarea\3.x.bolen-windows10\build\lib\distutils\command\build_ext.py", line 558, in build_extension
    target_lang=language)
  File "D:\buildarea\3.x.bolen-windows10\build\lib\distutils\ccompiler.py", line 717, in link_shared_object
    extra_preargs, extra_postargs, build_temp, target_lang)
  File "D:\buildarea\3.x.bolen-windows10\build\lib\distutils\_msvccompiler.py", line 522, in link
    raise LinkError(msg)
distutils.errors.LinkError: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1158

@vstinner vstinner added 3.7 (EOL) end of life tests Tests in the Lib/test dir OS-windows labels Nov 7, 2017
@vstinner
Copy link
Member Author

vstinner commented Nov 7, 2017

Similar error on AMD64 Windows8 3.x:

http://buildbot.python.org/all/#/builders/32/builds/127

@vstinner
Copy link
Member Author

vstinner commented Nov 7, 2017

I don't think that it's related, but a recent change in PCbuild is: bpo-31957.

IMHO it's more something that changed on the two buildbots.

@vstinner
Copy link
Member Author

vstinner commented Nov 7, 2017

Hi David Bolen: Would you mind to look at this bug, please? thank you in advance ;-)

@db3l
Copy link
Contributor

db3l commented Nov 7, 2017

This seems to correlate with my upgrading to the latest Win10 SDK on those workers (Steve pointed out I was still getting ucrt warnings during compilation). So they both jumped from like 10240 up to 16299. But that's all I changed.

Interestingly I only had to fix 8.1 and 10, as 7 already had a version (15063) avoiding the warning, and it's tedious to change. But it's not experiencing the linking problem.

I could swear I recall past link/rc problems, but my searching (and memory) are failing me at the moment. But I wonder if that's why I had left these two workers back at 10240, or if I had some local fix in place.

@db3l
Copy link
Contributor

db3l commented Nov 7, 2017

Ok, so rc.exe appears truly not to be found when the test runs. The binary is a bit buried in the Windows Kit directory tree, and I'm guessing something is off after the upgrade (I'm not sure where it was in the tree before). I manually placed a copy in a directory I know is on the path and that seems to have resolved it.

I also found a similar copy of rc.exe from the SDK to a local directory on my Windows 7 worker, so I suspect that was what I was remembering, and I probably hit the same thing when updating the SDK on that worker previously.

Not sure if there's some better way it should work, but at least this resolves the issue from the SDK update - builds are currently in progress, but both workers passed test_distutils.

@vstinner
Copy link
Member Author

The AMD64 Windows10 3.x buildbot: is green again, I close the issue.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.7 (EOL) end of life OS-windows tests Tests in the Lib/test dir
Projects
None yet
Development

No branches or pull requests

2 participants