Skip to content

Commit

Permalink
emulators/virtualbox-ose{,-legacy}: sort out options
Browse files Browse the repository at this point in the history
Sort out options: order (portlint), convert to OPTION_*.
Add entry in "Troubleshooting" about "VERR_NO_MEMORY".
Force devel/llvm15 for emulators/virtualbox-ose-legacy on recent 14 with
llvm16 in base.

PR:			200764 252227
Approved by:		arrowd (mentor)
Differential Revision:	https://reviews.freebsd.org/D40751
  • Loading branch information
Vladimir Druzenko authored and Vladimir Druzenko committed Jun 28, 2023
1 parent 7e8b07b commit 23eed6a
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 127 deletions.
98 changes: 44 additions & 54 deletions emulators/virtualbox-ose-legacy/Makefile
@@ -1,6 +1,6 @@
PORTNAME= virtualbox-ose
PORTVERSION= 5.2.44
PORTREVISION= 14
PORTREVISION= 15
CATEGORIES= emulators
MASTER_SITES= https://download.oracle.com/virtualbox/${PORTVERSION}/
PKGNAMESUFFIX?= -legacy
Expand All @@ -14,24 +14,24 @@ WWW= https://www.virtualbox.org/
LICENSE= GPLv2
LICENSE_FILE= ${WRKSRC}/COPYING

ONLY_FOR_ARCHS= amd64 i386

PATCH_DEPENDS+= ${LOCALBASE}/share/kBuild/tools/GXX3.kmk:devel/kBuild
BUILD_DEPENDS= yasm:devel/yasm \
xsltproc:textproc/libxslt \
BUILD_DEPENDS= gtar:archivers/gtar \
kmk:devel/kBuild \
gtar:archivers/gtar
libIDL-config-2:devel/libIDL \
yasm:devel/yasm \
xsltproc:textproc/libxslt
LIB_DEPENDS= libpng.so:graphics/png \
libxslt.so:textproc/libxslt \
libcurl.so:ftp/curl
RUN_DEPENDS= ${LOCALBASE}/etc/rc.d/vboxnet:emulators/virtualbox-ose-kmod-legacy

USES= compiler:c++14-lang cpe gnome iconv pkgconfig ssl tar:bzip2
USE_GNOME= libxml2

CPE_VENDOR= oracle
CPE_PRODUCT= vm_virtualbox

WRKSRC= ${WRKDIR}/VirtualBox-${PORTVERSION}
ONLY_FOR_ARCHS= i386 amd64
USES= compiler:c++14-lang cpe gnome iconv pkgconfig ssl tar:bzip2
USE_GNOME= libidl libxml2

HAS_CONFIGURE= yes
CONFIGURE_ARGS= --disable-java --passive-mesa
CONFIGURE_ARGS+= --with-gcc="${CC}" --with-g++="${CXX}"
Expand All @@ -41,9 +41,9 @@ CONFLICTS_INSTALL= virtualbox-ose-additions-* \
virtualbox-ose \
virtualbox-ose-lite

PORTSCOUT= limit:^5\.
WRKSRC= ${WRKDIR}/VirtualBox-${PORTVERSION}

LDFLAGS= -lpthread
PORTSCOUT= limit:^5\.

VBOXUSER?= vboxusers
VBOXWSUSER?= vboxusers
Expand All @@ -59,33 +59,46 @@ VBOX_PROGS= VBoxAutostart VBoxBalloonCtrl VBoxBugReport VBoxHeadless \
VBOX_UTILS= VBoxExtPackHelperApp VBoxNetAdpCtl VBoxNetDHCP VBoxNetNAT \
VBoxSVC VBoxXPCOMIPCD

OPTIONS_DEFINE= ALSA DBUS DEBUG DOCS GUESTADDITIONS NLS PULSEAUDIO \
PYTHON QT5 R0LOGGING UDPTUNNEL VDE VNC WEBSERVICE VPX X11
OPTIONS_DEFINE= ALSA DBUS DEBUG DOCS GUESTADDITIONS NLS PULSEAUDIO \
PYTHON QT5 R0LOGGING UDPTUNNEL VDE VNC WEBSERVICE VPX X11
OPTIONS_DEFAULT= DBUS QT5 UDPTUNNEL VNC WEBSERVICE X11
OPTIONS_SUB= yes
OPTIONS_SUB= yes

DEBUG_DESC= Debug symbols, additional logs and assertions
DEBUG_DESC= Debug symbols, additional logs and assertions
GUESTADDITIONS_DESC= Build with Guest Additions
NLS_DESC= Native language support (requires QT5)
QT5_DESC= Build with QT5 frontend (requires X11)
R0LOGGING_DESC= Enable R0 logging (requires DEBUG)
UDPTUNNEL_DESC= Build with UDP tunnel support
VDE_DESC= Build with VDE support
VNC_DESC= Build with VNC support
VPX_DESC= Use libvpx for video recording
NLS_DESC= Native language support (requires QT5)
QT5_DESC= Build with QT5 frontend (requires X11)
R0LOGGING_DESC= Enable R0 logging (requires DEBUG)
UDPTUNNEL_DESC= Build with UDP tunnel support
VDE_DESC= Build with VDE support
VNC_DESC= Build with VNC support
VPX_DESC= Use libvpx for video recording
WEBSERVICE_DESC= Build Webservice

ALSA_CONFIGURE_OFF= --disable-alsa
ALSA_LIB_DEPENDS= libasound.so:audio/alsa-lib
DBUS_CONFIGURE_OFF= --disable-dbus
DBUS_LIB_DEPENDS= libdbus-1.so:devel/dbus
DEBUG_CONFIGURE_ON= --build-debug
DOCS_USES= tex
DOCS_USE= TEX=dvipsk:build,formats:build
DOCS_BUILD_DEPENDS= ${LOCALBASE}/share/xml/docbook/4.4/docbookx.dtd:textproc/docbook-xml
DOCS_CONFIGURE_OFF= --disable-docs
DOCS_VARS= dbkxmldir=${LOCALBASE}/share/xml/docbook/4.4 \
dbkxsldir=${LOCALBASE}/share/xsl/docbook
NLS_IMPLIES= QT5
PULSEAUDIO_CONFIGURE_OFF= --disable-pulse
PULSEAUDIO_LIB_DEPENDS= libpulse.so:audio/pulseaudio
PYTHON_USES= python
PYTHON_USES_OFF= python:build
PYTHON_USE= PYTHON=distutils,noegginfo,noflavors
PYTHON_CONFIGURE_OFF= --disable-python
PYTHON_VARS= pydistutils_pkgname=vboxapi pydistutils_pkgversion=1.0
QT5_USES= gl qmake:no_env qt:5 xorg
QT5_USE= QT=buildtools:build,core,dbus,gui,linguisttools:build,opengl \
QT=printsupport,widgets,x11extras XORG=xcb GL=gl
QT5_CONFIGURE_ON= --enable-qt5
QT5_CONFIGURE_OFF= --disable-qt
QT5_IMPLIES= X11
R0LOGGING_IMPLIES= DEBUG
UDPTUNNEL_CONFIGURE_OFF= --disable-udptunnel
Expand All @@ -95,6 +108,9 @@ VNC_CONFIGURE_ON= --enable-vnc
VNC_LIB_DEPENDS= libvncserver.so:net/libvncserver
VPX_CONFIGURE_OFF= --disable-libvpx
VPX_LIB_DEPENDS= libvpx.so:multimedia/libvpx
WEBSERVICE_BUILD_DEPENDS= soapcpp2:devel/gsoap
X11_USES= sdl xorg
X11_USE= SDL=sdl XORG=x11,xcursor,xext,xinerama,xmu,xorgproto,xt
X11_CONFIGURE_OFF= --build-headless

ENV=
Expand All @@ -119,7 +135,7 @@ CONFLICTS_INSTALL+= virtualbox-ose
.endif

.if ${ARCH} == "amd64"
_ELF32!= kldstat -q -m elf32 && echo yes || echo no
_ELF32!= kldstat -q -m elf32 && ${ECHO_CMD} yes || ${ECHO_CMD} no
.endif

.if ${PORT_OPTIONS:MDEBUG}
Expand All @@ -138,49 +154,22 @@ LICENSE_PERMS_Additions= auto-accept
LICENSE_DISTFILES_Additions= ${GUESTADDITIONS}
.endif

.if ${PORT_OPTIONS:MDOCS}
DBKXMLDIR= ${LOCALBASE}/share/xml/docbook/4.4
DBKXSLDIR= ${LOCALBASE}/share/xsl/docbook
USES+= tex
USE_TEX= dvipsk:build formats:build
.endif

.if ${PORT_OPTIONS:MPYTHON}
USES+= python
USE_PYTHON= distutils noegginfo noflavors
PYDISTUTILS_PKGNAME= vboxapi
PYDISTUTILS_PKGVERSION= 1.0
.else
USES+= python:build
.endif

.if ${PORT_OPTIONS:MQT5}
CONFIGURE_ARGS+= --enable-qt5
PLIST_SUB+= QT=""
USES+= gl qmake:no_env qt:5 xorg
USE_GL= gl glu
USE_QT= buildtools:build core dbus gui linguisttools:build opengl
USE_QT+= printsupport widgets x11extras
USE_XORG= xcb
VBOX_PROGS+= VirtualBox
VBOX_UTILS+= VBoxTestOGL
VBOX_WITH_QT= 1
.else
CONFIGURE_ARGS+= --disable-qt
PLIST_SUB+= QT="@comment "
.endif

.if ${PORT_OPTIONS:MWEBSERVICE}
BUILD_DEPENDS+= soapcpp2:devel/gsoap
USE_RC_SUBR+= vboxwebsrv
VBOX_LINKS+= vboxwebsrv
VBOX_UTILS+= vboxwebsrv webtest
.endif

.if ${PORT_OPTIONS:MX11}
USES+= sdl
USE_SDL= sdl
USE_XORG+= xorgproto x11 xcursor xext xinerama xmu xt
VBOX_PROGS+= VBoxSDL
.endif

Expand All @@ -207,10 +196,11 @@ KMK_FLAGS+= -j${MAKE_JOBS_NUMBER}
.include <bsd.port.pre.mk>

.if ${CHOSEN_COMPILER_TYPE} == clang && ${OPSYS} == FreeBSD && \
(${OSVERSION} < 1302505 || (${OSVERSION} >= 1400000 && ${OSVERSION} < 1400079))
# llvm 13 and 14 included in FreeBSD fails to compile this legacy version of
(${OSVERSION} < 1302505 || (${OSVERSION} >= 1400000 && ${OSVERSION} < 1400079) || \
${OSVERSION} >= 1400091)
# llvm 13, 14 and 16 included in FreeBSD fails to compile this legacy version of
# virtualbox-ose, force llvm 15 on all versions of the FreeBSD except lastest 13
# and 14 where the llvm 15 is included: PR#265539.
# and several versions of 14 where the llvm 15 is included: PR#265539.
# Keep possibility to define different llvm via VBOX_LLVM_VER in make.conf.
BUILD_DEPENDS+= clang${VBOX_LLVM_VER}:devel/llvm${VBOX_LLVM_VER}
CC= clang${VBOX_LLVM_VER}
Expand Down
26 changes: 18 additions & 8 deletions emulators/virtualbox-ose-legacy/files/patch-configure
Expand Up @@ -25,7 +25,17 @@
elif [ $cc_maj -lt 4 \
-o \( $cc_maj -eq 4 -a $cc_min -lt 4 -a "$OS" != "darwin" \) \
-o \( $cc_maj -eq 4 -a $cc_min -lt 2 -a "$OS" = "darwin" \) ]; then
@@ -1208,7 +1215,7 @@ extern "C" int main(void)
@@ -1114,6 +1116,9 @@ extern "C" int main(int argc, char** arg
printf("found version %d.%d.%d",
SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL);
#if SDL_VERSION_ATLEAST(1,2,7)
+#if !defined(SDL_VIDEO_DRIVER_X11)
+#error SDL must be compiled with X11 support
+#endif
printf(", OK.\n");
return 0;
#else
@@ -1208,7 +1218,7 @@ extern "C" int main(void)
#endif
}
EOF
Expand All @@ -34,7 +44,7 @@
test_execute
fi
}
@@ -1508,8 +1515,7 @@ EOF
@@ -1508,8 +1518,7 @@ EOF
if [ $? -eq 0 ]; then
echo "(Qt5 from pkg-config)" >> $LOG
FLGQT5=`pkg-config Qt5Core --cflags`
Expand All @@ -44,7 +54,7 @@
INCQT5=`strip_I "$FLGQT5"`
LIBDIR5=`pkg-config Qt5Core --variable=libdir`
LIBQT5=`pkg-config Qt5Core --libs`
@@ -1648,7 +1654,7 @@ check_libopus()
@@ -1648,7 +1657,7 @@ check_libopus()
fi
cat > $ODIR.tmp_src.cc << EOF
#include <cstdio>
Expand All @@ -53,7 +63,7 @@
extern "C" int main(void)
{
OpusEncoder *test;
@@ -1980,8 +1986,8 @@ EOF
@@ -1980,8 +1989,8 @@ EOF
echo "compiling the following source file:" >> $LOG
cat $ODIR.tmp_src.cc >> $LOG
echo "using the following command line:" >> $LOG
Expand All @@ -64,7 +74,7 @@
if [ $? -eq 0 ]; then
found=1
break
@@ -2453,7 +2459,7 @@ for option in "$@"; do
@@ -2453,7 +2462,7 @@ for option in "$@"; do
--with-openssl-dir=*)
OPENSSLDIR=`echo $option | cut -d'=' -f2`
INCCRYPTO="-I${OPENSSLDIR}/include"
Expand All @@ -73,7 +83,7 @@
;;
--with-ow-dir=*)
WATCOM=`echo $option | cut -d'=' -f2`
@@ -2767,7 +2773,7 @@ if [ $ONLY_ADDITIONS -eq 0 ]; then
@@ -2767,7 +2776,7 @@ if [ $ONLY_ADDITIONS -eq 0 ]; then
check_ssl
check_curl
[ $WITH_LIBVPX -eq 1 ] && check_vpx
Expand All @@ -82,7 +92,7 @@
[ "$OS" != "darwin" ] && check_z
[ "$OS" != "darwin" ] && check_png
[ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
@@ -2788,13 +2794,20 @@ if [ $ONLY_ADDITIONS -eq 0 ]; then
@@ -2788,13 +2797,20 @@ if [ $ONLY_ADDITIONS -eq 0 ]; then
[ $WITH_PYTHON -eq 1 ] && check_python
[ $WITH_JAVA -eq 1 ] && check_java

Expand All @@ -104,7 +114,7 @@
fi
fi

@@ -2810,14 +2823,6 @@ if [ "$OS" = "linux" ]; then
@@ -2810,14 +2826,6 @@ if [ "$OS" = "linux" ]; then
cnf_append "VBOX_WITHOUT_LINUX_TEST_BUILDS" "1"
fi
if [ $ONLY_ADDITIONS -eq 0 ]; then
Expand Down
30 changes: 27 additions & 3 deletions emulators/virtualbox-ose-legacy/pkg-message
Expand Up @@ -53,15 +53,39 @@ NS_ERROR_FACTORY_NOT_REGISTERED. In this case delete /tmp/.vbox-*-ipc file.
If you experience "Network: write Failed: Cannot allocate memory" errors
try to increase net.graph.maxdata in /boot/loader.conf

If you are using AIO, then increase these limits (PR#168298):
If you are using AIO, then increase these limits (https://bugs.freebsd.org/168298):
vfs.aio.max_buf_aio=8192
vfs.aio.max_aio_queue_per_proc=65536
vfs.aio.max_aio_per_proc=8192
vfs.aio.max_aio_queue=65536
To check if AIO is used use: kldstat -v | grep aio

Check wiki page for known issues and troubleshooting:
http://wiki.freebsd.org/VirtualBox
If you are experiencing VMs freezes with an error in VBox.log such as:
"
00:01:29.590192 AssertLogRel /usr/ports/emulators/virtualbox-ose-legacy/work/VirtualBox-5.2.44
/src/VBox/VMM/VMMR3/PGMPhys.cpp(5148) int PGMR3PhysAllocateHandyPages(PVM): RT_SUCCESS(rc)
00:01:29.590221 87/128: idPage=0x3d400 HCPhysGCPhys=000000027eaed000 rc=VERR_NO_MEMORY
00:01:29.590247 Changing the VM state from 'RUNNING' to 'GURU_MEDITATION'
00:01:29.590261 Console: Machine state changed to 'GuruMeditation'
00:01:29.590695 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00:01:29.590696 !!
00:01:29.590697 !! VCPU0: Guru Meditation -8 (VERR_NO_MEMORY)
"
and see a lot of free RAM, then increase sysctl vm.max_user_wired
(https://bugs.freebsd.org/252227).
For dedicated VM servers, a good start is:
("RAM in GB" - max(1, "RAM in GB" / 32)) * 1024*1024*1024 / PAGE_SIZE
PAGE_SIZE on x86 is 4096.
Examples with different RAM sizes in GB:
16: ( 16-max(1, 16/32)*1024*1024*1024/4096 = 3932160 => 15GB
32: ( 32-max(1, 32/32)*1024*1024*1024/4096 = 8126464 => 31GB
48: ( 48-max(1, 48/32)*1024*1024*1024/4096 = 12189696 => 46.5GB
64: ( 64-max(1, 64/32)*1024*1024*1024/4096 = 16252928 => 62GB
128: (128-max(1,128/32)*1024*1024*1024/4096 = 32505856 => 124GB
256: (256-max(1,256/32)*1024*1024*1024/4096 = 65011712 => 248GB

Check the wiki page for known issues and troubleshooting:
https://wiki.freebsd.org/VirtualBox

Please report any problems to emulation@. Thanks!
EOM
Expand Down

0 comments on commit 23eed6a

Please sign in to comment.