Bug 254616 - emulators/virtualbox-ose: Use ccache from bsd.ccache.mk
Summary: emulators/virtualbox-ose: Use ccache from bsd.ccache.mk
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Virtualbox Team (Nobody)
URL:
Keywords: needs-qa
Depends on: 254609
Blocks:
  Show dependency treegraph
 
Reported: 2021-03-27 22:52 UTC by Derek Schrock
Modified: 2022-02-09 14:35 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (vbox)


Attachments
Use bsd.ccache.mk values when building (1.30 KB, patch)
2021-03-27 22:52 UTC, Derek Schrock
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Derek Schrock 2021-03-27 22:52:35 UTC
Created attachment 223651 [details]
Use bsd.ccache.mk values when building

When using FreeBSD 12 llvm11 is used setting CC/CXX to a full path to localbase's binaries.

Use just the name and use ENV and MAKE_ENV when building such that PATH (using ccache's libexec symlink dir) and CCACHE_DIR set.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2021-07-11 03:21:25 UTC
How do other ports handle these compiler variables? I'm not sure moving from LOCALBASE/bin calls to PATH/env based invocations is the correct method. Shouldn't this be handled by Mk/bsd.ccache.mk?
Comment 2 Derek Schrock 2021-07-11 04:55:32 UTC
Since there isn't any framework support for kmk builds other ports are not setting do-build targets.  Look at bsd.ports.mk do-build target this is just emulating it.
Comment 3 Derek Schrock 2022-02-05 04:51:18 UTC
ping?
Comment 4 Guido Falsi freebsd_committer freebsd_triage 2022-02-07 10:42:52 UTC
Hi,

I'm taking a look at this patch. It does what is expected for the virtualbox-ose port.

I tried to apply it to the legacy port too, but there it causes a build failure, only on head:

```
/wrkdirs/usr/ports/emulators/virtualbox-ose-legacy/work/VirtualBox-5.2.44/src/VBox/VMM/VMMAll/IEMAllInstructionsOneByte.cpp.h:11475:15: warning: mangled name of 'iemOpHlp_Grp5_far_Ep' will change in C++17 due to non-throwing exception specification in function signature [-Wc++17-compat-mangling]
FNIEMOP_DEF_2(iemOpHlp_Grp5_far_Ep, uint8_t, bRm, FNIEMCIMPLFARBRANCH *, pfnCImpl)
              ^
error: ran out of registers during register allocation
```

(can provide full log if needed)

I could not understand the cause, do you have any idea? I'd like to apply this improvement to both the new and legacy ports.
Comment 5 Derek Schrock 2022-02-07 17:11:58 UTC
What was the change for legacy? 

Since it doesn’t have CC= and CXX= setting you should only need the $SETENV and $MAKE_ENV addition to do-build.
Comment 6 Guido Falsi freebsd_committer freebsd_triage 2022-02-07 17:42:09 UTC
(In reply to Derek Schrock from comment #5)

Yes sorry, I forgot to specify.

Yes I only modified the do-build stanza.
Comment 7 Derek Schrock 2022-02-07 17:43:10 UTC
Ok works here on 13. Any chance you’re on 14?
Comment 8 Guido Falsi freebsd_committer freebsd_triage 2022-02-07 17:45:11 UTC
(In reply to Derek Schrock from comment #7)

Yes, I specified I'm on head aka, 14.

In poudriere I'm testing on 14 (head), 13.0 and 12.3.

13.0 and 12.3 work, but it fails in 14. I'd like to understand why the difference.
Comment 9 Derek Schrock 2022-02-08 07:47:44 UTC
Yeah, you're right sorry I missed that in the init. comment.

The details of that error are over my head.

However, I don't believe this has to be with ccache.  The build fails in the same way on FreeBSD 13.0 with clang13 (head's base compiler) with/without ccache.

It seems there was a pkg fallout a couple months ago for something that looked like the same error but different code:  https://www.mail-archive.com/freebsd-pkg-fallout@freebsd.org/msg1853307.html  It doesn't appear anything was done port side to fix that.

Maybe require llvm11?  Change CC and CXX to clang11/clang++11?
Comment 10 Guido Falsi freebsd_committer freebsd_triage 2022-02-09 10:12:06 UTC
(In reply to Derek Schrock from comment #9)

Forcing llvm 11 for newer head seems to fix the issue, regarding legacy virtualbox-ose.

I'm still doing some testing and everything seems now to work.

I plan to commit these changes soon, since having virtualbox take advantage of ccache is very useful in speeding up builds a little.
Comment 11 commit-hook freebsd_committer freebsd_triage 2022-02-09 14:25:26 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a60dcd712517e7948e6867f2cbe89938b6c55681

commit a60dcd712517e7948e6867f2cbe89938b6c55681
Author:     Derek Schrock <dereks@lifeofadishwasher.com>
AuthorDate: 2022-02-09 14:22:27 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2022-02-09 14:24:30 +0000

    emulators/virtualbox-ose(-legacy): Take advantage of ccache

    This patch teaches the virtualbox ports to take advantage of ccache
    if the ports are configured to use it.

    PR:             254616

 emulators/virtualbox-ose-legacy/Makefile | 2 +-
 emulators/virtualbox-ose/Makefile        | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
Comment 12 commit-hook freebsd_committer freebsd_triage 2022-02-09 14:25:27 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=39f7031c79eb0da62240461fe830b9df08545f55

commit 39f7031c79eb0da62240461fe830b9df08545f55
Author:     Guido Falsi <madpilot@FreeBSD.org>
AuthorDate: 2022-02-09 14:20:54 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2022-02-09 14:20:54 +0000

    emulators/virtualbox-ose-legacy: Fix build on head

    The legacy version of virtualbox fails to build on head with
    clang > 11, so force using clang 11 there.

    PR:             254616 (suggested in)

 emulators/virtualbox-ose-legacy/Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)
Comment 13 Guido Falsi freebsd_committer freebsd_triage 2022-02-09 14:29:01 UTC
Committed the changes. Thanks!

BTW can you close the related review?
Comment 14 commit-hook freebsd_committer freebsd_triage 2022-02-09 14:35:30 UTC
A commit in branch 2022Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=66392cf640932b50db9ea4d5ebcabb28999e65e4

commit 66392cf640932b50db9ea4d5ebcabb28999e65e4
Author:     Guido Falsi <madpilot@FreeBSD.org>
AuthorDate: 2022-02-09 14:20:54 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2022-02-09 14:33:41 +0000

    emulators/virtualbox-ose-legacy: Fix build on head

    The legacy version of virtualbox fails to build on head with
    clang > 11, so force using clang 11 there.

    PR:             254616 (suggested in)
    (cherry picked from commit 39f7031c79eb0da62240461fe830b9df08545f55)

 emulators/virtualbox-ose-legacy/Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)
Comment 15 commit-hook freebsd_committer freebsd_triage 2022-02-09 14:35:31 UTC
A commit in branch 2022Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=12c2ffe72d30ec48aeaf9500dbcc3b82e9979110

commit 12c2ffe72d30ec48aeaf9500dbcc3b82e9979110
Author:     Derek Schrock <dereks@lifeofadishwasher.com>
AuthorDate: 2022-02-09 14:22:27 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2022-02-09 14:33:58 +0000

    emulators/virtualbox-ose(-legacy): Take advantage of ccache

    This patch teaches the virtualbox ports to take advantage of ccache
    if the ports are configured to use it.

    PR:             254616
    (cherry picked from commit a60dcd712517e7948e6867f2cbe89938b6c55681)

 emulators/virtualbox-ose-legacy/Makefile | 2 +-
 emulators/virtualbox-ose/Makefile        | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)