Opened 5 years ago

Closed 5 years ago

#58998 closed defect (fixed)

port @2.5.99 fails to build a port - in this case ldns.

Reported by: snowflake (Dave Evans) Owned by: jmroot (Joshua Root)
Priority: Normal Milestone:
Component: ports Version: 2.5.99
Keywords: Cc: satraul (Satryaji Aulia)
Port: ldns

Description

port @2.5.99 does not build some ports, while port @2.5.4 does build them.

Environment: macOS 10.11.6, Xcode 8.2.1

Related tickets #58909 for clang-8.0 and #58907 for clang-3.9.

I have bisected the port command and the failing commit in macports-base is:

commit 057ce2b2bfe8d08cafe3f98296546f6a060790ab (refs/bisect/bad)
Author: Satryaji Aulia <satraul@macports.org>
Date:   2019-06-13 16:24:38 +0100

    port1.0: Implement use_xcode option
    
    * implement new option use_xcode to indicate Xcode dependency
    * default DEVELOPER_DIR to Command Line Tools unless port needs Xcode
    * hide Xcode files on trace mode unless port needs Xcode
    * fail fetch phase of Xcode-dependent port if Xcode is not installed
    
    References https://trac.macports.org/ticket/35045
    References https://trac.macports.org/ticket/58016

In all 3 cases of build failure -isysroot for clang does not receive an argument.

It seems to be caused by port using commands in /Library/Developer instead of Applications/Xcode.app. Diff'ing the good and bad logs for the ldns build shows this (logs are attached).

It is entirely possible that my command line tools are out of date or something else equally silly. I have built many ports in the last two weeks and only three of them have failed in this manner.

Attachments (2)

ldns-bad.log (24.7 KB) - added by snowflake (Dave Evans) 5 years ago.
ldns failing to build with the bad port command
ldns-good.log (86.5 KB) - added by snowflake (Dave Evans) 5 years ago.
ldns successful build

Download all attachments as: .zip

Change History (9)

Changed 5 years ago by snowflake (Dave Evans)

Attachment: ldns-bad.log added

ldns failing to build with the bad port command

Changed 5 years ago by snowflake (Dave Evans)

Attachment: ldns-good.log added

ldns successful build

comment:1 Changed 5 years ago by snowflake (Dave Evans)

The macports-ports commit I used to build ldns was 140f92e4a22a563dd73da296413ea741aab52967

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

Cc: satraul added

comment:3 Changed 5 years ago by satraul (Satryaji Aulia)

After investigating, I think the problem is that:

  1. in the configure phase, macports is decides to use the 'Xcode Clang' compiler (/usr/bin/clang) which we resolve to CommandLineTools
  2. in the build phase, libtool is called which should be called with the CommandLineTools SDK path in -isysroot but isn't. it's empty. should be something like -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.11.sdk. which is why this warning pops up:
    clang: warning: no such sysroot directory: '-I/opt/local/include'
    
  1. build fails because it couldn't find SDK headers (stdio.h)

I've no idea why 2 happens, my guess that it's related to problems with libtool as discussed here: https://trac.macports.org/ticket/57612

Your guess of that the CLT is out of date is plausible to why -isysroot is empty. It might be that libtool finds the SDK path using xcrun which is known to output an empty string on old versions (though it should be a non-zero ouput)

comment:4 in reply to:  3 Changed 5 years ago by snowflake (Dave Evans)

Replying to satraul:

Your guess of that the CLT is out of date is plausible to why -isysroot is empty. It might be that libtool finds the SDK path using xcrun which is known to output an empty string on old versions (though it should be a non-zero ouput)

My command line tools according to mpstats is "clt_version": "8.2.0.0.1.1480973914"

comment:5 Changed 5 years ago by jmroot (Joshua Root)

Component: baseports

comment:6 Changed 5 years ago by jmroot (Joshua Root)

Port: ldns added

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

Owner: set to jmroot
Resolution: fixed
Status: newclosed

In 162736257bd7e94b2d2d72d60c527ed9196aa0ba/macports-ports (master):

ldns: fix SDK flags

The configure script's SDK autodetection code was producing invalid
flags when DEVELOPER_DIR was set to a Command Line Tools instance.

Fixes: #58998

Note: See TracTickets for help on using tickets.