Summary: | Mk/Uses/ninja.mk: 'USES=cmake emacs' results in build error with ninja | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | Yasuhiro Kimura <yasu> | ||||||||
Component: | Individual Port(s) | Assignee: | Port Management Team <portmgr> | ||||||||
Status: | Closed Overcome By Events | ||||||||||
Severity: | Affects Only Me | CC: | adridg, kde, lwhsu, tcberner | ||||||||
Priority: | --- | Flags: | yasu:
exp-run?
|
||||||||
Version: | Latest | ||||||||||
Hardware: | Any | ||||||||||
OS: | Any | ||||||||||
URL: | https://reviews.freebsd.org/D27494 | ||||||||||
Attachments: |
|
Description
Yasuhiro Kimura
2020-11-16 17:50:17 UTC
Over to maintainer Moin moin You could try cmake:noninja in the meantime. https://svnweb.freebsd.org/ports/head/Mk/Uses/cmake.mk?revision=488341&view=markup#l10 This flag to cmake.mk was added specifically to disable usage of ninja. mfg Tobias The problem is found. If a port uses 'USES=cmake' and also defines do-install target, then `make describe` produces such warning message as below. make: "/usr0/freebsd/ports/head/sysutils/osquery/Makefile" line 78: warning: duplicate script for target "do-install" ignored make: "/usr0/freebsd/ports/head/Mk/Uses/ninja.mk" line 29: warning: using previous script for "do-install" defined here I'll investigate and update patch to fix it. So please suspend exp-run until new patch is unloaded. Created attachment 219766 [details]
Updated patch file
Fix warning messages with following changes.
* In Mk/bsd.port.mk define DO_MAKE_INSTALL and use it in do-install target.
* In Mk/Uses/ninja.mk re-define DO_MAKE_INSTALL so ninja is directly invoked.
So please do exp-run with attached patch instead of original one.
(In reply to Yasuhiro KIMURA from comment #4) Can you open a review on https://reviews.freebsd.org/ ? Created attachment 220329 [details]
Updated patch file
Change custom targets of ports using ninja so they don't use MAKE_{ARGS,CMD,ENV}.
(In reply to Antoine Brodin from comment #5) Sorry for late response. I created following review. https://reviews.freebsd.org/D27494 This is very much bogged down in the linked review. I wonder if it is worth pursuing further, because it's *really hard* to get things right for multiple build systems, even as yasu@ has demonstrated that it is possible to get ninja and make straight. To summarize, though: - `USES=emacs` assumes that the build is going to use make, and sets make-relevant variables, - `USES=ninja`, or `USES=cmake` (which implies ninja), switch the build system to ninja which does not understand the make-relevant variables, - and some ports do convoluted things with special targets in the ports Makefiles. I wonder if it is feasible to split this into smaller steps? - Introduce helpers that make it easier to switch build systems (make vs ninja) for specific kinds of commands. I think those are called `DO_MAKE_INSTALL` in the review, and similar. - Avoid defining `do-*` targets in the files in Mk/Uses, to improve interoperability and safety (but maybe this is going to come down to a documentation issue). - Then start switching over the problematic ports one-by-one. I'm going to close this since libegit2 has landed, there's a workaround, and fixing this "the right way" has gotten so bogged down. I believe it might be done easier if emacs.mk could detect that ninja is (or will be) used -- maybe it could check for USES=cmake and do something sensible for CMake instead, since overall it seems unlikely that a CMake-generated set of Makefiles would expect such a variable. (Indeed, the EMACS variable isn't used in the generated Makefiles) A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=07ebebf97e7cc575bc90b37f5d46097179201285 commit 07ebebf97e7cc575bc90b37f5d46097179201285 Author: Adriaan de Groot <adridg@FreeBSD.org> AuthorDate: 2022-05-05 22:23:35 +0000 Commit: Adriaan de Groot <adridg@FreeBSD.org> CommitDate: 2022-05-05 22:45:34 +0000 USES=cmake: be explicit about incompatibilities with ninja Document how `USES=gmake` and `USES=emacs` are incompatible with the default `USES=cmake` behavior of using ninja as generator. Using a naive `USES=cmake emacs` line used to get you a strange ninja error when ${MAKE_ARGS} is passed to it, now there is a meaningful error message beforehand. The linked PR examines ways to make it "just work", but that got bogged down. Do a partial fix so it is easier to track down next time. PR: 251191 Mk/Uses/cmake.mk | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) |