Bug 193946 - emulators/virtualbox-ose: tstVMStructRC: 1: Syntax error: "(" unexpected
Summary: emulators/virtualbox-ose: tstVMStructRC: 1: Syntax error: "(" unexpected
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: Jung-uk Kim
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-26 13:46 UTC by O. Hartmann
Modified: 2017-02-21 21:58 UTC (History)
4 users (show)

See Also:
ohartmann: maintainer-feedback+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2014-09-26 13:46:18 UTC
Port emulators/virtualbox-ose fails to build on CURRENT: FreeBSD 11.0-CURRENT #3 r272120: Thu Sep 25 20:44:16 CEST 2014 amd64

The system/world has been compiled on a CPU of the type:

CPU: Intel(R) Core(TM) i5-4200M CPU @ 2.50GHz (2494.28-MHz K8-class CPU)
  Origin="GenuineIntel"  Id=0x306c3  Family=0x6  Model=0x3c  Stepping=3
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x7fdafbbf<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,<b11>,FMA,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND>
  AMD Features=0x2c100800<SYSCALL,NX,Page1GB,RDTSCP,LM>
  AMD Features2=0x21<LAHF,ABM>
  Structured Extended Features=0x27ab<FSGSBASE,TSCADJ,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID>
  XSAVE Features=0x1<XSAVEOPT>
  VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID
  TSC: P-state invariant, performance statistics
real memory  = 9636413440 (9190 MB)
avail memory = 8149180416 (7771 MB)
[...]

The following compiler error occurs on that specific machine:

[...]
kBuild: bin2c vboxweb-wsdl - /usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.16/out/freebsd.amd64/release/obj/webservice/vboxweb.wsdl
kBuild: Installing tstVMStructRC => /usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.16/out/freebsd.amd64/release/bin/tstVMStructRC
kBuild: Generating tstVMStructSize - /usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.16/out/freebsd.amd64/release/obj/VMM/tstVMStructRC.h
/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.16/out/freebsd.amd64/release/bin/tstVMStructRC: 1: Syntax error: "(" unexpected
kmk: *** [/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.16/out/freebsd.amd64/release/obj/VMM/tstVMStructRC.h] Error 2
kmk: *** Deleting file `/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.16/out/freebsd.amd64/release/obj/VMM/tstVMStructRC.h'
kmk: *** Waiting for unfinished jobs....
filesplitter: Out of 144 files: 144 rewritten, 0 unchanged. (/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.16/out/freebsd.amd64/release/obj/VirtualBox/include)
kmk_builtin_append "/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.16/out/freebsd.amd64/release/obj/VirtualBox/include/COMWrappers"
kmk: *** Exiting with status 2
*** Error code 2

Stop.
make[1]: stopped in /usr/ports/emulators/virtualbox-ose
*** Error code 1

I do not know what causes the error. I have other systems, running the very same CURRENT revision, but with older CPU architectures. After I disabled ALL optimizations in /etc/make.conf as well as in /etc/src.conf and compiled the world with settings as vanilla FreeBSD would use, the error still occurs. Something is very fishy here.
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2014-09-26 13:46:18 UTC
Auto-assigned to maintainer vbox@FreeBSD.org
Comment 2 O. Hartmann 2015-02-17 08:42:52 UTC
The problem is present on ALL recent CURRENT installations and hardware >= Ivy Bridge/Haswell. The courios aspect of this error/failure/bug is that I have some boxes with a older "sliding" updated CURRENT installation (but they are all up to date with most recent ports tree and OS world) and they do not show the phenomenon. 

All installations made after September 2014 do show this problem.
Comment 3 O. Hartmann 2015-05-19 05:07:13 UTC
I just want to make another comment on this.

After I installed on several boxes CURRENT recently on different hardware, I step into this error on ALL freshly installed systems (installation from scratch). All systems have been "buildworld" with the following /etc/src.conf:

#
CPUTYPE?=               native
#
CFLAGS+=                -O3 -pipe
COPTFLAGS+=             -O3 -pipe
#
CXXFLAGS+=              -std=c++11
#
WITH_CLANG_FULL=        YES
WITH_CLANG_EXTRAS=      YES
WITH_LLDB=              YES
#
WITH_IDEA=              YES
#
#WITH_BSD_GREP=         YES
#
#WITH_OFED=             YES
WITH_NAND=              YES
#WITH_CTF=              YES
#
WITH_SVN=               YES
#
MALLOC_PRODUCTION=      YES
#
#WITHOUT_DEBUG_FILES=   YES


This for those which want to reproduce.

The strange thing is that I have some other boxes which has been "smoothly" gliding from the earliest days of 11-CURRENT up to now by almost daily "buildworld" with the above /etc/src.conf and they compile all sources of VBox cleanly (all systems do compile the kernel module cleanly).
This behaviour is considered a bug.
Comment 5 O. Hartmann 2016-01-21 11:05:58 UTC
On FreeBSD 11.0-CURRENT #14 r294484: Thu Jan 21 05:56:21 CET 2016 amd64 the very same.

Fun part: if the used underlying architecture of the host system compiling the port is <= Intel IvyBridge, the proble doesn't occur! Everything starting with Haswell is triggering this error. So I suspect a compiler problem.

The problem is bothering me now for a while and I'm wondering that nobody else is confronted with it. This is very strange!

[...]
kBuild: Generating tstVMStructSize - /usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.34/out/freebsd.amd64/release/obj/VMM/tstVMStructRC.h
/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.34/out/freebsd.amd64/release/bin/tstVMStructRC: 1: Syntax error: "(" unexpected
kmk: *** [/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.34/out/freebsd.amd64/release/obj/VMM/tstVMStructRC.h] Error 2
kmk: *** Deleting file `/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.34/out/freebsd.amd64/release/obj/VMM/tstVMStructRC.h'
kmk: *** Waiting for unfinished jobs....
4 warnings generated.
filesplitter: Out of 144 files: 144 rewritten, 0 unchanged. (/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.34/out/freebsd.amd64/release/obj/VirtualBox/include)
kmk_builtin_append "/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.34/out/freebsd.amd64/release/obj/VirtualBox/include/COMWrappers"
filesplitter: Out of 286 files: 286 rewritten, 0 unchanged. (/usr/ports/emulators/virtualbox-ose/work/VirtualBox-4.3.34/out/freebsd.amd64/release/obj/VBoxAPIWrap)
kmk: *** Exiting with status 2
*** Error code 2
Comment 6 O. Hartmann 2016-02-27 11:12:19 UTC
It seems that nobody takes care of this bug? A pity!

I have had the chance now to setup a box equipted with an older i7 CPU, see dmesg info below.

I also installed CURRENT and recompiled CURRENT to be FreeBSD 11.0-CURRENT #0 r296137: Sat Feb 27 08:14:26 CET 2016 amd64. I started then from a clean port base (no installed ports) and recompiled emulators/virtualbox-ose.

No problems! The port compiles on Sandy Bridge without complains as it does on any other older than Ivy Bridge architecture.

I did the same on a more modern Ivy Bridge bases box, as I reported earlier here. The compilation fails. The compilation also fails on >= Ivybridge based systems within poudriere.

I use on all systems the very same /etc/make.conf and /etc/src.conf, so it seems to boil down to a CPU/compiler specific problem.


I was wondering on what architecture the ports are built. 

[...]
Copyright (c) 1992-2016 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 11.0-CURRENT #0 r296137: Sat Feb 27 08:14:26 CET 2016
    root@telesto.geoinf.fu-berlin.de:/usr/obj/usr/src/sys/TELESTO amd64
FreeBSD clang version 3.7.1 (tags/RELEASE_371/final 255217) 20151225
VT(vga): text 80x25
CPU: Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz (3201.89-MHz K8-class CPU)
  Origin="GenuineIntel"  Id=0x206d7  Family=0x6  Model=0x2d  Stepping=7
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x1fbee3bf<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,DCA,SSE4.1,SSE4.2,x2APIC,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX>
  AMD Features=0x2c100800<SYSCALL,NX,Page1GB,RDTSCP,LM>
  AMD Features2=0x1<LAHF>
  XSAVE Features=0x1<XSAVEOPT>
  VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID
  TSC: P-state invariant, performance statistics
real memory  = 34359738368 (32768 MB)
avail memory = 33252442112 (31712 MB)
Event timer "LAPIC" quality 600
ACPI APIC Table: <ALASKA A M I>
FreeBSD/SMP: Multiprocessor System Detected: 12 CPUs
FreeBSD/SMP: 1 package(s) x 6 core(s) x 2 SMT threads
Comment 7 casper 2016-04-27 12:23:28 UTC
I have 2 boxes with similar CPUs (both the same age) and could compile VBox on one and not the other.
The only difference I could see between the 2 was the kernel config file.

The box that would build VBox had COMPAT_FREEBSD32 in the config file and the one that would build VBox didn't have COMPAT_FREEBSD32

I added "options COMPAT_FREEBSD32" in to my kernel config, rebuilt and install the new kernel and can now build VBox on both boxes
Comment 8 O. Hartmann 2016-05-02 09:47:19 UTC
This is a GREAT observation and regarding to my case, it is exactly the solution! That mysterious kBuild compilation error is gone the moment, the kernel is run with COMPAT_FREEBSD32.

On several larger systems I mainatin I disabled this feature in the kernel config files - I had never in mind that the 32Bit compaitibility has such an obscure impact on compilation.

Thank you very much for sharing this information!

The question is now: how to handle this PR? For my findings, its a bug and needs to be investigated. For the personal point of view - the problem I opened this PR has been (luckily) solved.

Kind regards,

O. Hartmann
Comment 9 Andrej Ebert 2017-02-21 14:53:25 UTC
Ran into the same on
FreeBSD 100-amnesiac 11.0-STABLE FreeBSD 11.0-STABLE #0 r314036: Tue Feb 21 14:12:06 CET 2017     root@100-amnesiac:/usr/obj/usr/src/sys/WUSTROW  amd64

CPU: AMD A8-5500 APU with Radeon(tm) HD Graphics     (3216.06-MHz K8-class CPU)
  Origin="AuthenticAMD"  Id=0x610f01  Family=0x15  Model=0x10  Stepping=1
  Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x3e98320b<SSE3,PCLMULQDQ,MON,SSSE3,FMA,CX16,SSE4.1,SSE4.2,POPCNT,AESNI,XSAVE,OSXSAVE,AVX,F16C>
  AMD Features=0x2e500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM>
  AMD Features2=0x1ebbfff<LAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,OSVW,IBS,XOP,SKINIT,WDT,LWP,FMA4,TCE,NodeId,TBM,Topology,PCXC,PNXC>
  Structured Extended Features=0x8<BMI1>
  SVM: NP,NRIP,VClean,AFlush,DAssist,NAsids=65536
  TSC: P-state invariant, performance statistics
real memory  = 17179869184 (16384 MB)
avail memory = 16008085504 (15266 MB)

After enabling COMPAT_FREEBS32 it built fine.
Comment 10 Jung-uk Kim freebsd_committer freebsd_triage 2017-02-21 21:20:13 UTC
I'll take it.
Comment 11 Jung-uk Kim freebsd_committer freebsd_triage 2017-02-21 21:56:27 UTC
FYI, the same bug is repeatedly filed and closed, e.g., Bug 142133, Bug 148833, Bug 184977, etc.
Comment 12 commit-hook freebsd_committer freebsd_triage 2017-02-21 21:56:58 UTC
A commit references this bug:

Author: jkim
Date: Tue Feb 21 21:56:31 UTC 2017
New revision: 434555
URL: https://svnweb.freebsd.org/changeset/ports/434555

Log:
  Warn and stop build if the kernel cannot execute a 32-bit binary.

  PR:		193946

Changes:
  head/emulators/virtualbox-ose/Makefile
Comment 13 Jung-uk Kim freebsd_committer freebsd_triage 2017-02-21 21:58:29 UTC
I just added a kernel test in the makefile.