Bug 228433 - emulators/virtualbox-ose-kmod: compile error: error: "offsetof is not defined!"
Summary: emulators/virtualbox-ose-kmod: compile error: error: "offsetof is not defined!"
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Jung-uk Kim
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-23 04:40 UTC by O. Hartmann
Modified: 2018-06-01 06:39 UTC (History)
4 users (show)

See Also:


Attachments
Tantive patch (1.29 KB, patch)
2018-05-23 22:55 UTC, Guido Falsi
madpilot: maintainer-approval? (vbox)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2018-05-23 04:40:02 UTC
On recent CURRENT (FreeBSD 12.0-CURRENT #106 r333789: Fri May 18 14:48:40 CEST 2018 amd64) building port emulators/virtualbox-ose-kmod (ports tree revision at  470673), via PORTS+MODULES= in /etc/src.conf as part of the kernel, fails with the error shown below:
 
[...]
=== Building 'vboxnetflt' module ===
machine -> /usr/src/sys/amd64/include
x86 -> /usr/src/sys/x86/include
awk -f /usr/src/sys/tools/makeobjops.awk /usr/src/sys/kern/device_if.m -h
awk -f /usr/src/sys/tools/makeobjops.awk /usr/src/sys/kern/bus_if.m -h
:> opt_netgraph.h
Warning: Object directory not changed from original /usr/obj/usr/src/amd64.amd64/sys/GLOCKE/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-5.2.12/out/freebsd.amd64/release/bin/src/vboxnetflt
cc  -O2 -pipe -march=native -fno-strict-aliasing -DRT_OS_FREEBSD -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -w -DVBOX_WITH_HARDENING -DVIMAGE -DRT_ARCH_AMD64 -march=native  -Werror -D_KERNEL -DKLD_MODULE -nostdinc  -Iinclude -I. -Ir0drv -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer   -MD  -MF.depend.VBoxNetFlt-freebsd.o -MTVBoxNetFlt-freebsd.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -Wno-error-pointer-sign -Wno-error-shift-negative-value -Wno-address-of-packed-member  -mno-aes -mno-avx  -std=iso9899:1999 -c VBoxNetFlt-freebsd.c -o VBoxNetFlt-freebsd.o
In file included from VBoxNetFlt-freebsd.c:63:
In file included from include/VBox/err.h:30:
In file included from include/iprt/err.h:30:
include/iprt/types.h:73:5: error: "offsetof is not defined!"
#   error "offsetof is not defined!"
    ^
1 error generated.
*** Error code 1

Stop.
make[6]: stopped in /usr/obj/usr/src/amd64.amd64/sys/GLOCKE/usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-5.2.12/out/freebsd.amd64/release/bin/src/vboxnetflt
*** Error code 1
Comment 1 Guido Falsi freebsd_committer freebsd_triage 2018-05-23 22:55:37 UTC
Created attachment 193639 [details]
Tantive patch

I've hit this myself just now.

Having a look at the failing part of the source code it looks like what they define as a kludge is not necessary anymore and has been fixed in base r324622.

I also suspect the kludge was already not necessary when they switched from including stddef.h to including sys/stddef.h, which has never diverged from types.h in the definition of offsetof.

I've made a very simple patch removing the kludge and simply including the required files. It does compile, but I still have to test it at runtime, which I will do once building a bunch of other packages is done and report back.

I'm anyway attaching my patch for reference.
Comment 2 Guido Falsi freebsd_committer freebsd_triage 2018-05-24 06:54:30 UTC
(In reply to Guido Falsi from comment #1)
> Created attachment 193639 [details]
> Tantive patch
[...]
> I'm anyway attaching my patch for reference.

With the attached patch it compiles and works fine on head r334087.

I'll update the patch to limit it's scope based on __FreeBSD_version, but I still have to identify the correct values for that.
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-06-01 00:30:59 UTC
A commit references this bug:

Author: jkim
Date: Fri Jun  1 00:30:51 UTC 2018
New revision: 471248
URL: https://svnweb.freebsd.org/changeset/ports/471248

Log:
  Remove obsolete kludges.  All supported versions do not need these hacks.
  Furthermore, these hacks break build on head.

  PR:		228433

Changes:
  head/emulators/virtualbox-ose/files/patch-include_iprt_types.h
Comment 4 Jung-uk Kim freebsd_committer freebsd_triage 2018-06-01 00:31:59 UTC
Committed, thanks!
Comment 5 Jung-uk Kim freebsd_committer freebsd_triage 2018-06-01 00:33:37 UTC
(In reply to Guido Falsi from comment #2)
All supported versions do not need the kludges.  Confirmed with Poudriere.
Comment 6 Guido Falsi freebsd_committer freebsd_triage 2018-06-01 06:39:57 UTC
(In reply to Jung-uk Kim from comment #5)
> (In reply to Guido Falsi from comment #2)
> All supported versions do not need the kludges.  Confirmed with Poudriere.

Thanks for checking this and taking care of it!