KDE 目的构建仅在 docker 容器中失败
KDE Purpose build fails only in docker container
我们目前在最新的 KDE / Archlinux 版本中遇到一个奇怪的问题。
我们无法让 KDE 的 Purpose 框架在 docker 容器中编译,尽管它在我们的主机上运行良好。我们尝试用 GCC 和 Clang 编译它。
我们收到的错误是:
CMakeFiles/saveasplugin.dir/saveasplugin.cpp.o: In function `SaveAsShare::SaveAsShare()':
saveasplugin.cpp:(.text+0x81): undefined reference to `vtable for SaveAsShare'
CMakeFiles/saveasplugin.dir/saveasplugin.cpp.o: In function `SaveAsShare::~SaveAsShare()':
saveasplugin.cpp:(.text+0x113): undefined reference to `vtable for SaveAsShare'
CMakeFiles/saveasplugin.dir/saveasplugin.cpp.o: In function `SaveAsShare::~SaveAsShare()':
saveasplugin.cpp:(.text+0x133): undefined reference to `vtable for SaveAsShare'
collect2: error: ld returned 1 exit status
make[2]: *** [src/plugins/saveas/CMakeFiles/saveasplugin.dir/build.make:122: bin/kf5/purpose/saveasplugin.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:1149: src/plugins/saveas/CMakeFiles/saveasplugin.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
您可以使用以下 Dockerfile 重现 docker 环境:
FROM archlinux/base
RUN pacman -Syu --noconfirm && pacman --noconfirm -S git base-devel cmake extra-cmake-modules asp sudo
RUN useradd -ms /bin/bash arch
RUN echo 'arch ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers
USER arch
WORKDIR /home/arch
RUN asp checkout purpose
WORKDIR /home/arch/purpose/trunk
RUN gpg --keyserver ipv4.pool.sks-keyservers.net --recv-keys 58D0EE648A48B3BB
(如果您只有 IPv6 可用而没有 IPv4,则需要编辑第 9 行)
构建容器后 运行 并执行 makepkg -s --noconfirm
现在将构建 archlinux 包,您将在链接阶段遇到上述错误。
我们目前甚至不知道这个错误的原因是什么,因为它在我们的主机上构建时没有任何问题。有什么想法吗?
我们还测试了不同的基础 archlinux docker 图像,例如 pritunl/archlinux。
环境:
目的:5.43.0-1
海湾合作委员会:7.3.0
CLang: 5.0.1-2
这是 statx syscall used by the MOC to generate the appropriate cpp files. In the default confined configuration, docker uses seccomp to prevent or allow certain syscalls, which does not allow the statx syscall. See this 允许的系统调用的错误。
此错误已在 archlinux bugtracker, qt bugtracker and docker bugtracker 上报告,但没有(永久)解决方案。
解决方案一:
运行 根据 this 建议,您的 docker 容器 docker run --security-opt seccomp:unconfined
。
方案二:
打补丁或降级以从 qt 中删除 statx 系统调用。
我们目前在最新的 KDE / Archlinux 版本中遇到一个奇怪的问题。 我们无法让 KDE 的 Purpose 框架在 docker 容器中编译,尽管它在我们的主机上运行良好。我们尝试用 GCC 和 Clang 编译它。
我们收到的错误是:
CMakeFiles/saveasplugin.dir/saveasplugin.cpp.o: In function `SaveAsShare::SaveAsShare()':
saveasplugin.cpp:(.text+0x81): undefined reference to `vtable for SaveAsShare'
CMakeFiles/saveasplugin.dir/saveasplugin.cpp.o: In function `SaveAsShare::~SaveAsShare()':
saveasplugin.cpp:(.text+0x113): undefined reference to `vtable for SaveAsShare'
CMakeFiles/saveasplugin.dir/saveasplugin.cpp.o: In function `SaveAsShare::~SaveAsShare()':
saveasplugin.cpp:(.text+0x133): undefined reference to `vtable for SaveAsShare'
collect2: error: ld returned 1 exit status
make[2]: *** [src/plugins/saveas/CMakeFiles/saveasplugin.dir/build.make:122: bin/kf5/purpose/saveasplugin.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:1149: src/plugins/saveas/CMakeFiles/saveasplugin.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
您可以使用以下 Dockerfile 重现 docker 环境:
FROM archlinux/base
RUN pacman -Syu --noconfirm && pacman --noconfirm -S git base-devel cmake extra-cmake-modules asp sudo
RUN useradd -ms /bin/bash arch
RUN echo 'arch ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers
USER arch
WORKDIR /home/arch
RUN asp checkout purpose
WORKDIR /home/arch/purpose/trunk
RUN gpg --keyserver ipv4.pool.sks-keyservers.net --recv-keys 58D0EE648A48B3BB
(如果您只有 IPv6 可用而没有 IPv4,则需要编辑第 9 行)
构建容器后 运行 并执行 makepkg -s --noconfirm
现在将构建 archlinux 包,您将在链接阶段遇到上述错误。
我们目前甚至不知道这个错误的原因是什么,因为它在我们的主机上构建时没有任何问题。有什么想法吗?
我们还测试了不同的基础 archlinux docker 图像,例如 pritunl/archlinux。
环境:
目的:5.43.0-1
海湾合作委员会:7.3.0
CLang: 5.0.1-2
这是 statx syscall used by the MOC to generate the appropriate cpp files. In the default confined configuration, docker uses seccomp to prevent or allow certain syscalls, which does not allow the statx syscall. See this 允许的系统调用的错误。
此错误已在 archlinux bugtracker, qt bugtracker and docker bugtracker 上报告,但没有(永久)解决方案。
解决方案一:
运行 根据 this 建议,您的 docker 容器 docker run --security-opt seccomp:unconfined
。
方案二:
打补丁或降级以从 qt 中删除 statx 系统调用。