-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Segmentation fault on WSL2 X11 Backend at pygame.display.set_mode when running as user #3260
Comments
Hello and thanks for the bug report! Anyways, a gdb backtrace would be really helpful here, but it's not convenient to get (you might have to compile pygame yourself with I wonder whether the issue reproduces for you if you try the latest Ubuntu on WSL (if it does, could be something hardware or driver/WSL2 kernel related) |
This is what I got after running python in gdb:
The session is like
|
Sorry, just got it fixed by sudo apt-get install libsdl2-dev |
Holy hell man, THANK YOU! I was about to give up learning Pygame while in WSL. You saved me from going through the hassle of building a dedicated VM. |
Hmmm, I was tempted to close this issue, but actually there is some pygame packaging bug here. Basically, the pygame binary wheel releases we do should be self-contained and not depend on users installing any extra packages. The backtrace posted is definitely going to be useful, I will try to debug this further myself in the coming days |
HI there. As a n00bie, I have no idea what you just said, but it sounds really great. Did you write Pygame? I am FINALLY getting into it now. I'm not sure where to start, but I'm currently looking for a tutorial. Thanks for chiming in! |
Hello!
Here on github issues we discuss the internals of pygame as we get bugs reports to fix them. As a user you don't have to bother with a lot of the C-level jargon ;)
Only small parts of it, yes. I'm one of the hundreds of people who have contributed code to it 😄
Oh, there are many kinds of tutorials out there, and you have many options depending on which way of learning you are most comfortable in. If you are comfortable with video based learning, there are tons of good resources on youtube. There are also many pygame books and reading materials if you think vids are not for you. Be sure to check out some pygame examples (you can find some of those on this github repo too) while you are learning and get some hands on experience :) However if you are new to pygame, I would suggest using windows natively instead of using WSL Coming back to the topic of this issue and I did some more digging So well, this issue is basically an SDL issue (libsdl-org/SDL#5889) fixed in SDL 2.24.x. SDL is supposed to pick all x11 extensions available at runtime, and make-do if things are missing (and in this case, SDL did not cleanly handle the case of xinput not being there at runtime). pygame users have to make sure all relevant x11 extensions are available while using x11 to get the most out of pygame (and these are not bundled into the wheels unlike other dependencies) |
You are a genius. It totally blows my mind that anyone can do what you just talked about in that last paragraph. it is honestly inconceivable to me that anyone could figure that out. I'm been trying to learn Python for over a year, but I am still stumped on 8kyu Katas on Codewars. Haha. Just insane how complex this world is. You are definitely an asset to this community. Thanks so much for the explanation. |
Thank you for the kind words and appreciation. But it's definitely nothing as crazy as you are probably thinking RN. And there's always more to learn for me as well ;) |
I encountered the same error while working on a wsl2 with a conda environment. After installing the libstdcxx-ng package with |
Environment:
Windows 11 WSL2 kernel 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 GNU/Linux
pip3 installed as non root in user context.
Current behavior:
segmentation fault while running the below:
whereas running as root works.
Expected behavior:
function to return w/o error.
The text was updated successfully, but these errors were encountered: