classification
Title: Missing symbols in Python27.lib (Windows 64bit)
Type: compile error Stage:
Components: Build Versions: Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Alexey.Pavlov, Victor.Lazzarini, loewis
Priority: normal Keywords:

Created on 2014-02-26 21:30 by Victor.Lazzarini, last changed 2014-03-17 05:46 by Alexey.Pavlov.

Messages (6)
msg212308 - (view) Author: Victor Lazzarini (Victor.Lazzarini) Date: 2014-02-26 21:30
It appears various symbols are missing from Python27.lib, 64bit build.
Here is a list of undefined symbols (from link errors):

/debug/Opcodes && /c/mingw-builds/x64-4.8.1-posix-seh-rev5/mingw64/bin/gcc.exe -Wl,--add-stdcall-alias -shared -o ../py.dll -Wl,--major-image-version,0,--minor-image-version,0 -Wl,--whole-archive CMakeFiles/py.dir/objects.a -Wl,--no-whole-archive /C/Python27/libs/python27.lib -lkernel32 -luser32 -lgdi32 -lwinspool
-lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x14a):
undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x973):
undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x99d):
undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0xa83):
undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0xc23):
undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0xc4b):
more undefined references to `__imp_PyExc_RuntimeError' follow
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x1b22):
 undefined reference to `__imp__Py_NoneStruct'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x1b7c):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x1d19):
 undefined reference to `__imp_PyFloat_Type'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x1d6d):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x205c):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x21f5):
 undefined reference to `__imp__Py_NoneStruct'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x2251):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x2388):
 undefined reference to `__imp_PyFloat_Type'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x2404):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x263c):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x291c):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x2a33):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x2b23):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x2bc0):
 undefined reference to `__imp_PyFloat_Type'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x2c44):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x2e4b):
 undefined reference to `__imp__Py_NoneStruct'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x2ece):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x312c):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x340c):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x36ac):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x38e9):
 undefined reference to `__imp__Py_NoneStruct'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x3941):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x3cfe):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x40ac):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x431c):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x45ac):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x486c):
 more undefined references to `__imp_PyExc_RuntimeError' follow
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x6c99):
 undefined reference to `__imp_PyFloat_Type'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x6cdd):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x6e03):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x7093):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x72cc):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x754c):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x77dc):
 more undefined references to `__imp_PyExc_RuntimeError' follow
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x7c3b):
 undefined reference to `__imp_PyFloat_Type'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x7c7f):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x7d7c):
 undefined reference to `__imp_PyFloat_Type'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x7df4):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x806c):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x8173):
 undefined reference to `__imp_PyFloat_Type'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x81e4):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x82b3):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x84b9):
 undefined reference to `__imp__Py_NoneStruct'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x8511):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x85e2):
 undefined reference to `__imp_PyFloat_Type'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x8664):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x891c):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x8acb):
 undefined reference to `__imp_PyFloat_Type'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x8b1f):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x8c93):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x8df3):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x8f03):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x8fe3):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x9163):
 more undefined references to `__imp_PyExc_RuntimeError' follow
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x95c6):
 undefined reference to `__imp_PyFloat_Type'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x960c):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x987c):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x9bcc):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0x9eac):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0xa14c):
 undefined reference to `__imp_PyExc_RuntimeError'
CMakeFiles/py.dir/objects.a(pythonopcodes.c.obj):pythonopcodes.c:(.text+0xa3fc):
 more undefined references to `__imp_PyExc_RuntimeError' follow

These symbols do not exist in 64bit, but are there in the 32bit library.See for instance PyFloat_Type:

victor@ligetipc ~/csound6/debug
$ nm /c/Python27/libs/Python27.lib | grep "PyFloat_Type"

victor@ligetipc ~/csound6/debug
$ nm /c/Python27-i386/libs/libpython27.a | grep "PyFloat_Type"
00000000 I __imp__PyFloat_Type
00000000 T _PyFloat_Type
msg213506 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2014-03-14 01:24
I don't know how mingw64 is supposed to work, but going by the 32-bit mingw, you might have to create a libpython27.a first.
msg213527 - (view) Author: Victor Lazzarini (Victor.Lazzarini) Date: 2014-03-14 09:58
That did the trick! Apparently we can't link to MSVC dlls
http://sourceforge.net/apps/trac/mingw-w64/wiki/Answer%2064%20bit%20MSVC-generated%20x64%20.lib

Creating a *.a fixes it.
Thanks.
msg213580 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2014-03-14 18:23
If somebody would contribute a patch for msi.py that builds the file, and instructs me what tools I need installed, I'd be willing to include this in future releases (also for 2.7).
msg213582 - (view) Author: Victor Lazzarini (Victor.Lazzarini) Date: 2014-03-14 18:30
I don't know how to patch the installer, but here are the commands for someone who does. You need gendef and dlltool, which should come with the standard mingw64 installation.
From python27.dll:

$ gendef python27.dll
$ dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib libpython27.a --input-def python27.def
msg213791 - (view) Author: Alexey Pavlov (Alexey.Pavlov) Date: 2014-03-17 05:46
For peoples who interesting in supporting building Python with mingw-w64 compiler I can get some links.

More than a year ago we start providing our own builds of Python 2.7+3.3 builded with mingw-w64 compiler.
I'm developer of MSYS2 project - modern fork of Cygwin with MSYS functionality + pacman package manager (ported from Arch Linux).

You can easily build your own Python with mingw-w64 using our patches that include patches from Roumen Petrov (rpetrov) and our own.

Python-2.7.6 patches:
https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-python2

Python-3.3.3 patches:
https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-python3

Also you can get prebuilded python and other mingw-w64 packages using MSYS2 with pacman.

Regards,
Alexey.
History
Date User Action Args
2014-03-17 05:46:09Alexey.Pavlovsetnosy: + Alexey.Pavlov
messages: + msg213791
2014-03-14 18:30:50Victor.Lazzarinisetmessages: + msg213582
2014-03-14 18:23:45loewissetmessages: + msg213580
2014-03-14 09:58:25Victor.Lazzarinisetmessages: + msg213527
2014-03-14 01:24:46loewissetnosy: + loewis
messages: + msg213506
2014-02-26 21:30:21Victor.Lazzarinicreate