Bug 217511

Summary: emulators/virtualbox-ose: incorrect USE_GL
Product: Ports & Packages Reporter: Maxim Sobolev <sobomax>
Component: Individual Port(s)Assignee: Virtualbox Team (Nobody) <vbox>
Status: Closed FIXED    
Severity: Affects Only Me CC: cmt, dmgk, jkim, pi, samy.mahmoudi, sobomax, w.schwarzenfeld
Priority: --- Keywords: needs-patch, needs-qa
Version: LatestFlags: bugzilla: maintainer-feedback? (vbox)
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patch for fix the issue
none
Patch file generated with svn diff
none
Poudriere package log none

Description Maxim Sobolev freebsd_committer freebsd_triage 2017-03-03 01:24:34 UTC
Created attachment 180451 [details]
Patch for fix the issue

USE_GL=gl is incorrect, the port is checking for the "GLU" element and fails if that is not installed. The issue is probably masked by the some of the dependencies, which depends on GLU.

hecking for iasl: found version 20160527, OK.
Checking for xslt: found, OK.
Checking for mkisofs: found mkisofs 3.01 (amd64-unknown-freebsd10.3) Copyright (C) 1993-1997 Eric Youngdale (C) 1997-2015 Joerg Schilling, OK.
Checking for pthread: found, OK.
Checking for libxml2: found version 2.9.4, OK.
Checking for libIDL: found version 0.8.14, OK.
Checking for ssl: found version OpenSSL 1.0.2k-freebsd  26 Jan 2017, OK.
Checking for libcurl: found version 7.53.1, OK.
Checking for zlib: found version 1.2.8, OK.
Checking for libpng: found version 1.6.28, OK.
Checking for SDL: found version 1.2.15, OK.
Checking for X libraries: found, OK.
Checking for Xcursor: found, OK.
Checking for Xinerama: found, OK.
Checking for Xrandr: found, OK.
Checking for Xmu: found, OK.
Checking for Mesa / GLU:
  Mesa not found at -L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/usr/local/lib -lXext -lX11 -lGL -I/usr/local/include or Mesa headers not found
  Check the file /usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.14/configure.log for detailed error information.
Check /usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.14/configure.log for details
===>  Script "configure" failed unexpectedly.
Please report the problem to vbox@FreeBSD.org [maintainer] and attach the
"/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.1.14/config.log"
including the output of the failure of your make command. Also, it might be
a good idea to provide an overview of all packages installed on your system
(e.g. a /usr/local/sbin/pkg-static info -g -Ea).
Comment 1 Walter Schwarzenfeld freebsd_triage 2018-01-16 12:04:10 UTC
We have 5.2.4 is this still a problem, or is it overcome by events,
Comment 2 Maxim Sobolev freebsd_committer freebsd_triage 2018-12-04 18:50:28 UTC
Yes, it's still a problem. Should be USE_GL="gl glu".
Comment 3 Samy Mahmoudi 2019-01-26 12:14:53 UTC
Created attachment 201411 [details]
Patch file generated with svn diff

(In reply to Maxim Sobolev from comment #2)
Since revision 479445, it should even be:

USES=gl
USE_GL=gl glu

Please note that USE_GL=gl glu alone is "deprecated": it is now provided for backward compatibility but "will be removed eventually".
Source: https://svnweb.freebsd.org/ports?view=revision&revision=479445

Someone who knows this has modified the port accordingly, but your patch is still unapplied. Anyway, Makefile has changed since 2017 so that I updated your initial patch.
Comment 4 Kurt Jaeger freebsd_committer freebsd_triage 2019-01-26 14:09:30 UTC
Thanks for the patch. I did poudriere testbuilds and they failed with

===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: @dir %%DATADIR%%/sdk
===> Checking for items in pkg-plist which are not in STAGEDIR

which is, I guess, unrelated to your patch.
Comment 5 Samy Mahmoudi 2019-01-26 16:25:25 UTC
Nice catch Kurt. I will investigate and possibly file a bug report.
Comment 6 Samy Mahmoudi 2019-01-28 19:45:12 UTC
Created attachment 201487 [details]
Poudriere package log

(In reply to Kurt Jaeger from comment #4)

Hi Kurt,

I may know how to solve this but I need to reproduce the error as a control. What commands did you issue to generate this error?

I naively tried:
• poudriere jail -c -j 120-RELEASE-amd64 -v 12.0-RELEASE -a amd64
• poudriere ports -c -m svn+https
• poudriere testport -j 120-RELEASE-amd64 -o emulators/virtualbox-ose
but I did not get such an error.
Comment 7 Kurt Jaeger freebsd_committer freebsd_triage 2019-01-28 19:50:03 UTC
My full build log can be found at 

http://people.freebsd.org/~pi/logs/virtualbox-120-1548507690.txt
Comment 8 Kurt Jaeger freebsd_committer freebsd_triage 2019-01-28 19:51:11 UTC
make showconfig has this:

===> The following configuration options are available for virtualbox-ose-5.2.24_1:
     ALSA=off: ALSA audio architecture support
     DBUS=on: D-Bus IPC system support
     DEBUG=off: Debug symbols, additional logs and assertions
     GUESTADDITIONS=on: Build with Guest Additions
     MANUAL=on: Build with user manual
     NLS=on: Native language support (requires QT5)
     PULSEAUDIO=on: PulseAudio sound server support
     PYTHON=on: Python bindings or support
     QT5=on: Build with QT5 frontend (requires X11)
     R0LOGGING=off: Enable R0 logging (requires DEBUG)
     UDPTUNNEL=on: Build with UDP tunnel support
     VDE=off: Build with VDE support
     VNC=on: Build with VNC support
     VPX=off: Use libvpx for video recording
     WEBSERVICE=off: Build Webservice
     X11=on: X11 (graphics) support
Comment 9 Kurt Jaeger freebsd_committer freebsd_triage 2019-01-28 20:41:54 UTC
If I use the same options you used, it builds.
Comment 10 Samy Mahmoudi 2019-01-29 10:12:22 UTC
(In reply to Kurt Jaeger from comment #9)

Comparing our options and looking at the make file, I thought the option PYTHON triggered the error. Your last comment seems to confirm this.

My laptop is too slow to build this port and ccache seems useless so I will carry on testing on a different machine.
Comment 11 Kurt Jaeger freebsd_committer freebsd_triage 2019-01-29 19:14:07 UTC
I tested with PYTHON=on, it still builds. So the cause is some other option.

I'll do more tests.
Comment 12 Jung-uk Kim freebsd_committer freebsd_triage 2019-01-29 21:05:31 UTC
(In reply to Kurt Jaeger from comment #4)
This is a simple problem.  Try this:

Index: emulators/virtualbox-ose/Makefile
===================================================================
--- emulators/virtualbox-ose/Makefile	(revision 491592)
+++ emulators/virtualbox-ose/Makefile	(working copy)
@@ -315,7 +315,9 @@ do-build:
 .endif
 
 do-install:
+.if ${PORT_OPTIONS:MPYTHON} || ${PORT_OPTIONS:MWEBSERVICE}
 	${MKDIR} ${STAGEDIR}${DATADIR}/sdk
+.endif
 	cd ${KMK_BUILDDIR}/bin/sdk/bindings/xpcom && \
 	    ${COPYTREE_SHARE} "idl samples" ${STAGEDIR}${DATADIR}
Comment 13 Samy Mahmoudi 2019-01-29 21:26:15 UTC
Thank you both for your help.
Comment 14 Samy Mahmoudi 2019-01-29 21:34:02 UTC
(In reply to Jung-uk Kim from comment #12)

My problem is the lack of a decent machine...

Uprading an 8-cores server from 11.1 to 12.0 should be better than sticking to my laptop ;-)
Comment 15 commit-hook freebsd_committer freebsd_triage 2019-01-29 22:29:26 UTC
A commit references this bug:

Author: jkim
Date: Tue Jan 29 22:28:25 UTC 2019
New revision: 491601
URL: https://svnweb.freebsd.org/changeset/ports/491601

Log:
  Fix OpenGL dependency and appease stage-qa.

  PR:		217511

Changes:
  head/emulators/virtualbox-ose/Makefile
Comment 16 Jung-uk Kim freebsd_committer freebsd_triage 2019-01-29 22:32:26 UTC
It should be fixed now.  Thanks!
Comment 17 Samy Mahmoudi 2019-01-30 06:31:53 UTC
(In reply to Jung-uk Kim from comment #16)

With your commit and Kurt's set of options, I now get:

Error: /usr/local/lib/virtualbox/VBoxTestOGL is linked to /usr/local/lib/libGL.so.1 from graphics/mesa-libs but it is not declared as a dependency
Warning: you need USE_GL+=gl

So the secondary problem that Kurt found out seems corrected while the primary problem of Bug 217511 is still not.

I think you should have changed the value of line 152 as I did in the patch of comment #3: to "gl glu", not to "glu" only.

I understand the new semantic as:
• First, indicate that the port uses OpenGL
• Secondly, indicate which OpenGL components the port uses

In the make syntax, this gives in general:
• USES=gl
• USE_GL=egl gl glu...
Comment 18 Christoph Moench-Tegeder freebsd_committer freebsd_triage 2019-01-30 12:50:32 UTC
(In reply to Jung-uk Kim from comment #16)

sorry to barge in here, but after this commit, do-install is broken if neither PYTHON nor WEBSERVISE has been selected: ${DATADIR}/sdk will not be created anymore, but Makefile line 331:

  ${RLN} ${STAGEDIR}${DATADIR}/sdk ${STAGEDIR}${VBOX_DIR}

still references ${DATADIR}/sdk:

  install -l rs /wrkdirs/usr/ports/emulators/virtualbox-ose/work/stage/usr/local/share/virtualbox-ose/sdk /wrkdirs/usr/ports/emulators/virtualbox-ose/work/stage/usr/local/lib/virtualbox
  install: /wrkdirs/usr/ports/emulators/virtualbox-ose/work/stage/usr/local/share/virtualbox-ose/sdk: realpath: No such file or directory
  *** Error code 71
Comment 19 Samy Mahmoudi 2019-01-30 13:33:12 UTC
For the secondary problem, we may use lines 178 to 182 (these lines seem useless now) and modify the package plist with some %%SDK%% prefixes according to these guidelines:
https://www.freebsd.org/doc/en/books/porters-handbook/plist-cleaning.html
Comment 20 Dmitri Goutnik freebsd_committer freebsd_triage 2019-01-30 14:18:56 UTC
*** Bug 235317 has been marked as a duplicate of this bug. ***
Comment 21 Dmitri Goutnik freebsd_committer freebsd_triage 2019-01-30 14:57:16 UTC
${RLN} needs a condition and pkg-plist seems to be just missing %%SDK%% prefix:

Index: Makefile
===================================================================
--- Makefile    (revision 491626)
+++ Makefile    (working copy)
@@ -328,7 +328,9 @@
        ${MKDIR} ${STAGEDIR}${VBOX_DIR}
        cd ${KMK_BUILDDIR}/bin && ${COPYTREE_SHARE} \
            "*.fd *.r0 *.rc *.so components" ${STAGEDIR}${VBOX_DIR}
+.if ${PORT_OPTIONS:MPYTHON} || ${PORT_OPTIONS:MWEBSERVICE}
        ${RLN} ${STAGEDIR}${DATADIR}/sdk ${STAGEDIR}${VBOX_DIR}
+.endif

        ${INSTALL_SCRIPT} ${WRKSRC}/src/VBox/Installer/freebsd/VBox.sh \
            ${STAGEDIR}${VBOX_DIR}
Index: pkg-plist
===================================================================
--- pkg-plist   (revision 491626)
+++ pkg-plist   (working copy)
@@ -422,7 +422,7 @@
 lib/virtualbox/VMMRC.rc
 %%QT%%@(root,%%VBOXGROUP%%,4510) lib/virtualbox/VirtualBox
 %%QT%%lib/virtualbox/VirtualBox.so
-lib/virtualbox/sdk
+%%SDK%%lib/virtualbox/sdk
 %%WEBSERVICE%%lib/virtualbox/vboxwebsrv
 %%WEBSERVICE%%lib/virtualbox/webtest
 %%VNC%%lib/virtualbox/ExtensionPacks/VNC/ExtPack-license.html
Comment 22 Jung-uk Kim freebsd_committer freebsd_triage 2019-01-30 18:37:36 UTC
(In reply to Samy Mahmoudi from comment #17)
I omitted gl because glu requires gl.  If it still complains, I guess we have to add it, too. :-(
Comment 23 Jung-uk Kim freebsd_committer freebsd_triage 2019-01-30 18:38:24 UTC
(In reply to Dmitri Goutnik from comment #21)
I'll commit it soon.  Thanks!
Comment 24 commit-hook freebsd_committer freebsd_triage 2019-01-30 19:24:29 UTC
A commit references this bug:

Author: jkim
Date: Wed Jan 30 19:24:18 UTC 2019
New revision: 491653
URL: https://svnweb.freebsd.org/changeset/ports/491653

Log:
  Appease stage-qa.

  PR:		217511

Changes:
  head/emulators/virtualbox-ose/Makefile
  head/emulators/virtualbox-ose/pkg-plist