编译器在Fedora 28上缺少asm-goto支持



我找不到v4l2loopback的rpm,所以我试图在新的Fedora 28上编译它,但失败了:

$ LANG=en_US.utf8 make
Building v4l2-loopback driver...
make -C /lib/modules/`uname -r`/build M=/opt/v4l2loopback modules
make[1]: Entering directory '/usr/src/kernels/4.17.6-200.fc28.x86_64'
arch/x86/Makefile:184: *** Compiler lacks asm-goto support..  Stop.
make[1]: Leaving directory '/usr/src/kernels/4.17.6-200.fc28.x86_64'
make: *** [Makefile:43: v4l2loopback.ko] Error 2

我发现从gcc4.5开始就支持asm-goto,并且我已经安装了8.1.1:

$ LANG=en_US.utf8 gcc -v
Using built-in specs.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable- languages=c,c++,fortran,objc,obj-c++,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.1.1 20180712 (Red Hat 8.1.1-5) (GCC) 

我通过简单地在/usr/src/kernels/4.17.6-200.fc28.x86_64/arch/x86/Makefile:中注释以下检查来编译该模块:

# ifndef CC_HAVE_ASM_GOTO
#  $(error Compiler lacks asm-goto support.)
# endif

但显然,这是一个肮脏的变通办法。然而,Makefile CFLAGS实际上有-DCC_HAVE_ASM_GOTO集。我还尝试在Makefile中设置CC_HAV_ASM_GOTO,但没有帮助。

这里怎么了?是Makefile,还是Fedora,还是我遗漏了什么?我对Makefiles失去了熟悉…

我遇到了同样的问题。Makefile的缓存已过时/脏。就我而言,这似乎是因为我在飞行中终止了make

灵感源自此旧补丁https://lkml.org/lkml/2018/3/19/1474,我在基本目录中的Makefile中将shell-cached更改为shell以避免缓存,它起作用:

-ifeq ($(call shell-cached,$(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
+ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)

然后清理以确保我们没有坏的缓存:

make clean
make -j9

最新更新