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

Support Visual Studio 2010 #57419

Closed
sable mannequin opened this issue Oct 18, 2011 · 83 comments
Closed

Support Visual Studio 2010 #57419

sable mannequin opened this issue Oct 18, 2011 · 83 comments
Assignees
Labels
build The build process and cross-build OS-windows type-feature A feature request or enhancement

Comments

@sable
Copy link
Mannequin

sable mannequin commented Oct 18, 2011

BPO 13210
Nosy @loewis, @mhammond, @jackjansen, @mdickinson, @jaraco, @kristjanvalur, @tjguk, @tarekziade, @merwok, @briancurtin
Files
  • sxs.patch: Disable SxS assemblies when needed.
  • errnomodule.diff
  • pcbuild10.patch
  • wsa_undef.patch
  • code_changes.diff
  • code_changes2.diff
  • pcbuildpatch.patch
  • pcbuildpatch.patch
  • 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 = 'https://github.com/briancurtin'
    closed_at = <Date 2012-05-19.18:47:04.551>
    created_at = <Date 2011-10-18.12:55:20.824>
    labels = ['type-feature', 'OS-windows', 'build']
    title = 'Support Visual Studio 2010'
    updated_at = <Date 2012-08-20.14:56:37.049>
    user = 'https://bugs.python.org/sable'

    bugs.python.org fields:

    activity = <Date 2012-08-20.14:56:37.049>
    actor = 'prlw1'
    assignee = 'brian.curtin'
    closed = True
    closed_date = <Date 2012-05-19.18:47:04.551>
    closer = 'loewis'
    components = ['Build', 'Windows']
    creation = <Date 2011-10-18.12:55:20.824>
    creator = 'sable'
    dependencies = []
    files = ['25003', '25004', '25005', '25379', '25433', '25503', '25583', '25636']
    hgrepos = []
    issue_num = 13210
    keywords = ['patch', 'needs review']
    message_count = 83.0
    messages = ['145803', '145810', '145812', '145820', '145846', '145890', '145892', '145893', '147893', '147894', '148321', '148322', '148325', '148326', '148331', '148488', '148490', '148493', '148664', '148665', '156146', '156150', '156178', '156322', '156658', '156659', '156663', '157214', '157218', '159373', '159375', '159378', '159379', '159380', '159383', '159385', '159386', '159392', '159400', '159401', '159402', '159412', '159413', '159414', '159420', '159424', '159426', '159448', '159462', '159773', '159782', '160241', '160243', '160246', '160261', '160520', '160521', '160532', '160535', '160536', '160653', '160661', '160667', '160668', '160669', '160942', '160953', '160959', '160960', '160961', '160962', '160963', '160965', '161107', '161108', '161109', '161122', '161123', '161144', '161147', '161148', '161162', '161166']
    nosy_count = 16.0
    nosy_names = ['loewis', 'mhammond', 'jackjansen', 'mark.dickinson', 'jaraco', 'kristjan.jonsson', 'sable', 'tim.golden', 'tarek', 'eric.araujo', 'brian.curtin', 'santoso.wijaya', 'alexis', 'python-dev', 'sbt', 'prlw1']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'commit review'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue13210'
    versions = ['Python 3.3']

    @sable
    Copy link
    Mannequin Author

    sable mannequin commented Oct 18, 2011

    Python for Windows is currently compiled with Visual Studio 2008.
    It is not possible to use Visual Studio 2010.

    It would be great to be able to compile Python with Visual Studio 2010:

    • some people may only have access to this compiler which is more recent

    • when embedding Python in an application compiled with Visual Studio 2010, you mix 2 C Runtime Libraries (msvcr90.dll and msvcr100.dll) which will generally result in a crash

    This is the parent issue. I have various patches to achieve that and I will try to open one issue by patch. I may also run a builtbot using that compiler.

    @sable sable mannequin assigned tarekziade Oct 18, 2011
    @sable sable mannequin added stdlib Python modules in the Lib dir topic-installation build The build process and cross-build OS-windows type-feature A feature request or enhancement labels Oct 18, 2011
    @briancurtin
    Copy link
    Member

    We can make Python compile with Visual Studio 2010, but it will not be the platform Python is released on, it would be optional while 2008 stays the release target, at least through Python 3.3. In Python 3.4, we may re-evaluate this, and it's likely we would jump over 2010 and move to Visual Studio 2012 at that point (per discussions on python-dev).

    As for your first point, Visual Studio 2008 is still available on the Microsoft site, it's just not the first thing you usually find. If you look here - http://msdn.microsoft.com/en-us/express/future/bb421473 - you can find it.

    Anyway, I've done this port internally at my company, but I'm not able to release that patch. I am, however, willing to do it personally so it could be included here. If anyone else is interested in working on it, it should follow the same format as other VS version support, going in the PC/VS{version} folder.

    Also, reclassified this to the proper version, 3.3, since it's a feature request.

    @briancurtin briancurtin removed stdlib Python modules in the Lib dir topic-installation labels Oct 18, 2011
    @sable
    Copy link
    Mannequin Author

    sable mannequin commented Oct 18, 2011

    Here is a quick and dirty draft of the modifications I had to do in order to get Python 2.7.2 to compile with VS2010 on the wiki:

    http://wiki.python.org/moin/VS2010

    I will improve/complete it as I progress.
    I will also do a 64 bits version.

    @merwok
    Copy link
    Member

    merwok commented Oct 18, 2011

    The wiki page contains change to distutils, which I believe would not be allowed by the feature freeze. New features (such as support for a new compiler) need to target packaging.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Oct 18, 2011

    I think this issue urgently needs a scope defined. What *exactly* is it that you want to achieve? If it's merely being able to compile Python with VS 2010, many of the proposed changes are unnecessary.

    If you propose that the patch should be used to replace VS 2008 with VS 2010, I suggest that instead of developing it as a patch, you create a hg clone that you maintain on your own.

    If you propose that Python 3.3 be built and released with VS 2010, then we need to re-evaluate this question again. Wrt. VS 2012, my hope is that this will be available for 3.3 already. If that's not going to happen, I'd be open to switch to 2010 for 3.3 only (and to 2012 for 3.4).

    @sable
    Copy link
    Mannequin Author

    sable mannequin commented Oct 19, 2011

    Martin, what I want to achieve is to ensure that someone can download Python sources and compile them without any modification using a standard install of Windows + Visual Studio 2010 SP1.

    I don't really care what is the default compiler used to generate the official binaries, this is a decision that should be taken according to what most people use. But a least the compilation should work easily with the recent and popular VS2010 compiler.

    As I said the patch is for the moment a quick and dirty draft: it breaks compilation with VS2008 and assume VS2010. Of course this is not my goal: the final patch should work with existing compilers as well as VS2010.

    Which part of the changes do you consider unnecessary?

    Concerning the target version: I need to use Python 2.7 internally because our application has not been migrated to Python 3.
    I think other people may be in the same case.

    I understand there is a feature freeze on this branch (event though the changes in this case are well localized and not intrusive), so I will target primarily Python trunk for the inclusion of patches, but I will also maintain internally my own set of patches for Python 2.7 (and in the wiki for those who are interested).

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Oct 19, 2011

    Which part of the changes do you consider unnecessary?

    All the parts dealing with packaging, in particular Tools/msi.

    I understand there is a feature freeze on this branch (event though
    the changes in this case are well localized and not intrusive), so I
    will target primarily Python trunk for the inclusion of patches, but
    I will also maintain internally my own set of patches for Python 2.7
    (and in the wiki for those who are interested).

    Instead of doing so internally, I really suggest to maintain a public
    hg clone, either on hg.python.org (by your name), or on, say, bitbucket.

    @sable
    Copy link
    Mannequin Author

    sable mannequin commented Oct 19, 2011

    Packaging makes it easier to distribute Python among my colleagues and customers, so I think it is a nice addition.

    OK for the hg clone, I will set up that (I actually already use mercurial internally to handle those modifications).

    @briancurtin
    Copy link
    Member

    I mentioned this on another issue, but I created a clone at http://hg.python.org/sandbox/vs2010port/. I've already gone through the port in the past but wasn't able to release the code at the time. As I work through it, I'll occasionally announce large milestones here.

    @tjguk
    Copy link
    Member

    tjguk commented Nov 18, 2011

    Thanks. I was going to ask about this to see if anyone had already done
    the legwork.

    @sable
    Copy link
    Mannequin Author

    sable mannequin commented Nov 25, 2011

    I don't have commit access on hg.python.org, so I also created a clone on bitbucket at:
    https://bitbucket.org/sablefr/py27vs2010/overview

    I work with a patch queue for the moment since everything is not completely settled yet.

    The patch are against python 2.7 for the moment, I will do the same for python trunk soon.
    I can run all the tests with builbot and I am working on reducing the errors.

    Currently I am at:
    337 tests OK.
    5 tests failed:
    test_anydbm test_pep277 test_shelve test_subprocess test_trace
    1 test altered the execution environment:
    test_distutils
    45 tests skipped:
    test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl
    test_commands test_crypt test_curses test_dbm test_dl test_epoll
    test_fcntl test_fork1 test_gdb test_gdbm test_gl test_grp
    test_imgfile test_ioctl test_kqueue test_linuxaudiodev test_macos
    test_macostools test_mhlib test_nis test_openpty test_ossaudiodev
    test_pipes test_poll test_posix test_pty test_pwd test_readline
    test_resource test_scriptpackages test_sunaudiodev test_tcl
    test_threadsignals test_tk test_ttk_guionly test_ttk_textonly
    test_wait3 test_wait4 test_zipfile64
    6 skips unexpected on win32:
    test_gdb test_readline test_tcl test_tk test_ttk_guionly
    test_ttk_textonly

    @briancurtin
    Copy link
    Member

    Just to be sure in case you didn't know, but patches against 2.7 for this issue won't be accepted.

    @sable
    Copy link
    Mannequin Author

    sable mannequin commented Nov 25, 2011

    Yes I know, but this is my primary target as this is the version that I use in my product for the moment.

    I will test python trunk soon now that Python 2.7 with VS2010 is in a rather good shape.

    @merwok
    Copy link
    Member

    merwok commented Nov 25, 2011

    Just to avoid misunderstandings: The Subversion concept of trunk (or rather py3k trunk) maps to the Mercurial branch named default, which is what you get when you clone hg.python.org/cpython. This is 3.3.

    @briancurtin
    Copy link
    Member

    Before we both go down the same paths and duplicate effort, http://hg.python.org/sandbox/vs2010port/ has already completed the transition in terms of running the conversion, saving off the VS9 files, making some minimal code changes (errno module specifically), and has begun to fix tests. This is already done for 'default' aka 3.3.

    8 tests failed:
    test_distutils test_email test_io test_os test_packaging
    test_pep3151 test_socket test_subprocess

    The distutils and packaging test failures seem to be about differences in command line flags for some of the VS2010 binaries (looks like a link.exe issue in one). Most of the others are about remaining errno differences, and the subprocess issue is with too many files being open.

    @sable
    Copy link
    Mannequin Author

    sable mannequin commented Nov 28, 2011

    OK Brian, I checked your clone and I will keep an eye on it.

    I have done almost the same thing for the moment. My patch queue includes some additional corrections for a few more bugs that prevented me from completely running the test suite (crash dumps).

    I will start working on Python 'default' probably tomorrow.

    @briancurtin
    Copy link
    Member

    If you want to clone from that repo, use the "vs2010" branch.

    hg clone http://hg.python.org/sandbox/vs2010port/
    hg up vs2010

    From there, you can post patches here that I can integrate for you.

    @briancurtin briancurtin self-assigned this Nov 28, 2011
    @merwok
    Copy link
    Member

    merwok commented Nov 28, 2011

    A tip to make Mercurial download only a subset of all the changesets in the repo:

    hg clone URI -r branch

    or

    hg clone URI#branch

    (The difference is that in the second form, URI#branch will be recorded in the .hg/hgrc file and subsequent pulls will only pull from that branch.)

    bandwith-is-a-scarce-resource’ly yours

    @sable
    Copy link
    Mannequin Author

    sable mannequin commented Nov 30, 2011

    I have started working on python default branch.
    My patch queue is available here:
    https://bitbucket.org/sablefr/py3kvs2010/

    The result is the following so far:
    323 tests OK.
    8 tests failed:
    test_distutils test_fileio test_gettext test_io test_os
    test_packaging test_pep3151 test_support
    4 tests altered the execution environment:
    test_multiprocessing test_site test_subprocess test_sysconfig
    27 tests skipped:
    test_crypt test_curses test_dbm_gnu test_dbm_ndbm test_devpoll
    test_epoll test_fcntl test_fork1 test_gdb test_grp test_ioctl
    test_kqueue test_nis test_openpty test_ossaudiodev test_pipes
    test_poll test_posix test_pty test_pwd test_readline test_resource
    test_syslog test_threadsignals test_wait3 test_wait4
    test_zipfile64
    2 skips unexpected on win32:
    test_gdb test_readline

    Most errors seem related to errno.

    @briancurtin
    Copy link
    Member

    Again, rather than work off of the default branch and duplicate effort, can you work off of the vs2010 branch on http://hg.python.org/sandbox/vs2010port/?

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 13, 2012

    New changeset 38d7d944370e by Brian Curtin in branch 'default':
    Fix bpo-13210. Port the Windows build from VS2008 to VS2010.
    http://hg.python.org/cpython/rev/38d7d944370e

    @briancurtin
    Copy link
    Member

    What I just pushed has functioning debug and release builds for both 32 and 64 bit, and the tests introduce no new failures.

    As noted on python-dev, we may not have build slaves setup for this change yet, so the Windows builds may appear broken.

    I'll leave this open a bit until the infrastructure has caught up, and until any documentation is completed, which I may open a separate issue for.

    @kristjanvalur
    Copy link
    Mannequin

    kristjanvalur mannequin commented May 13, 2012

    All the old .vcproj files are still there. Probably not useful since the .sln file has been upgraded to VisualStudio 2010.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 13, 2012

    New changeset 924c178c0d1d by Brian Curtin in branch 'default':
    Move out VS9 project files to PC\VS9.0 folder. Fixes bpo-13210
    http://hg.python.org/cpython/rev/924c178c0d1d

    @briancurtin
    Copy link
    Member

    Thanks for noticing. I moved them out to PC\VS9.0 rather than outright deleting.

    @kristjanvalur
    Copy link
    Mannequin

    kristjanvalur mannequin commented May 14, 2012

    Here is a patch to the .vcproj files and the .props files, based on my earlier pcbuil10.patch.
    Mostly it is about removing redundant settings. It also adds .props files for the pythoncore solution.

    It also updates the readme, the env.bat, and adds the vs9to10.py file.
    While the latter may be out of date by now, perhaps at least some vs10to9 file needs to be in place to support the older compiler?

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented May 14, 2012

    LGTM. Brian?

    @briancurtin
    Copy link
    Member

    +1 on the patch. It fixes a bunch of things that I entered unnecessarily (like explicit .pyd names to fix the warnings), but after staring at the screen for a long time I couldn't figure out what I was doing wrong to need them for some reason.

    I'm not really interested in supporting VS9 or writing a script for it, but if someone who wanted to use it came up with a script I don't see why we couldn't include it.

    @briancurtin
    Copy link
    Member

    Hm, actually, doing a 64-bit debug build fails with that patch. ctypes, _testbuffer, and xxlimited, the projects I originally had trouble with in the settings, don't link properly.

    @briancurtin
    Copy link
    Member

    Correction, both 64-bit debug and release fail.

    @jaraco
    Copy link
    Member

    jaraco commented May 16, 2012

    Kristjan,
    I'm trying to apply your most recent patch, but many of the hunks fail. I tried to find it by time, but failed to do so. Perhaps you know what revision that patch was against? Thanks.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented May 17, 2012

    Perhaps you know what revision that patch was against?

    I wish people would stop using git-style diffs, then the patch would actually say. However, it applied cleanly to tip at the time it was submitted, so you should be able to go by that.

    @kristjanvalur
    Copy link
    Mannequin

    kristjanvalur mannequin commented May 17, 2012

    Hi, I'll see what went wrong, I admit not trying 64 bit before creating the patch.
    Martin, I´m using MercurialHQ and exporting a patch. It is set up to use GIT format diffs, which I think is recommended in the Python developer FAQ. Is this wrong? (I'm still a relative Hg newbie)

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented May 17, 2012

    Is this wrong? (I'm still a relative Hg newbie)

    It's an ongoing discussion. Some people favor git diffs because
    it supports renaming and binaries, I prefer Mercurial diffs, because
    it includes the base revision number against the patch was made.

    @kristjanvalur
    Copy link
    Mannequin

    kristjanvalur mannequin commented May 17, 2012

    That sounds reasonable. So, can't we come up with a diff that does both? The base revision sounds like a completely necessary piece of info.

    @kristjanvalur
    Copy link
    Mannequin

    kristjanvalur mannequin commented May 17, 2012

    I wish MS could come up with a property editor that could show you _only_ the properties that are non-default:

    1. view all properties
    2. view set and inherited non-defaults
    3. view properties set here only.

    It would make debugging settings _so_ much easier. I'll suggest that to the VS team, all the good that will do.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented May 17, 2012

    That sounds reasonable. So, can't we come up with a diff that does
    both? The base revision sounds like a completely necessary piece of
    info.

    I believe there is a bug report against Mercurial to include the base
    revision even in git-style diffs, not sure what the status is. git itself
    includes the base revision in its diffs; I believe that Mercurial didn't
    dare to use the same syntax since the Mercurial hash wouldn't be a valid
    git hash.

    @kristjanvalur
    Copy link
    Mannequin

    kristjanvalur mannequin commented May 17, 2012

    This is fun.
    the reason why linking is failing for some projects in x64 mode is:
    the SolutionDir (or maybe current dir) is implicitly part of the library search path. Therefore, when looking for python33_d.lib, it will find the one in PCbuild, and look into that, and ignore the one in PCbuidl\amd64.

    Some projects have "references" to the pythoncore project. This is a .NET feature and not really useful for normal projects, but it does put an explicit link referrence to the correct .lib file into the linker's input arguments. This is why _testcapi works, and not _testbuffer (try diffing the two .vcxproj files).

    All of this stems from my patch removing explicit link references to the correct .lib file. Perhaps I can reintroduce that, but in a .props file.

    @kristjanvalur
    Copy link
    Mannequin

    kristjanvalur mannequin commented May 19, 2012

    Ok, I find no way to override the linker so that it does not search the current directory first.
    I think it is best, and probably in the spirit of visual studio, to use the "reference" part of a project to facilitate linking between dependency projects. it is designed to take the hassle out of libraries and search paths. I will add references where they are missing.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented May 19, 2012

    I think it is best, and probably in the spirit of visual studio, to
    use the "reference" part of a project to facilitate linking between
    dependency projects. it is designed to take the hassle out of
    libraries and search paths. I will add references where they are
    missing.

    Sounds good to me.

    @kristjanvalur
    Copy link
    Mannequin

    kristjanvalur mannequin commented May 19, 2012

    Here is an updated patch, with proper project references added and some slight cleanup of .props files.

    @jaraco
    Copy link
    Member

    jaraco commented May 19, 2012

    After enabling the eol extension and re-checking out my working copy, I've applied the patch successfully, but after I do so, I get this error when trying to open the solution in VS2010:

    "One or more projects in the solution were not loaded correctly"

    and

    C:\Users\jaraco\projects\public\cpython\cpython\PCbuild\pythoncore.vcxproj : error : The imported project "C:\Users\jaraco\projects\public\cpython\cpython\PCbuild\pythoncore_d.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. C:\Users\jaraco\projects\public\cpython\cpython\PCbuild\pythoncore.vcxproj

    @kristjanvalur
    Copy link
    Mannequin

    kristjanvalur mannequin commented May 19, 2012

    Ah, good, it looks as though a file is missing from the patch. I'll fix it.

    @sbt
    Copy link
    Mannequin

    sbt mannequin commented May 19, 2012

    PCbuild/build.bat and Modules/_decimal/tests/runall.bat still use vcbuild instead of msbuild.

    It also seems that if an external dependency is unavailable then msbuild can fail to build targets which do not depend on it. For instance if I rename openssl-1.0.1c to something else, then this causes msbuild to fail without building ctypes.

    I don't think vcbuild had this problem.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented May 19, 2012

    I propose that we declare this issue closed, and defer any new issues arising from the switch to VS 2010 in separate issues.

    There will surely be many issues over the next weeks and months, and there is little point in tracking this all on this single page.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented May 19, 2012

    So closing this issue. Kristjan, if you want your patch reviewed further and/or approved by Brian, please copy it into a new issue.

    @loewis loewis mannequin closed this as completed May 19, 2012
    @jaraco
    Copy link
    Member

    jaraco commented May 19, 2012

    I agree. There is already an issue regarding the packaging dependencies. It currently references ctypes, but we can rename it to be more broad.

    bpo-14821

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented May 19, 2012

    No broad issues, please. One tracker item, one issue. If something other than _ctypes_test fails to build, it may or may not have the same reason, so caution requires that we assume they are unrelated defects.

    @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
    build The build process and cross-build OS-windows type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants