编译器在Fedora 28上缺少asm-goto支持 [英] Compiler lacks asm-goto support on Fedora 28

查看:716
本文介绍了编译器在Fedora 28上缺少asm-goto支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I couldn't find an rpm for v4l2loopback so I tried to compile it on a fresh Fedora 28, but it failed :

$ 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.

I found that asm-goto has been supported since gcc 4.5, and I have 8.1.1 installed :

$ 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中注释以下检查来设法编译模块:

I managed to compile the module by simply commenting the following check in /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,但这没有帮助.

but obviously this is a dirty workaround. Yet, the Makefile CFLAGS actually had -DCC_HAVE_ASM_GOTO set. I also tried to set CC_HAV_ASM_GOTO in the Makefile but it didn't help.

这是怎么了?是Makefile还是Fedora,还是我错过了什么?我不熟悉Makefile ...

What's wrong here ? Is it the Makefile, or Fedora, or am I missing something ? I lost familiarity with Makefiles…

推荐答案

我遇到了同样的问题. Makefile的缓存已陈旧/脏了. 就我而言,这似乎是因为我即时终止了make.

I got the same problem. The caches of Makefile were staled/dirty. In my case, it seems because I terminated make on the fly.

灵感来自此旧补丁 https://lkml.org/lkml/2018/3/19/1474 ,为了避免缓存,我将MakefileMakefile更改为基本目录中Makefileshell,并且有效:

Inspired from this old patch https://lkml.org/lkml/2018/3/19/1474, I changed from the shell-cached to shell in Makefile in base dir to avoid caching and it works:

-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)

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

Then clean to make sure we don't have bad cache:

make clean
make -j9

这篇关于编译器在Fedora 28上缺少asm-goto支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆