【发布时间】: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