Bug 282711 - relative paths given for 'MAKEOBJDIRPREFIX' make buildworld fail
Summary: relative paths given for 'MAKEOBJDIRPREFIX' make buildworld fail
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-12 16:46 UTC by tzxzan+cqw8r63qtfb5g
Modified: 2024-11-16 15:03 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tzxzan+cqw8r63qtfb5g 2024-11-12 16:46:28 UTC
FreeBSD version 10 and earlier - VMware Workstation 16 Player (Non-commercial use only)
Player
ranlib -D libegacy.a
sh /mnt/mnt/src/tools/install.sh -C -o root -g wheel -M 444 libegacy.a mnt/obj
//mnt/mnt/src/tmp/legacy/usr/lib
install: mnt/obj//mnt/mnt/src/tmp/legacy/usr/lib: No such file or directory
*** Error code 71

Stop.
make[4]: stopped in /mnt/mnt/src/tools/build
*** Error code 1
...
Comment 1 tzxzan+cqw8r63qtfb5g 2024-11-12 16:51:39 UTC
It happens with relative paths given for 'MAKEOBJDIRPREFIX':

...
        #MAKEOBJDIRPREFIX=$@/ /usr/bin/make -C mnt/src/ buildworld
        #MAKEOBJDIRPREFIX=$@/ /usr/bin/make -C mnt/src/ buildkernel
...

Works if changed to absolute paths:

...
        MAKEOBJDIRPREFIX=$$(realpath ./)/$@/ /usr/bin/make -C mnt/src/ buildworld
        MAKEOBJDIRPREFIX=$$(realpath ./)/$@/ /usr/bin/make -C mnt/src/ buildkernel
...

(These lines are from an in-house 'makefile' hence the '$$'s and '$@'s.)

It is about building 10.4 from source, did not check with more recent -- and still supported -- versions.
Comment 2 Ed Maste freebsd_committer freebsd_triage 2024-11-13 15:10:29 UTC
10.x is long past EOL, of course, but this won't work on supported versions, either. MAKEOBJDIRPREFIX is (must be) set in the environment, and top-level buildworld/buildkernel invoke make in subdirectories, so it follows that relative paths can't be used in MAKEOBJDIRPREFIX.

We should note in build(7) that it must be absolute.
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-11-13 17:46:28 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=75af1320f4b57fb568ec4f6df6171a0343953f4f

commit 75af1320f4b57fb568ec4f6df6171a0343953f4f
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-11-13 15:13:51 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-11-13 17:45:09 +0000

    build: note that MAKEOBJDIRPREFIX must be absolute

    PR:             282711
    Reviewed by:    imp
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D47538

 share/man/man7/build.7 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Comment 4 Ed Maste freebsd_committer freebsd_triage 2024-11-13 17:55:23 UTC
It looks like supported versions already emit a more explicit error in this case, and the requirement for the path to be absolute is now included in the man page.
Comment 5 commit-hook freebsd_committer freebsd_triage 2024-11-16 15:00:42 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=54efa38e255184f7f7862294666b017acb093a08

commit 54efa38e255184f7f7862294666b017acb093a08
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-11-13 15:13:51 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-11-16 14:59:22 +0000

    build: Note paths that must be absolute

    PR:             282711
    PR:             282737
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit 75af1320f4b57fb568ec4f6df6171a0343953f4f)
    (cherry picked from commit 02dc158215a69c6439e5a0809e5f9c79e62c5fd1)

 share/man/man7/build.7 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2024-11-16 15:02:45 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=3c113ee25c20bdfc66d310e17451d17f4c1ddb92

commit 3c113ee25c20bdfc66d310e17451d17f4c1ddb92
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-11-13 15:13:51 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-11-16 15:01:41 +0000

    build: Note paths that must be absolute

    PR:             282711
    PR:             282737
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit 75af1320f4b57fb568ec4f6df6171a0343953f4f)
    (cherry picked from commit 02dc158215a69c6439e5a0809e5f9c79e62c5fd1)
    (cherry picked from commit 54efa38e255184f7f7862294666b017acb093a08)

 share/man/man7/build.7 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)