Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#62245 closed defect (fixed)

ccache fails to build

Reported by: szhorvat (Szabolcs Horvát) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: Cc:
Port: ccache

Description

After yesterday's update to ccache 4.2, ccache fails to build on my machine (macOS 10.14.6, Xcode 11.3.1 (11C504)).

The build log is attached. The error is this:

ccache: error: Failed to create directory /opt/local/var/macports/build/.ccache/tmp: Operation not permitted

A possibly related ticket is #61565

Attachments (1)

main.log (34.7 KB) - added by szhorvat (Szabolcs Horvát) 4 years ago.

Download all attachments as: .zip

Change History (13)

Changed 4 years ago by szhorvat (Szabolcs Horvát)

Attachment: main.log added

comment:1 Changed 4 years ago by szhorvat (Szabolcs Horvát)

Based on the hint in the other ticked, I was able to upgrade ccache by first uninstalling it. It seems that the problem is caused by ccache being present on the system, and wanting to put the cache in a location it is not allowed to write to.

sudo port uninstall ccache
sudo port clean --all ccache
sudo port install ccache

Note that the port clean step is important, otherwise it will use the previous build attempt's configuration and fail due to not finding the ccache executable.

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

Cc: ryandesign@… removed
Owner: set to ryandesign
Status: newassigned
Summary: ccache fails to buildccache fails to build when it is already installed

comment:3 Changed 4 years ago by raimue (Rainer Müller)

Cc: ryandesign@… added
Summary: ccache fails to build when it is already installedccache fails to build

We always set CCACHE_DIR in the configure/build environment, but this path is only allowed in the sandbox if configure.ccache is enabled. The cmake port group always sets configure.ccache no.

If anything in the ccache build picks up CCACHE_DIR and wants to write there, this will lead to the reported situation. But it is still unclear why it would only try this if the ccache port is installed before.

comment:4 Changed 4 years ago by szhorvat (Szabolcs Horvát)

But it is still unclear why it would only try this if the ccache port is installed before.

I guess if ccache is not installed, then it won't be used during compilation, so no problem. Ccache being a compiler cache, it's always optional.

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

Do you have configureccache yes in macports.conf? I do, and I did not see this problem when updating the port. If you don't have configureccache yes, then it would indeed be a bug for it to try to use ccache (and this is not an uncommon problem to encounter; we have needed to fix similar problems in many ports before).

comment:6 Changed 4 years ago by szhorvat (Szabolcs Horvát)

No, I never changed this setting. There is a commented out #configureccache no. Not sure if that counts as a "yes".

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

The default value is no.

comment:8 Changed 4 years ago by szhorvat (Szabolcs Horvát)

@ryandesign Is it generally a problem for MacPorts if a package makes automatic use of ccache during compilation? (Is this what's going wrong here?) If I contribute a port that does this, do I need to patch the package to disable this feature?

We plan to release a new igraph version next week which auto-detects ccache. If would be good to get a head-up before release if this could be an issue for MacPorts.

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

Yes, that's what's going on here, yes, that would be a problem for other ports that do that (you'd probably see the same problem seen in this ticket), yes, the port would need to be patched to prevent it.

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

[4b261ad7677b5b1957f5678b575490dc8f07f309/macports-ports] is an example of us fixing this in another port before.

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

Resolution: fixed
Status: assignedclosed

In 32d9890c3f1636161a2c77a834d59b1263f38406/macports-ports (master):

ccache: Don't use ccache unless requested

Closes: #62245

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

Cc: ryandesign@… removed

Replying to raimue:

The cmake port group always sets configure.ccache no.

Yes but only because it needs to inform cmake how to use ccache via a different method (e.g. -DCMAKE_C_COMPILER_LAUNCHER). Before it has set configure.ccache to no, the portgroup has saved what its original value was.

Note: See TracTickets for help on using tickets.