Discussion:
[MacPorts] #57137: xcode portgroup should set -derivedDataPath on Xcode versions that need it
MacPorts
2018-09-17 10:25:52 UTC
Permalink
#57137: xcode portgroup should set -derivedDataPath on Xcode versions that need it
-------------------------+---------------------------
Reporter: ryandesign | Owner: (none)
Type: enhancement | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Keywords: | Port: xcode-1.0.tcl
-------------------------+---------------------------
Ports that use the xcode 1.0 portgroup fail to build at least on Xcode 9.4
and 10.0 GM, because they cannot write to the derived data path. By
default Xcode uses a derived data path inside the home directory, but
fails to honor the `HOME` environment variable MacPorts specifies, so it
tries to write into the macports user's home directory which is not
writable.

To work around this, the poedit port manually specifies the derived data
path, and I copied this usage to the MoltenVK port when I created it, but
every other port that builds with xcodebuild (such a graphviz-gui or
Readown) has failed to build for me in the same way, so I think we need to
move that fix into the portgroup.

It looks like the `-derivedDataPath` flag is available in xcodebuild 5 and
later (Mountain Lion and later). So we could add the flag for Xcode 5 and
later, assuming it does no harm, though surely these ports haven't been
broken since Mountain Lion. I suspect some new version of Xcode must have
introduced a change. Do we know what version that might be?
--
Ticket URL: <https://trac.macports.org/ticket/57137>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-09-20 21:15:54 UTC
Permalink
#57137: xcode portgroup should set -derivedDataPath on Xcode versions that need it
----------------------------+--------------------
Reporter: ryandesign | Owner: (none)
Type: enhancement | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: xcode-1.0.tcl |
----------------------------+--------------------

Comment (by kencu):

I noticed three things that appear to be general xcode PG issues while
fixing aquaterm and looking over irrlicht...

1. why do we run a build phase, when the build always seems to occur again
in the destroot phase anyway, and sometimes this causes errors?
2. the -derivedDataPath issue
3. at least on Xcode 10, the -derivedDataPath flag is only accepted if
there is a scheme, which so far seems to be the same as ${xcode.targe}

SO -- I am wondering if the xcode PG might just add the following as a
default, as it seems to be working for me so far on several ports:
{{{
build {}
destroot.pre_args -derivedDataPath ./DerivedData
xcode.scheme ${xcode.target}
}}}
--
Ticket URL: <https://trac.macports.org/ticket/57137#comment:2>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-09-20 21:19:10 UTC
Permalink
#57137: xcode portgroup should set -derivedDataPath on Xcode versions that need it
----------------------------+--------------------
Reporter: ryandesign | Owner: (none)
Type: enhancement | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: xcode-1.0.tcl |
----------------------------+--------------------
Post by MacPorts
I noticed three things that appear to be general xcode PG issues while
fixing aquaterm and looking over irrlicht...
Post by MacPorts
1. why do we run a build phase, when the build always seems to occur
again in the destroot phase anyway, and sometimes this causes errors?

I have noticed that some Xcode-using ports do that. I do not know why that
happens. Some Xcode-using ports override the destroot phase entirely,
perhaps in order to combat that. In MacPorts we should be building in the
build phase and destrooting in the destroot phase. If we are not doing
that for Xcode-using ports, we should figure out a way to fix that.
Post by MacPorts
2. the -derivedDataPath issue
3. at least on Xcode 10, the -derivedDataPath flag is only accepted if
there is a scheme, which so far seems to be the same as ${xcode.target}
Post by MacPorts
SO -- I am wondering if the xcode PG might just add the following as a
{{{
build {}
destroot.pre_args -derivedDataPath ./DerivedData
xcode.scheme ${xcode.target}
}}}
I wasn't aware that Xcode required a scheme to use the derived data path.

A scheme is not the same thing as a target, that's why there are separate
settings in the portgroup.
--
Ticket URL: <https://trac.macports.org/ticket/57137#comment:3>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-09-20 21:22:22 UTC
Permalink
#57137: xcode portgroup should set -derivedDataPath on Xcode versions that need it
----------------------------+--------------------
Reporter: ryandesign | Owner: (none)
Type: enhancement | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: xcode-1.0.tcl |
----------------------------+--------------------

Comment (by kencu):

I assume the xcode PG's "destroot" phase runs some "build-then-install"
logic in Xcode that might be hard to dissect...

It could be you either choose destrooting in the build phase or building
in the destroot phase :>
--
Ticket URL: <https://trac.macports.org/ticket/57137#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-09-20 21:23:51 UTC
Permalink
#57137: xcode portgroup should set -derivedDataPath on Xcode versions that need it
----------------------------+--------------------
Reporter: ryandesign | Owner: (none)
Type: enhancement | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: xcode-1.0.tcl |
----------------------------+--------------------

Comment (by ryandesign):

It would be silly if we had to use either of those in general for all
Xcode-using ports.

Perhaps there is something that some Xcode projects do that causes this to
happen.

Maybe this used to work the way we wanted in older versions of Xcode, back
when the portgroup was added, and something broke or changed in newer
versions of Xcode.
--
Ticket URL: <https://trac.macports.org/ticket/57137#comment:5>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-09-26 01:05:19 UTC
Permalink
#57137: xcode portgroup should set -derivedDataPath on Xcode versions that need it
----------------------------+--------------------
Reporter: ryandesign | Owner: (none)
Type: enhancement | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: xcode-1.0.tcl |
----------------------------+--------------------
Changes (by ddrum2000):

* Attachment "main.log" added.

From building graphviz-gui
--
Ticket URL: <https://trac.macports.org/ticket/57137>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-09-26 01:07:38 UTC
Permalink
#57137: xcode portgroup should set -derivedDataPath on Xcode versions that need it
----------------------------+--------------------
Reporter: ryandesign | Owner: (none)
Type: enhancement | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: xcode-1.0.tcl |
----------------------------+--------------------

Comment (by ddrum2000):

So I suspect I have the same problem when trying to build graphviz-gui.
I'm running Mojave with Xcode 10. I have attached a log file.
--
Ticket URL: <https://trac.macports.org/ticket/57137#comment:6>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-09-26 01:10:18 UTC
Permalink
#57137: xcode portgroup should set -derivedDataPath on Xcode versions that need it
----------------------------+--------------------
Reporter: ryandesign | Owner: (none)
Type: enhancement | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: xcode-1.0.tcl |
----------------------------+--------------------
Changes (by ryandesign):

* cc: ddrum2000 (added)
Post by MacPorts
So I suspect I have the same problem when trying to build graphviz-gui.
I'm running Mojave with Xcode 10. I have attached a log file.

Right, that's the problem you'll see building most any port that uses
xcodebuild, with new versions of Xcode.

We need to decide under what conditions to add the `-derivedDataPath` flag
to the xcode portgroup. Should we add it for Xcode 5 and later, since the
option appeared in that version? Or should we only add it on the versions
of Xcode where it fails if we don't, and if so, what versions are those?

We also need clarity on the scheme issue Ken raised.
--
Ticket URL: <https://trac.macports.org/ticket/57137#comment:7>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-09-28 13:27:58 UTC
Permalink
#57137: xcode portgroup should set -derivedDataPath on Xcode versions that need it
----------------------------+--------------------
Reporter: ryandesign | Owner: (none)
Type: enhancement | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: xcode-1.0.tcl |
----------------------------+--------------------
Post by MacPorts
I assume the xcode PG's "destroot" phase runs some "build-then-install"
logic in Xcode that might be hard to dissect...

Note that there is a confirmed bug with the new build system in Xcode 10
that causes problems with building and then destrooting separately, but
not when doing both in one step. See
[9cb3c083519503bb4b404fe57f19466a924523be/macports-ports] and
[https://echelog.com/logs/browse/macports/1537912800 IRC logs of 26th-27th
September] (starting around 22:40).
--
Ticket URL: <https://trac.macports.org/ticket/57137#comment:9>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-10-08 04:06:39 UTC
Permalink
#57137: xcode portgroup should set -derivedDataPath on Xcode versions that need it
----------------------------+--------------------
Reporter: ryandesign | Owner: (none)
Type: enhancement | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: xcode-1.0.tcl |
----------------------------+--------------------
Changes (by ryandesign):

* cc: mtn88 (added)


Comment:

Has duplicate #57223.
--
Ticket URL: <https://trac.macports.org/ticket/57137#comment:13>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-11-26 08:50:57 UTC
Permalink
#57137: xcode portgroup should set -derivedDataPath on Xcode versions that need it
----------------------------+--------------------
Reporter: ryandesign | Owner: (none)
Type: enhancement | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: xcode-1.0.tcl |
----------------------------+--------------------

Comment (by jeremyhu):

Has someone filed a radar about this issue? Please provide a reference to
it.
--
Ticket URL: <https://trac.macports.org/ticket/57137#comment:19>
MacPorts <https://www.macports.org/>
Ports system for macOS
Loading...