Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-33351: (WIP) Patches to build on clang-cl#7680

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
emmatyping wants to merge3 commits intopython:masterfromemmatyping:clang-cl

Conversation

@emmatyping
Copy link
Member

@emmatypingemmatyping commentedJun 13, 2018
edited
Loading

I've been a bit busy so I haven't had time to prepare this, but I wanted to post something people can try, so here's something.

So far I have made changes to:

  • forward declare struct timeval in pytime (it should have been anyway)
  • move some struct packing in the correct place
  • Using a more portable stringize macro
  • defining compiler names

This builds and passes tests with MSVC, and clang-cl on x64.

If you would like to test this:

  • Grab a Windows snapshot build of clang trunk from here:http://llvm.org/builds/ or build clang from source (not recommended, this is quite time, processor, and memory intensive).
    then
  • Change project files to build with the LLVM-2014 toolset (I haven't figured out a good way to do this automatically yet).

Everything builds except:

  • _decimal (clang-cl doesn't like linking mpd it seems)
  • _distutils_findvs (unsurprisingly)
  • pyshellext (it doesn't like the idl file)

The good news is that clang generates MSVC ABI compatible binaries, so linking clang/msvc binaries together is fine.

The following tests fail under clang-cl:

test_compile test_compileall test_ctypes test_exceptions
test_fileio test_io test_json test_os test_pickle test_pickletools
test_richcmp test_runpy test_script_helper test_sys test_traceback
test_userdict test_userlist test_xml_etree

It seems many of them are failing with a stack overflow, so it seems clang is miscompiling something.

There is however a subset that can compile under clang while still passing the tests.

https://bugs.python.org/issue33351

This was mostly:- forward declare struct timeval in pytime (it should have been anyway)- moving struct packing in the correct place- Using a more portable, standard garunteed stringize macro- defining compiler names
@ahartikainen
Copy link

Should this PR also addclang-cl compiler option for distutils?
clang-cl could basically use a copy of theMSVCCompiler class in_msvccompiler.py

It would only need to change line 245:self.cc = _find_exe("cl.exe", paths) toself.cc = _find_exe("clang-cl.exe", paths). Also some of the compiler arguments are unnecessary.

Also line 960compiler_class inccompiler.py needs updating.

@emmatyping
Copy link
MemberAuthor

Should this PR also add clang-cl compiler option for distutils?

@ahartikainen I think that is likely the next todo I have. I'll get back to this soon hopefully.

ahartikainen reacted with thumbs up emoji

@zooba
Copy link
Member

@ethanhs Are you still interested in pushing this forward? If so, can you merge against master and run CI again.

@emmatyping
Copy link
MemberAuthor

@zooba, yes! I have been working on other things recently, but it would be helpful to know what a mergable PR should look like. Since clang-cl can fallback to cl, there may be a few modules I will need to use that for, as mentioned in the PR comment there seems to be an issue with how it compiles things (however I should test this with a newer clang to be sure).

@zooba
Copy link
Member

Of the three modules that didn't build, distutils_findvs has been removed and pyshellext is probably optional (it's part of the py.exe launcher, not Python itself). So that will get you closer.

You should be able to pass/p:PlatformToolset="whatever" on the command line (or set it as an environment variable) to override the toolset when building outside of VS. The "right" way to do in within VS is to add a new configuration, but that's far more intrusive (going to have to touch every project file and test it extensively).

@zufuliu
Copy link

Add clang-cl to distutils is just a few lines of change, I added a patch athttps://github.com/zufuliu/llvm-utils/blob/master/clang/clang-cl-py3.diff, which works fine for 3.7.3.

ahartikainen reacted with thumbs up emoji

@csabella
Copy link
Contributor

This has been replaced byGH-18371.

emmatyping reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@emmatyping@ahartikainen@zooba@zufuliu@csabella@the-knights-who-say-ni@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp