472,993 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,993 software developers and data experts.

Building Python with VC8 on x64 Vista

Hi all,

So I'm working on a C++ application that will eventually embed or
extend Python using Boost.Python, but I first need to get Python
compiled correctly for my platform. I've got a Windows Vista 64-bit
machine with a Core 2 processor, and I'm compiling with a VC8.

I downloaded the Python 2.5.1 source from python.org, and I opened the
Visual Studio solution file that was in the PCbuild8 directory. I
created a new x64 platform and managed to successfully compile the
'pythoncore' and 'python' projects (both in Debug and Release
configurations), resulting in working executables. (Aside: When
launched, the python console says "Python 2.5.1 [MSC v.1400 64 bit
(AMD64)] on win32" up top. Does that seem right?)

So, this program I'm writing with Boost.Python (that worked correctly
on x86 with home-built libraries) won't compile with these x64
libraries. I keep getting 'unresolved external symbols.' But, I'm
certain I'm linking in the library correctly. Here's a snippet from
the output (with /verbose:lib) when compiling:

1>Searching libraries
1 <snip>
1 Searching ..\..\..\3rdParty\boost_1_34_0\lib_x64\libboost_py thon-
vc80-mt-gy-1_34.lib:
1 <snip>
1 Searching ..\..\..\3rdParty\Python25\libs_x64\python25_d.lib :
1>Finished searching libraries
1>py_dyn_test.obj : error LNK2001: unresolved external symbol
_Py_NoneStruct
1>vector_py.obj : error LNK2001: unresolved external symbol
_Py_NoneStruct
1>volume_py.obj : error LNK2001: unresolved external symbol
_Py_NoneStruct
1>py_dyn_test.obj : error LNK2001: unresolved external symbol
_Py_RefTotal
1>vector_py.obj : error LNK2001: unresolved external symbol
_Py_RefTotal
1>volume_py.obj : error LNK2001: unresolved external symbol
_Py_RefTotal
1>volume_py.obj : error LNK2001: unresolved external symbol
PyExc_IndexError

If I switch to the Release configuration, I see fewer errors:

1>py_dyn_test.obj : error LNK2001: unresolved external symbol
_Py_NoneStruct
1>volume_py.obj : error LNK2001: unresolved external symbol
PyExc_IndexError

Note that none of my own code is Debug-specific. Also, the code in my
files is correct, because (as stated above), it worked fine for x86.

Though I don't know how useful it is, I did open the python libraries
in wordpad, and though most of the file wasn't legible, I did find
strings "Py_NoneStruct," "Py_RefTotal," and "PyExc_IndexError."
I suspect that I set up my "x64" platform configuration incorrectly,
or missed something. It's basically the same as the Win32
configuration, except with the /MACHINE:X64 flag instead of /
MACHINE:X86. One of the things I'm noticing just now, as I post this,
is that the preprocessor flag "WIN32" is still defined in the x64
configuration. Maybe if I change that to "WIN64," I'll have better
luck.

Any advice you have on what the "correct" way to do this is would be
appreciated.

-Dan

Sep 20 '07 #1
5 2621
On Sep 20, 9:45 am, danf...@gmail.com wrote:
Hi all,

So I'm working on a C++ application that will eventually embed or
extend Python using Boost.Python, but I first need to get Python
compiled correctly for my platform. I've got a Windows Vista 64-bit
machine with a Core 2 processor, and I'm compiling with a VC8.

I downloaded the Python 2.5.1 source from python.org, and I opened the
Visual Studio solution file that was in the PCbuild8 directory. I
created a new x64 platform and managed to successfully compile the
'pythoncore' and 'python' projects (both in Debug and Release
configurations), resulting in working executables. (Aside: When
launched, the python console says "Python 2.5.1 [MSC v.1400 64 bit
(AMD64)] on win32" up top. Does that seem right?)

So, this program I'm writing with Boost.Python (that worked correctly
on x86 with home-built libraries) won't compile with these x64
libraries. I keep getting 'unresolved external symbols.' But, I'm
certain I'm linking in the library correctly. Here's a snippet from
the output (with /verbose:lib) when compiling:

1>Searching libraries
1 <snip>
1 Searching ..\..\..\3rdParty\boost_1_34_0\lib_x64\libboost_py thon-
vc80-mt-gy-1_34.lib:
1 <snip>
1 Searching ..\..\..\3rdParty\Python25\libs_x64\python25_d.lib :
1>Finished searching libraries
1>py_dyn_test.obj : error LNK2001: unresolved external symbol
_Py_NoneStruct
1>vector_py.obj : error LNK2001: unresolved external symbol
_Py_NoneStruct
1>volume_py.obj : error LNK2001: unresolved external symbol
_Py_NoneStruct
1>py_dyn_test.obj : error LNK2001: unresolved external symbol
_Py_RefTotal
1>vector_py.obj : error LNK2001: unresolved external symbol
_Py_RefTotal
1>volume_py.obj : error LNK2001: unresolved external symbol
_Py_RefTotal
1>volume_py.obj : error LNK2001: unresolved external symbol
PyExc_IndexError

If I switch to the Release configuration, I see fewer errors:

1>py_dyn_test.obj : error LNK2001: unresolved external symbol
_Py_NoneStruct
1>volume_py.obj : error LNK2001: unresolved external symbol
PyExc_IndexError

Note that none of my own code is Debug-specific. Also, the code in my
files is correct, because (as stated above), it worked fine for x86.

Though I don't know how useful it is, I did open the python libraries
in wordpad, and though most of the file wasn't legible, I did find
strings "Py_NoneStruct," "Py_RefTotal," and "PyExc_IndexError."

I suspect that I set up my "x64" platform configuration incorrectly,
or missed something. It's basically the same as the Win32
configuration, except with the /MACHINE:X64 flag instead of /
MACHINE:X86. One of the things I'm noticing just now, as I post this,
is that the preprocessor flag "WIN32" is still defined in the x64
configuration. Maybe if I change that to "WIN64," I'll have better
luck.

Any advice you have on what the "correct" way to do this is would be
appreciated.

-Dan
I've tried re-building my libraries from the latest revision (58225),
using the solution in the PCbuild8 folder. I had no problems getting
the python25[_d].lib to compile, but I still get these symbol errors
when I try to link with the library.

-Dan

Sep 21 '07 #2
In message <11**********************@57g2000hsv.googlegroups. com>,
da*****@gmail.com wrote:
Though I don't know how useful it is, I did open the python libraries
in wordpad, and though most of the file wasn't legible, I did find
strings "Py_NoneStruct," "Py_RefTotal," and "PyExc_IndexError."
Do you have some equivalent of the "nm" command for dumping the symbols and
their definitions in the library?
Sep 22 '07 #3
1>py_dyn_test.obj : error LNK2001: unresolved external symbol
_Py_NoneStruct
Could it be that py_dyn_test.obj is a x86 (not AMD64) object
file? Run dumpbin.

Regards,
Martin
Sep 22 '07 #4
On Sep 22, 10:08 am, "Martin v. Löwis" <mar...@v.loewis.dewrote:
1>py_dyn_test.obj : error LNK2001: unresolved external symbol
_Py_NoneStruct

Could it be that py_dyn_test.obj is a x86 (not AMD64) object
file? Run dumpbin.
Hmm - I've never used dumpbin, but I think I like it.

It doesn't look like these are x86, though. See below:

D:\....\py_dyn_test\x64\Debug>dumpbin /HEADERS py_dyn_test.obj
Microsoft (R) COFF/PE Dumper Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file py_dyn_test.obj

File Type: COFF OBJECT

FILE HEADER VALUES
8664 machine (x64)
....
D:\....\3rdParty\Python25\libs>dumpbin /HEADERS python25_d.lib
Microsoft (R) COFF/PE Dumper Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file python25_d.lib

File Type: LIBRARY

FILE HEADER VALUES
8664 machine (x64)
3 number of sections
46F3CED2 time date stamp Fri Sep 21 09:01:54 2007
113 file pointer to symbol table
8 number of symbols
0 size of optional header
0 characteristics

<snip>

Version : 0
Machine : 8664 (x64)
TimeDateStamp: 46F3CED2 Fri Sep 21 09:01:54 2007
SizeOfData : 0000001E
DLL name : python25_d.dll
Symbol name : _Py_NoneStruct
Type : data
Name type : name
Hint : 900
Name : _Py_NoneStruct

<etc>

Sep 24 '07 #5
It doesn't look like these are x86, though.

Ok. Can you then check symbol lists also?: undefined
symbols in the object file, and defined symbols in the
library, wrt. PyExc_IndexError (say).

Regards,
Martin
Sep 24 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Padraig | last post by:
Hi all, Just a quick question... when I try to install Python on Windows Vista Beta 2 the installer seems to hang after I select the destination folder, saying that it will "return when it has...
3
by: slogging_away | last post by:
I know, I know - flame away but its not clear to me if Python will run on a system running Microsoft Vista. Is anyone successfully running Python on Vista? If so, is it what version of Python are...
1
by: Steve Mavronis | last post by:
I tried to install Python 2.51 on Microsoft Vista Ultimate 32-bit because I use the 3D modeler software Blender 2.44, in case I needed additional Python support in the future for add-on scripts. ...
12
by: Bob Cramer | last post by:
I'm a developer using XP Pro for developing business apps with Visual Studio.NET and SQL Server. My current workstation is a few years old and uses a single IDE drive. I'm looking to build a new...
6
by: globalrev | last post by:
type "python setup.py install" that is used in most "addons" for python. well using windows vista, where the h*** am i supposed to type this? if it is not doable in windows, what do i have...
3
by: Bev in TX | last post by:
I am a complete newbie at building Python. I am trying to build it under MS Windows Vista (64-bit AMD) with MS VS2005. I'm doing that because I need debug libraries, which I did not see in the...
1
by: Barry Warsaw | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On behalf of the Python development team and the Python community, I am happy to announce the first release candidate for Python 2.6. This is a...
29
by: process | last post by:
i just downloaded 2.6 and when running the gui nothing happens. anyone else with the same problem?
7
by: Fuzzyman | last post by:
Hello guys, Not sure if this is a Windows question or a Python problem... I'm trying to install Python 2.6 from the msi, on Windows Vista as an administrative user with UAC on. If I try to...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.