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

标签 gcc makefile compiler-errors

我找不到 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

我发现从gcc 开始就支持asm-goto 4.5,我安装了 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,还是我遗漏了什么?我对 Makefile 不熟悉了……

最佳答案

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

灵感来自这个旧补丁 https://lkml.org/lkml/2018/3/19/1474 ,我从shell-cachedshellMakefile在基本目录中以避免缓存并且它可以工作:

-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

关于gcc - 编译器在 Fedora 28 上缺乏 asm-goto 支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51456318/

相关文章:

c++ - 错误: no match for operator ==

c - 如何在 Linux 上为 gcc 制作一个简单的 makefile

c++ - gcc编译器无法安装R软件包lpSolve

c++ - 在 vector 中使用 std::filesystem::path 时双重释放

makefile - 如何阻止 GNU Make 解释字符串?

c++ - 我在链接 SDL 库时遇到问题

c++ - 使用非类型模板参数专门化模板模板参数

c - 如何有效地修补外部库并将其编译到 C 项目的 Makefile 中?

java - "No Activity found"错误

vb.net - 编译错误: expected end of statement