最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Centos7.2系统下安装VirtualBox缺少compiler-gcc6.h
时间:2022-06-30 20:46:26 编辑:袖梨 来源:一聚教程网
1、之前为了在Centos7.2安装网易云音乐,而编译安装了GCC6.2.0,后来发现之前安装的VirtualBox却不能用了,按照提示在终端执行sudo /sbin/vboxconfig,错误提示:
vboxdrv.sh: Building VirtualBox kernel modules.
vboxdrv.sh: failed: Look at /var/log/vbox-install.log to find out what went wrong.
There were problems setting up VirtualBox. To re-start the set-up process, run
/sbin/vboxconfig
as root.
2、查看/var/log/vbox-install.log ,提示重大错误:缺少include/linux/compiler-gcc6.h。后来度娘了之后发现可能是kernel和GCC6的更新造成的(http://blog.chinaunix.net/uid-20680966-id-5322921.html),查看系统内核目录include/linux下发现确实没有compiler-gcc6.h。然后在这里找到了compiler-gcc6.h的代码:http://lkml.iu.edu/hypermail/linux/kernel/1504.1/04805.html
内容如下:
——————————————————————————————————————
#ifndef __LINUX_COMPILER_H
#error "Please don't include
#endif
#define __used __attribute__((__used__))
#define __must_check __attribute__((warn_unused_result))
#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
/* Mark functions as cold. gcc will assume any path leading to a call
to them will be unlikely. This means a lot of manual unlikely()s
are unnecessary now for any paths leading to the usual suspects
like BUG(), printk(), panic() etc. [but let's keep them for now for
older compilers]
gcc also has a __attribute__((__hot__)) to move hot functions into
a special section, but I don't see any sense in this right now in
the kernel context */
#define __cold __attribute__((__cold__))
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
#ifndef __CHECKER__
# define __compiletime_warning(message) __attribute__((warning(message)))
# define __compiletime_error(message) __attribute__((error(message)))
#endif /* __CHECKER__ */
/*
* Mark a position in code as unreachable. This can be used to
* suppress control flow warnings after asm blocks that transfer
* control elsewhere.
*/
#define unreachable() __builtin_unreachable()
/* Mark a function definition as prohibited from being cloned. */
#define __noclone __attribute__((__noclone__))
/*
* Tell the optimizer that something else uses this function or variable.
*/
#define __visible __attribute__((externally_visible))
/*
* GCC 'asm goto' miscompiles certain code sequences:
*
* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
*
* Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
*
* (asm goto is automatically volatile - the naming reflects this.)
*/
#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
#define __HAVE_BUILTIN_BSWAP32__
#define __HAVE_BUILTIN_BSWAP64__
#define __HAVE_BUILTIN_BSWAP16__
#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
#define KASAN_ABI_VERSION 4
————————————————————————————————
其实这个内容和compiler-gcc5.h几乎一样,你也可以将compiler-gcc5.h内容稍作修改后复制为compiler-gcc6.h。新建compiler-gcc6.h,然后复制到kernel的include/linux目录下,和compiler-gcc5.h在相同的目录。注意每更新一次kernel,就会多一个目录如:/usr/src/kernels/3.10.0-327.36.1.el7.x86_64/include/linux
3、添加了compiler-gcc6.h后,再执行命令 sudo /sbin/vboxconfig 就不会有错误提示了。
相关文章
- 无期迷途主线前瞻直播总结 无期迷途主线前瞻直播内容介绍 11-22
- 以下哪种非遗技艺是用针在纸上绣画 蚂蚁新村11月21日答案 11-22
- 江南百景图听风塔怎么样 11-22
- 原神恰斯卡圣遗物怎么搭配 11-22
- 2024年霸王茶姬11月22日口令是什么 2024.11.22霸王茶姬口令介绍 11-22
- 光遇11.21季节蜡烛在哪里 光遇11月21日季节蜡烛位置攻略 11-22