【问题标题】:Compiler lacks asm-goto support on Fedora 28编译器在 Fedora 28 上缺乏 asm-goto 支持
【发布时间】:2018-07-21 12:56:55
【问题描述】:

我找不到 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 4.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,还是我遗漏了什么?我对 Makefile 不熟悉了……

【问题讨论】:

标签: gcc makefile compiler-errors


【解决方案1】:

我遇到了同样的问题。 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-05
    • 2016-04-02
    • 2011-06-03
    • 2016-08-13
    • 2021-08-27
    相关资源
    最近更新 更多