This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Compilation warnings on Windows: export 'PyInit_xx' specified multiple times
Type: Stage: resolved
Components: Build, Windows Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: jkloth, paul.moore, skrah, steve.dower, tim.golden, vstinner, zach.ware
Priority: normal Keywords:

Created on 2016-09-21 07:21 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (5)
msg277102 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-09-21 07:21
I like when a compilation has no warning, because it helps to notice useful warnings and real bugs. The compilation of Python 3.5 on Windows emits the following warnings on buildbots:

xxmodule.obj : warning LNK4197: export 'PyInit_xx' specified multiple times; using first specification
xxmodule.obj : warning LNK4197: export 'PyInit_xx' specified multiple times; using first specification
xxmodule.obj : warning LNK4197: export 'PyInit_xx' specified multiple times; using first specification

http://buildbot.python.org/all/builders/AMD64%20Windows8%203.5/builds/1120/steps/test/logs/warnings%20%283%29

http://buildbot.python.org/all/builders/AMD64%20Windows8%203.x/builds/2634/steps/test/logs/warnings%20%283%29
msg277103 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-09-21 07:24
It seems like the warnings come from test_distutils:
-----------------
0:05:09 [ 44/405] test_distutils failed (env changed) (38 sec)
xxmodule.c
xxmodule.obj : warning LNK4197: export 'PyInit_xx' specified multiple times; using first specification
   Creating library D:\Temp\tmp_crvgs9y\Debug\Temp\tmp_crvgs9y\xx_d.cp37-win_amd64.lib and object D:\Temp\tmp_crvgs9y\Debug\Temp\tmp_crvgs9y\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
foo.c
   Creating library D:\Temp\tmpnq__9cbm\tempt\Temp\tmpfv6uys06\foo_d.cp37-win_amd64.lib and object D:\Temp\tmpnq__9cbm\tempt\Temp\tmpfv6uys06\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
foo.c
   Creating library D:\Temp\tmpnq__9cbm\tempt\Temp\tmpfv6uys06\foo_d.cp37-win_amd64.lib and object D:\Temp\tmpnq__9cbm\tempt\Temp\tmpfv6uys06\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
xxmodule.c
xxmodule.obj : warning LNK4197: export 'PyInit_xx' specified multiple times; using first specification
   Creating library D:\Temp\tmp8n1b1bh8\Debug\Temp\tmp8n1b1bh8\xx_d.cp37-win_amd64.lib and object D:\Temp\tmp8n1b1bh8\Debug\Temp\tmp8n1b1bh8\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
foo.c
   Creating library D:\Temp\tmpk47tprte\tempt\Temp\tmpe3sksr_y\foo_d.cp37-win_amd64.lib and object D:\Temp\tmpk47tprte\tempt\Temp\tmpe3sksr_y\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
foo.c
   Creating library D:\Temp\tmpk47tprte\tempt\Temp\tmpe3sksr_y\foo_d.cp37-win_amd64.lib and object D:\Temp\tmpk47tprte\tempt\Temp\tmpe3sksr_y\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
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

D:\buildarea\3.x.bolen-windows8\build\build\test_python_3476>exit 1 

D:\buildarea\3.x.bolen-windows8\build\build\test_python_3476>exit 0
-----------------

By the way, test_distutils failed because of "env changed" but the changed environment is not logged :-( See my related issue #27829 for the missing warning.
msg277116 - (view) Author: Jeremy Kloth (jkloth) * Date: 2016-09-21 09:23
This is a known bug when compiling 64-bit extension modules.

http://bugs.python.org/issue9709
http://bugs.python.org/issue16779
http://bugs.python.org/issue20166
msg297096 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-06-28 01:02
> This is a known bug when compiling 64-bit extension modules.

Oh ok. I will just close my issue in that case :-)
msg304755 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2017-10-22 15:26
I know I closed #20166 myself, but could we revisit this?

I'm now in favor of telling people to fix their modules.
History
Date User Action Args
2022-04-11 14:58:37adminsetgithub: 72411
2018-09-19 23:19:56vstinnersetstatus: open -> closed
2017-10-22 15:26:19skrahsetstatus: closed -> open
nosy: + skrah
messages: + msg304755

2017-06-28 01:02:06vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg297096

stage: resolved
2016-09-21 09:23:57jklothsetnosy: + jkloth
messages: + msg277116
2016-09-21 07:24:09vstinnersetmessages: + msg277103
2016-09-21 07:21:09vstinnercreate