[vbox-dev] Cannot compile VirtualBox 5.1.30 without access to kernel sources (regression since 5.1.12)

Michael Thayer michael.thayer at oracle.com
Tue Jan 9 10:57:40 GMT 2018


Hello Ulrich,

Could you try applying the following patch to configure?  It is against
trunk, but I checked that it applies against 5.1.  The quick explanation
is that we switched from doing kernel module test builds as part of the
build process to doing them as test cases.  One reason for reworking
them was that the old way did not work with Linux 4.9 and later, which
is the reason for most of the removed lines below.  However we also
changed the Make variables which controlled it and clearly forgot to
update configure.

Regards from the other side of Stuttgart.
Michael

Index: configure
===================================================================
--- configure	(revision 120097)
+++ configure	(working copy)
@@ -1766,31 +1766,7 @@
     fail
   else
     if test_execute; then
-      cat > $ODIR.tmp_src.c << EOF
-#include <linux/version.h>
-int printf(const char *format, ...);
-int main(void)
-{
-  return LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0) ? 1 : 0;
-}
-EOF
-      echo "compiling the following source file:" >> $LOG
-      cat $ODIR.tmp_src.c >> $LOG
-      echo "using the following command line:" >> $LOG
-      echo "$CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc
-I$LINUX/include " \
-          "-I$LINUX/include/generated/uapi" >> $LOG
-      $CC -O -Wall -o $ODIR.tmp_out $ODIR.tmp_src.c -nostdinc
-I$LINUX/include \
-          -I$LINUX/include/generated/uapi >> $LOG 2>&1
-      if [ $? -eq 0 ]; then
-        $ODIR.tmp_out
-        if [ $? -ne 0 ]; then
-          cnf_append "VBOX_WITH_VBOXDRV" ""
-          cnf_append "VBOX_WITH_ADDITION_DRIVERS" ""
-          echo "Detected Linux >= 4.8 -- disabling compiling of Linux
kernel modules."
-        else
-          cnf_append "VBOX_LINUX_SRC" "`cd $LINUX ; pwd`"
-        fi
-      fi
+      cnf_append "VBOX_LINUX_SRC" "`cd $LINUX ; pwd`"
     fi
   fi
 }
@@ -2822,8 +2798,7 @@
     check_linux
   else
     cnf_append "VBOX_LINUX_SRC" ""
-    cnf_append "VBOX_WITH_VBOXDRV" ""
-    cnf_append "VBOX_WITH_ADDITION_DRIVERS" ""
+    cnf_append "VBOX_WITHOUT_LINUX_TEST_BUILDS" "1"
   fi
   if [ $ONLY_ADDITIONS -eq 0 ]; then
     if [ $WITH_ALSA -eq 1 ]; then

06.01.2018 13:55, Ulrich Gemkow wrote:
> Hello,
> 
> On Saturday 06 January 2018, "Sérgio" Basto wrote:
>> On Fri, 2018-01-05 at 20:10 +0100, Ulrich Gemkow wrote:
>>> Hello,
>>>
>>> VirtualBox 5.1.30 can no longer be compiled when the kernel sources
>>> are not available during the build. The compile fails with the error
>>>
>>> -- kBuild: Installing /lnc/build/apps/make/VirtualBox-
>>> 5.1.30/out/linux.amd64/release/misc-staging/rdesktop-1.8.3-
>>> vrdp/include/iprt/linux/sysfs.h
>>> kBuild: Installing /lnc/build/apps/make/VirtualBox-
>>> 5.1.30/out/linux.amd64/release/misc-staging/rdesktop-1.8.3-
>>> vrdp/include/iprt/list.h
>>> /lnc/build/apps/make/VirtualBox-
>>> 5.1.30/out/linux.amd64/release/obj/tstguest_mod/vboxguest/Makefile.in
>>> clude.header:112: *** Error: unable to find the sources of your
>>> current Linux kernel. Specify KERN_DIR=<directory> and run Make
>>> again.  Stop.
>>> make[1]: Leaving directory '/lnc/build/apps/make/VirtualBox-
>>> 5.1.30/out/linux.amd64/release/obj/tstguest_mod/vboxguest'
>>                                      ^^^^^^^   
>>
>> I checked my configuration and do not have kernel sources but I also
>> disable testcases [1] . Seems to me the regression it is in tst (test
>> cases) . 
>>
>>
>> [1]
>> kmk VBOX_WITH_TESTCASES= 
>>
> 
> Thanks! This fixes this problem. Maybe building this test should
> be excluded by configure when --disable-kmods is set.
> 
> Thanks again and best regards
> 
> Ulrich
> 
>>> kBuild: Installing /lnc/build/apps/make/VirtualBox-
>>> 5.1.30/out/linux.amd64/release/misc-staging/rdesktop-1.8.3-
>>> vrdp/include/iprt/lockvalidator.h
>>
>>
>>
>>> Makefile:30: recipe for target 'all' failed
>>>
>>> configure is called with the following parameters:
>>>
>>> ./configure --disable-kmods --disable-pulse --disable-alsa --disable-
>>> hardening --disable-opengl --disable-dbus --disable-docs --disable-
>>> python --disable-java --disable-libvpx
>>>
>>> The compile host is a modified Ubuntu 16.04 with a vanilla kernel
>>> Linux 4.9.
>>>
>>> The error did not happen when compiling 5.1.12 in exact the
>>> same configuration, so this is a regression.
>>>
>>> IMHO it should be possible to compile VirtualBox without access
>>> to the kernel sources when --disable-kmods is given - not only
>>> for security reasons.
>>
>>
>>
>>> Thanks and best regards
>>>
>>> Ulrich
>>>
> 

-- 
Michael Thayer | VirtualBox engineer
ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | D-71384 Weinstadt

ORACLE Deutschland B.V. & Co. KG
Hauptverwaltung: Riesstraße 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande Handelsregister
der Handelskammer Midden-Nederland, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Jan Schultheiss, Val Maher




More information about the vbox-dev mailing list