Opened 4 years ago

Closed 4 years ago

#61435 closed defect (fixed)

use_xcode default value is incorrect on macOS 11.0

Reported by: nicst35 Owned by: jmroot (Joshua Root)
Priority: Normal Milestone: MacPorts 2.6.4
Component: base Version: 2.6.99
Keywords: bigsur Cc: ryandesign (Ryan Carsten Schmidt), jmroot (Joshua Root)
Port:

Description

After performing a clean install of 11.0.1 RC Beta (20B28), Command Line Tools 12.2 RC and building MacPorts from master branch, the resulting build is unable to build packages with the following message:

Error: Port [...] requires a full Xcode installation, which was not found on your system.

Steps to reproduce

  1. Install Command Line Tools for Xcode 12.2 RC on a fresh OS installation.
  2. Clone macports-base master branch, then build and install on the default location and sync the ports tree.
  3. Try building a port not requiring Xcode (bash used in the example below)

Expected result

With packages not requiring a full Xcode installation, the system should download the source package and build a running package.

Actual result

port fails to build any package until Xcode is installed.

Debug output

$ sudo port -d build bash
DEBUG: Changing to port directory: /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/shells/bash
DEBUG: OS darwin/20.1.0 (macOS 11.0) arch i386
DEBUG: Reading variant descriptions from /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/_resources/port1.0/variant_descriptions.conf
DEBUG: universal variant already exists, so not adding the default one
DEBUG: Running callback portconfigure::add_automatic_compiler_dependencies
DEBUG: Finished running callback portconfigure::add_automatic_compiler_dependencies
DEBUG: Running callback portbuild::add_automatic_buildsystem_dependencies
DEBUG: Finished running callback portbuild::add_automatic_buildsystem_dependencies
DEBUG: Running callback portstartupitem::add_notes
DEBUG: Finished running callback portstartupitem::add_notes
DEBUG: dropping privileges: euid changed to 502, egid changed to 501.
DEBUG: Starting logging for bash
DEBUG: macOS 11.0 (darwin/20.1.0) arch i386
DEBUG: MacPorts 2.6.99
DEBUG: Xcode none
DEBUG: SDK 11.0
DEBUG: MACOSX_DEPLOYMENT_TARGET: 11.0
Error: Port bash requires a full Xcode installation, which was not found on your system.
Error: You can install Xcode from the Mac App Store or https://developer.apple.com/xcode/
Error: Follow https://guide.macports.org/#project.tickets to report a bug.
Error: Processing of port bash failed

Attachments (1)

use_xcode-fix.diff (782 bytes) - added by jmroot (Joshua Root) 4 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 4 years ago by jmroot (Joshua Root)

Keywords: bigsur added
Summary: CLT 12.2 RC on macOS 11.0.1 RC (20B28): unable to build packagesuse_xcode default value is incorrect on macOS 11.0

My guess would be the file /usr/lib/libxcselect.dylib doesn't exist on Big Sur?

Changed 4 years ago by jmroot (Joshua Root)

Attachment: use_xcode-fix.diff added

comment:2 Changed 4 years ago by jmroot (Joshua Root)

Try the attached patch.

comment:3 Changed 4 years ago by jmroot (Joshua Root)

Milestone: MacPorts 2.6.4

comment:4 in reply to:  1 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to jmroot:

My guess would be the file /usr/lib/libxcselect.dylib doesn't exist on Big Sur?

Correct, it doesn't exist.

comment:5 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11_0_1-release-notes

New in macOS Big Sur 11.0.1, the system ships with a built-in dynamic linker cache of all system-provided libraries. As part of this change, copies of dynamic libraries are no longer present on the filesystem. Code that attempts to check for dynamic library presence by looking for a file at a path or enumerating a directory will fail. Instead, check for library presence by attempting to dlopen() the path, which will correctly check for the library in the cache. (62986286)

comment:6 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign added

comment:7 Changed 4 years ago by jmroot (Joshua Root)

Cc: jmroot added

comment:8 in reply to:  2 Changed 4 years ago by nicst35

Replying to jmroot:

Try the attached patch.

Patch applied and tested. It works now.

Replying to ryandesign:

The system ships with a built-in dynamic linker cache of all system-provided libraries. As part of this change, copies of dynamic libraries are no longer present on the filesystem

So it's "Security by obscurity". I see no other reason than that, unfortunately.

comment:9 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

The dynamic linker cache, like all caches, is a performance enhancement. Apple has used it for years on iOS and has decided it's worth bringing to the Mac as well. Not keeping duplicate copies of the libraries in the filesystem is a disk space savings.

comment:10 Changed 4 years ago by jmroot (Joshua Root)

The cache already existed on previous macOS versions. They just decided that since all dyld operations use the cache anyway, they might as well just pre-populate the cache with all system libs and remove the filesystem versions. Irritating for some use cases but it makes sense from a certain point of view.

comment:11 Changed 4 years ago by jmroot (Joshua Root)

Owner: set to jmroot
Resolution: fixed
Status: newclosed

In d58b124eb3b8e758bdee7a40c0b612634f9754f3/macports-base (master):

don't rely on /usr/lib existing on macOS 11

We can assume /usr/lib/libxcselect.dylib is available on Big Sur.

Fixes: #61435

Note: See TracTickets for help on using tickets.