Page 1 of 1

[Solved] Tools and Drivers do not compile on SL7

Posted: 9. Mar 2018, 01:05
by GZU
Hi,
With updated kernel in SL7 (and I assume CentOS7 and RHEL7) 3.10.0-693.21.1.el7.x86_64 drivers (and tools on linux guest) no longer compile.
Looks like it is due to REPTOLINE kernel changes.

make V=1 CONFIG_MODULE_SIG= -C /lib/modules/3.10.0-693.21.1.el7.x86_64/build SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j12 modules
arch/x86/Makefile:166: *** CONFIG_RETPOLINE=y, but not supported by the compiler. Toolchain update recommended.. Stop.
make: *** [vboxdrv] Error 2

I can reboot in previous kernel as a workaround.
Any other suggestions.

Thanks,

GZU

Re: Tools and Drivers do not compile on SL7

Posted: 9. Mar 2018, 10:07
by andyp73
If you want to add modules into a kernel that is built with retpoline support then you will need to follow the advice of the error message and update your toolchain to a version that does.

-Andy.

Re: Tools and Drivers do not compile on SL7

Posted: 9. Mar 2018, 13:43
by denesberta
I happen to have the same issue. I have just install SL7.4 I updated what came across but nothing changed.

Re: Tools and Drivers do not compile on SL7

Posted: 16. Mar 2018, 03:53
by GZU
Hi,

No Issues in SL6, there is a difference in the Makefile regarding SPECTRE.
SL6 reports issue and continues.

/lib/modules/3.10.0-693.21.1.el7.x86_64/build/arch/x86/Makefile

See commented out SL7 (at line 166) and inserted SL6, and rerun /sbin/vboxconfig.
This is a hack so on your own head be it (or use previous kernel).

Code: Select all

# Avoid indirect branches in kernel to deal with Spectre
#ifdef CONFIG_RETPOLINE
#    RETPOLINE_CFLAGS += $(call cc-option,-mindirect-branch=thunk-extern -mindirect-branch-register)
#    ifneq ($(RETPOLINE_CFLAGS),)
#        KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) -DRETPOLINE
#    else
#        $(error CONFIG_RETPOLINE=y, but not supported by the compiler. Toolchain update recommended.)
#    endif
#endif


# Avoid indirect branches in kernel to deal with Spectre
ifdef CONFIG_RETPOLINE
    RETPOLINE_CFLAGS += $(call cc-option,-mindirect-branch=thunk-extern -mindirect-branch-register)
    ifneq ($(RETPOLINE_CFLAGS),)
        KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) -DRETPOLINE
    else
        # Fail brew build, but let other users proceed with warning
        RETPOLINE_MSG := CONFIG_RETPOLINE=y, but not supported by the compiler. Toolchain update recommended.
        KBUILD_USER := $(shell id -un)
        ifeq ($(KBUILD_USER), mockbuild)
            $(error $(RETPOLINE_MSG))
        else
            $(warning $(RETPOLINE_MSG))
        endif
    endif
endif

GZU

Re: Tools and Drivers do not compile on SL7

Posted: 13. May 2018, 17:26
by Jim1742
I'm running CentOS 7.4. Host is running windows 10 pro.

After a CentOS system update (automatic), display went back to low resolution. I tried to rebuild guest addition 5.2.8 and got the same error: CONFIG_RETPOLINE=y....upgrade compiler. I first upgraded make to v4.2.1 (was v3.8.2). This didn't help much.

I then upgraded the compiler to gcc v8.1 (was v6.1) and virtual box & guest addition to 5.2.12, the problem went away. There is a post saying RETPOLINE is supported by gcc v7.3 and later.

This took me quite a while. Hope it's useful to someone.

Re: Tools and Drivers do not compile on SL7

Posted: 13. May 2018, 17:52
by socratis
@Jim1742
Thank you for the feedback and the solution, hope someone finds it useful in the future. Marking as [Solved].