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: trunk version does not compile with vs8 and vc6
Type: Stage:
Components: Windows Versions: Python 2.6
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: amaury.forgeotdarc Nosy List: amaury.forgeotdarc, christian.heimes, loewis, ocean-city
Priority: high Keywords: patch

Created on 2008-02-11 10:50 by amaury.forgeotdarc, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue2065.patch amaury.forgeotdarc, 2008-02-11 13:28 correct compilation on vc6 + vs8
ocean.zip ocean-city, 2008-03-27 05:30 use winsock2 in trunk/py3k
ocean.zip ocean-city, 2008-04-05 08:01 "MODULE_NAME=\"sqlite3\""
ocean.zip ocean-city, 2008-06-10 19:41
ocean-remaining.zip ocean-city, 2008-06-13 13:21
ocean-remaining.zip ocean-city, 2008-08-06 18:41 Added _multiprocessing support
Messages (22)
msg62276 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-02-11 10:50
Since r60696, WINVER is forced to _WIN32_WINNT_WIN2K. This has two problems:
- Vs8 (and before) does not define _WIN32_WINNT_WIN2K. It should be
replaced with 0x500.
- When WINVER is set to 0x500, vc6 gives a long warning because at the
time, windows nt 5.0 was only at beta stage. Moreover, there are other
clashes between winsock.h and winsock2.h, that show up when WINVER is 0x500.

To correct this, I propose:
- To replace _WIN32_WINNT_WIN2K and similar constants by their values.
- That 0x500 is not the required value, but the *maximum* value
necessary when targeting win2k. VC6 can set it to 0x400.

I'll try a patch later tonight.
msg62287 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-02-11 13:28
Attached a patch to compile trunk with vc6 and vs8.
Most tests pass with these two compilers.

Tests needed for vs7 and vs9!
msg62328 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-02-12 19:27
Ithink this patch still conflicts with issue 1763 - SHGetFolderPathW is
(apparently) only available on W2k. So I don't see why we *shouldn't*
mandate W2k-or-better platform headers. VC6 users should install the W2k
SDK, or the W2k3 SDK (or any later SDK that still supports VC6).
msg62336 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-02-12 22:00
Is it permitted to allow python compile with older compilers, even with
some functions missing?

This patch already skips some functions not included with VC6:
socket.ioctl, msvcrt.getwch &co.
Even socket.RCVALL_IPLEVEL is not available on my installation of VS8
(Professional Edition).

Even if the result is only a subset of the official python (as shown
when running the test suite), it may still be useful, when embedded in
legacy applications for example, where installing a new SDK is not
always possible.
msg62341 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-02-12 22:46
> Is it permitted to allow python compile with older compilers, even with
> some functions missing?

It's certainly ok that Python may not have some functions on "some
system". Even though there might not be any precedence, I think this
extends to "some compilers on the same system".
msg62344 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-02-12 22:55
Amaury Forgeot d'Arc wrote:
> Is it permitted to allow python compile with older compilers, even with
> some functions missing?

When a user compiles her own Python binary she is most probably
experienced enough to notice the difference. We can't hold the hand of
every user who strolls off the official path. New features was one of
reasons for the migration to VS 2008. Legacy support shouldn't stop us
from introducing new features.

So yes, it's permitted to build Python with old compilers but users must
not expect full support of all features.

Christian
msg62350 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-02-13 06:51
I tried PSDK Feb 2003 downloadable from
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm
and this two issues went away.

>- When WINVER is set to 0x500, vc6 gives a long warning because at the
>time, windows nt 5.0 was only at beta stage. Moreover, there are other
>clashes between winsock.h and winsock2.h, that show up when WINVER is
>0x500.

Next, I tried to compile Modules/socketmodule.h's _MSC_VER >= 1300 part
but this didn't work.

#if _MSC_VER >= 1300
# include <winsock2.h>
# include <ws2tcpip.h>
# include <MSTcpIP.h> /* for SIO_RCVALL */
# define HAVE_ADDRINFO
# define HAVE_SOCKADDR_STORAGE
# define HAVE_GETADDRINFO
# define HAVE_GETNAMEINFO
# define ENABLE_IPV6
#else
# include <winsock.h>
#endif

I didn't investigate too much, but it seems
#include <windows.h>
#include <winsock2.h>
causes another conflicts between winsock.h and winsock2.h
this time.
msg62353 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-02-13 10:24
> Next, I tried to compile Modules/socketmodule.h's _MSC_VER >= 1300 
> part but this didn't work.

Which compiler are you using? And which errors did you get?
msg62357 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-02-13 14:09
>Which compiler are you using? And which errors did you get?

VC6 + PSDK2003Feb. The error was same to
http://svn.haxx.se/users/archive-2006-10/0557.shtml

E:\Microsoft\PSDK\Include\ws2tcpip.h(593) : error C2632: 'int'
followed by 'int' is illegal 

>causes another conflicts between winsock.h and winsock2.h
>this time.

This was not true. This error happened because pyconfig.h defines
socklen_t to int on VC6. I could fix this and build python with VC6 +
winsock2. Probably this is way to go. (Attached patch as ocean.zip)

regrtest.py passed other than test_float (this is because VC6 doesn't
support NaN comparation, I don't care)

# I'm still missing my 500MB disk space occupied by PSDK2003Feb though ;-)
msg62517 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-02-18 05:17
Follow up r60882.
msg63219 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-03-03 17:44
Failed to compile py3k again, created patch for
three branches. You can close issue1720 and issue1700463
because they are duplicated issues.

# I merged Amaury's patch, I hope this patch also
# works for VS8.
msg64967 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-04-05 08:01
I don't know why, but
/D "MODULE_NAME=\"sqlite3\""
is troublesome. VC6 IDE expands this to
#define MODULE_NAME " sqlite3".

To workaround this, I used
/D MODULE_NAME=\"sqlite3\"
instead in sqlite3.dsp.
msg65016 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-04-06 02:40
_wstat64 does not exist in VC6, so used GetFileAttributesW instead.
msg67982 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-06-11 14:39
First, thank you for keeping these patches up to date.

- The patch for 2.5 is OK for me. We could just add the a paragraph that
appears in your patch for trunk (PC/VC6/readme.txt):
+_msi
+    _msi.c. You need to install Windows Installer SDK to build this module.

- I worked on your patch for trunk/ and py3k/ to allow compilation with
a stock VC6 *without* a modern PlatformSDK installed (i.e NTDDI_VERSION
is not defined)
This is relevant only for socketmodule; with a stock VC6, IPV6 is not
available, WSAIoctl is not exposed, and getaddrinfo() is emulated.

- Replacing _wstat with GetFileAttributesW is good thing: stat("nul")
says that the file exists!
But it is not enough: try to "import con" or "import nul", before and
after your patch. Fun in both cases (if you "import con", type some
chars, and press ^Z)

- The patches also work for VS8.0 (I just had to update the list of .c)

I will try to come with updated files, and test them with VS2003 Express
(VS7.1).
msg68112 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-06-13 00:40
Thank you for progress!

>- The patch for 2.5 is OK for me. We could just add the a paragraph that
>appears in your patch for trunk (PC/VC6/readme.txt):
>+_msi
>+    _msi.c. You need to install Windows Installer SDK to build this
>module.

I agree.

>- I worked on your patch for trunk/ and py3k/ to allow compilation with
>a stock VC6 *without* a modern PlatformSDK installed (i.e NTDDI_VERSION
>is not defined)
>This is relevant only for socketmodule; with a stock VC6, IPV6 is not
>available, WSAIoctl is not exposed, and getaddrinfo() is emulated.

I'm not sure which is better way now. (with or without modern PSDK)
From cleaness of code, I think with modern PSDK is better.
http://archives.devshed.com/forums/development-94/error-building-python-bindings-with-ms-visual-c-6-0t-2074150.html
show subversion already seems to require modern PSDK to build it, if 
python uses modern PSDK and winsock2, workaround for socklen_t is not
needed anymore. clean. (this workaround itself is quite easy though)
Of cause, Amaury wants to go without modern PSDK, there is no strong
reason I will disturb it.

>- Replacing _wstat with GetFileAttributesW is good thing: stat("nul")
>says that the file exists!
>But it is not enough: try to "import con" or "import nul", before and
>after your patch. Fun in both cases (if you "import con", type some
>chars, and press ^Z)

Interesting. Current release25-maint branch has same issue, but
python2.5.2 doesn't have this issue. "import con" fails with following
message. Something changed from latest release?

>>> import con
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: 指定されたモジュールが見つかりません。

# It says "specified module cannot be found" in Japanese. Maybe is this
win32 error message via FormatMessage()?
msg68113 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-06-13 00:52
I just committed r64214, that can compile with vc6.
When compiled with a separate SDK, socket.ioctl is available.
With the stock vc6, the function is disabled
msg68116 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-06-13 01:19
Committed r64215 on py3k branch.
Now both trunk and py3k compile with VC6, VS8 and VS9.
I cannot run VS7.1; I will do 2.5 shortly.

I also filed issue3099 about the funny "import nul".
msg68155 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-06-13 13:21
Thank you for commit. I ziped patch for remaining issue.
# Probably need to add _multiprocessing module, but not done yet.
msg68158 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-06-13 13:39
> Probably need to add _multiprocessing module, but not done yet.

Yes, and I also forgot to "svn add" the new .vcproj in VS8.0 :-(
msg71103 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-08-14 01:50
I have committed remaining VC6 patch. (I postponed _multiprocessing
module support addition because I sometimes experiences nasty error
message "pipe was closed" or "resource is not enough" in
test_multiprocessing. I cannot reproduce it by simply running only
test_multiprocessing, it occurs in regrtest. :-(
msg71113 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-08-14 07:47
Can I close this entry?
msg71114 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-08-14 08:32
Sure. Feel free to commit any further changes to these build files directly.
History
Date User Action Args
2022-04-11 14:56:30adminsetgithub: 46341
2008-08-14 08:32:08loewissetstatus: open -> closed
messages: + msg71114
2008-08-14 07:47:28ocean-citysetmessages: + msg71113
2008-08-14 01:50:45ocean-citysetmessages: + msg71103
2008-08-06 18:41:37ocean-citysetfiles: + ocean-remaining.zip
2008-06-13 13:39:15amaury.forgeotdarcsetmessages: + msg68158
2008-06-13 13:21:09ocean-citysetfiles: + ocean-remaining.zip
messages: + msg68155
2008-06-13 01:19:23amaury.forgeotdarcsetmessages: + msg68116
2008-06-13 00:52:30amaury.forgeotdarcsetmessages: + msg68113
2008-06-13 00:40:55ocean-citysetmessages: + msg68112
2008-06-12 23:17:55amaury.forgeotdarcsetassignee: amaury.forgeotdarc
2008-06-11 14:39:36amaury.forgeotdarcsetmessages: + msg67982
2008-06-10 19:41:40ocean-citysetfiles: + ocean.zip
2008-06-10 19:40:54ocean-citysetfiles: - ocean.zip
2008-06-06 22:12:41ocean-citysetfiles: + ocean.zip
2008-06-06 22:11:52ocean-citysetfiles: - ocean.zip
2008-05-30 00:40:04ocean-citysetfiles: + ocean.zip
2008-05-30 00:39:44ocean-citysetfiles: - ocean.zip
2008-05-30 00:39:00ocean-citysetfiles: + ocean.zip
2008-05-30 00:38:37ocean-citysetfiles: - ocean.zip
2008-05-30 00:38:27ocean-citysetfiles: - ocean.zip
2008-04-06 02:40:21ocean-citysetfiles: + ocean.zip
messages: + msg65016
2008-04-05 08:01:44ocean-citysetfiles: + ocean.zip
messages: + msg64967
2008-03-29 03:05:06ocean-citysetfiles: + ocean.zip
2008-03-27 05:30:37ocean-citysetfiles: + ocean.zip
2008-03-27 05:29:18ocean-citysetfiles: - ocean.zip
2008-03-27 05:27:42ocean-citysetfiles: - ocean.patch
2008-03-27 05:27:32ocean-citysetfiles: - ocean.patch
2008-03-27 05:27:15ocean-citysetfiles: - ocean.zip
2008-03-03 17:44:27ocean-citysetfiles: + ocean.zip
messages: + msg63219
2008-03-01 10:23:43ocean-citysetfiles: + ocean.patch
keywords: + patch
2008-02-18 05:18:21ocean-citysetfiles: + ocean.patch
2008-02-18 05:17:06ocean-citysetmessages: + msg62517
2008-02-13 14:09:17ocean-citysetfiles: + ocean.zip
messages: + msg62357
2008-02-13 10:24:20amaury.forgeotdarcsetmessages: + msg62353
2008-02-13 06:51:11ocean-citysetmessages: + msg62350
2008-02-13 06:04:57ocean-citysetnosy: + ocean-city
2008-02-12 22:55:36christian.heimessetmessages: + msg62344
2008-02-12 22:46:43loewissetmessages: + msg62341
2008-02-12 22:00:50amaury.forgeotdarcsetmessages: + msg62336
2008-02-12 19:27:31loewissetnosy: + loewis
messages: + msg62328
2008-02-11 13:28:06amaury.forgeotdarcsetfiles: + issue2065.patch
messages: + msg62287
2008-02-11 10:56:31christian.heimessetpriority: high
nosy: + christian.heimes
resolution: accepted
2008-02-11 10:50:13amaury.forgeotdarccreate