Bug 264195 - Fix cross-building from macOS for newversh.sh and SDK identification
Summary: Fix cross-building from macOS for newversh.sh and SDK identification
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Mateusz Piotrowski
URL: https://wiki.freebsd.org/BuildingOnNo...
Keywords: easy, needs-qa
Depends on:
Blocks:
 
Reported: 2022-05-23 23:52 UTC by Shantonu Sen
Modified: 2023-10-03 15:07 UTC (History)
3 users (show)

See Also:
koobs: maintainer-feedback? (imp)
koobs: maintainer-feedback? (jrtc27)
koobs: mfc-stable13?
koobs: mfc-stable12?


Attachments
macOS cross build improvements (1.24 KB, patch)
2022-05-23 23:52 UTC, Shantonu Sen
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Shantonu Sen 2022-05-23 23:52:23 UTC
Created attachment 234167 [details]
macOS cross build improvements

I'm trying to follow the directions at <https://wiki.freebsd.org/BuildingOnNonFreeBSD>

With

$ MAKEOBJDIRPREFIX=$HOME/Documents/freebsd/obj tools/build/make.py --debug TARGET=amd64  TARGET_ARCH=amd64  --bootstrap-toolchain buildworld

On my particular setup, I noticed two things:

/Users/shantonu/Documents/freebsd/src/sys/conf/newvers.sh: line 138: return: can only `return' from a function or sourced script
/Applications/Xcode.app/Contents/Developer/usr/bin/make: invalid option -- V
Usage: make [options] [target] ...
Options:
...
bmake[2]: "/Users/shantonu/Documents/freebsd/src/tools/build/Makefile" line 37: You must install the macOS SDK (try xcode-select --install)

bmake[2]: stopped in /Users/shantonu/Documents/freebsd/src/tools/build
*** Error code 1


The first issue looks like non-POSIX shell usage which adds a bunch of noise at the top of the build log. The second issue might be a me-specific issue that can be improved  through the use of "xcrun -sdk macosx -show-sdk-path" to find the macOS SDK, instead of having to hardcode paths for the command-line tools install vs. Xcode from the Mac App Store.

I've attached a diff that fixes both these issues.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2022-05-24 00:14:15 UTC
Thank you for your report and patch.

^Triage: Request feedback from folks involved in referenced wiki page edits