我有一个用 Go 编写的简单程序,它使用 GLFW 打开一个空白窗口。我想自动运行测试,因此我一直试图让 GLFW 在 docker 中运行。到目前为止,我已经设法让 xvfb 运行。
我的问题是GLX extension not found
调用时出错glfwInit
。此外,运行glxinfo
会产生此错误couldn't find RGB GLX visual or fbconfig
。从我在网上可以找到的,这是因为 GLFW 找不到 GPU(因为没有)。
是否还有我需要安装的库或者我可以配置一些不同的东西(例如在无头模式下运行 GLFW)来防止这个错误?
这是我的 Dockerfile 的缩短版本(删除了 Go 特定的东西):
FROM alpine:latest
RUN apk --no-cache add ca-certificates wget
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.28-r0/glibc-2.28-r0.apk
RUN apk add glibc-2.28-r0.apk
RUN apk update
RUN apk add gcc
RUN apk add mesa-dev
RUN apk add libx11-dev
RUN apk add libc-dev
RUN apk add libx11-dev
RUN apk add libxcursor-dev
RUN apk add libxi-dev
RUN apk add libxinerama-dev
RUN apk add libxrandr-dev
RUN apk add xorg-server
RUN apk add xvfb
RUN apk add coreutils
RUN apk add mesa
RUN apk add mesa-gl
RUN apk add mesa-demos
RUN apk add xvfb-run --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/main/ --allow-untrusted
RUN apk add mesa-osmesa
#if you are unfamiliar with docker, this is the command that gets run when starting the container.
ENTRYPOINT xvfb-run -e /dev/stderr --server-args=':99 -screen 0 640x480x8 +extension GLX +render -noreset -ac' glxinfo | cat
输出:
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning: Unsupported high keycode 372 for name <I372> ignored
> X11 cannot support keycodes above 255.
> This warning only shows for the first high keycode.
Errors from xkbcomp are not fatal to the X server
name of display: :99
Error: couldn't find RGB GLX visual or fbconfig
我认为 XKEYBOARD 警告并不重要,可能会被忽略。