gsohler / openscad

OpenSCAD - The Programmers Solid 3D CAD Modeller
https://www.openscad.org
Other
14 stars 6 forks source link

QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled #24

Open fzellini opened 2 months ago

fzellini commented 2 months ago

Hi, and thank you for your excellent work. I have a problem with pythonscad: On ubuntu22, I have downloaded openscad-2024.01.16.x86-64.tar.gz from https://pythonscad.org/download.php, extracted and installed, but attempting to open a .scad file, there are multiple messages like "QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled" and a segmentation fault

openscad QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled QOpenGLWidget: Failed to create context QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled QOpenGLWidget: Failed to create context QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled qt.qpa.backingstore: composeAndFlush: QOpenGLContext creation failed QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled qt.qpa.backingstore: composeAndFlush: makeCurrent() failed QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled qt.qpa.backingstore: composeAndFlush: makeCurrent() failed QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled qt.qpa.backingstore: composeAndFlush: makeCurrent() failed QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled qt.qpa.backingstore: composeAndFlush: makeCurrent() failed QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled qt.qpa.backingstore: composeAndFlush: makeCurrent() failed QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled QOpenGLWidget: Failed to create context QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled qt.qpa.backingstore: composeAndFlush: makeCurrent() failed Segmentation fault (core dumped)

gsohler commented 2 months ago

Hi, Thank you for your interest in pythonscad.

I believe that qcb integration is related to using GL inside Qt.

your error shown appears to be a common issue, the internet is full of it. you might look into this solution:

https://forums.autodesk.com/t5/installation-licensing/ubuntu-22-04-quot-cannot-create-platform-opengl-context-quot/td-p/11729065

This solution ultimately suggests to delete all libxcb stuff in the installation or rather replace all libxcb stuff with the files from the system instead.

Another option is to compile pythonscad from scratch, which is not difficult either.

As I did not change anything with the GL initialization in my fork, my guess is that the original software has the same issue in your system

deb https://download.opensuse.org/repositories/home:/t-paul/xUbuntu_22.04/ ./

Right now i have created a recent release package for linux, but i doubt it will make a difference.

Let me know if using the system libxcb files gives an improvement.

fzellini commented 2 months ago

OK finally i have compiled all the stuffs in a docker container. It seems to work well, the only issue is that "uni-get-dependencies.sh" does not install required dependencies nettle-dev and libjpeg-dev, so I added in the enclosed Dockerfile. you can build with

docker build . -t pythonscad

and run with

docker run --init  --rm -it -v /tmp/.X11-unix:/tmp/.X11-unix --entrypoint /bin/bash  -e DISPLAY=$DISPLAY   -v ~/scad:/openscad  pythonscad

When inside docker, simply type "openscad --trust-python" to run the program or, without bash:

docker run --init  --rm -it -v /tmp/.X11-unix:/tmp/.X11-unix --entrypoint openscad  -e DISPLAY=$DISPLAY   -v ~/scad:/openscad  pythonscad

cat Dockerfile

FROM ubuntu:22.04

RUN apt update \
    && apt install -y --no-install-recommends \
    tar gzip git \
    x11-apps mesa-utils \
    apt-transport-https ca-certificates \
    nettle-dev libjpeg-dev

WORKDIR /work
RUN git clone https://github.com/gsohler/openscad.git
WORKDIR /work/openscad
RUN git checkout python
RUN git submodule update --init --recursive
RUN ./scripts/uni-get-dependencies.sh
RUN mkdir build
WORKDIR /work/openscad/build
RUN cmake -DEXPERIMENTAL=1 -DENABLE_PYTHON=1 -DENABLE_LIBFIVE=1 ..
RUN make -j 8
RUN make install
RUN ldconfig
# optional
# RUN rm -rf /work
WORKDIR /openscad

Again, thank you for your excellent work.

Fabrizio

gsohler commented 2 months ago

Hi Fabrizio,

Thank you for your fast reply.

I don't know so much about docker, but I understand, that you compile and run pythonscad in Docker , instead of Ubuntu now. Even though the used commands look very exciting and promising , right now i don't want to afford Docker due to my current disk space situation, But ultimately I understand that pythonscad is running for you and maybe you are exercising some of the shown examples.

Main discussion for pytonscad is at https://www.reddit.com/r/pythonscad/

So if you see issues, this is a great place to ask. If you succeed and want to share your story, feel free to share.

Thank you for pointing out the issue with nettle-dev and libjpeg-dev. Did not notice these anymore, because these dependencies are installed in my place for a long time.

On Mon, Apr 29, 2024 at 12:58 PM fzellini @.***> wrote:

OK finally i have compiled all the stuffs in a docker container. It seems to work well, the only issue is that "uni-get-dependencies.sh" does not install required dependencies nettle-dev and libjpeg-dev, so I added in the enclosed Dockerfile. you can build with

docker build . -t pythonscad

and run with

docker run --init --rm -it -v /tmp/.X11-unix:/tmp/.X11-unix --entrypoint /bin/bash -e DISPLAY=$DISPLAY -v ~/scad:/openscad pythonscad

When inside docker, simply type "openscad --trust-python" to run the program or, without bash:

docker run --init --rm -it -v /tmp/.X11-unix:/tmp/.X11-unix --entrypoint openscad -e DISPLAY=$DISPLAY -v ~/scad:/openscad pythonscad

cat Dockerfile

FROM ubuntu:22.04

RUN apt update \ && apt install -y --no-install-recommends \ tar gzip git \ x11-apps mesa-utils \ apt-transport-https ca-certificates \ nettle-dev libjpeg-dev

WORKDIR /work RUN git clone https://github.com/gsohler/openscad.git WORKDIR /work/openscad RUN git checkout python RUN git submodule update --init --recursive RUN ./scripts/uni-get-dependencies.sh RUN mkdir build WORKDIR /work/openscad/build RUN cmake -DEXPERIMENTAL=1 -DENABLE_PYTHON=1 -DENABLE_LIBFIVE=1 .. RUN make -j 8 RUN make install RUN ldconfig

optional

RUN rm -rf /work

WORKDIR /openscad

Again, thank you for your excellent work.

Fabrizio

— Reply to this email directly, view it on GitHub https://github.com/gsohler/openscad/issues/24#issuecomment-2082422777, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCO4MV6Y5USWTC4HNXKWVDY7YRTVAVCNFSM6AAAAABG5DELXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBSGQZDENZXG4 . You are receiving this because you commented.Message ID: @.***>