Creating Opam switch fails

Hello,
im trying to create a new opam switch but i get the following error:

Im on a M2 Macbook with Asahi Fedora

Does anybody know how to fix it?

The end of the config.log file in ~/.opam/cs3110-2025sp/.opam-switch/build/ocaml-base-compiler.5.2.0 should tell you which command exactly failed, but it looks like your local gcc isn’t able to compile object files somehow.
Are you sure you installed the gcc package? Maybe you’re somehow missing the glibc-devel package?

1 Like


gcc and glibc-devel are both installed

There’s a ccache: error: Read-only file system here that is likely the cause of your problems.

1 Like

ok, can you tell me how i fix this error?

Not without searching the internet, otherwise I would have told you :–) Basically try to look where the ccache tool writes and why this file location is read-only.

1 Like

Is “ccache” enabled by default on macos ? Or is this a macos-specific thing called “ccache” that’s different from the “ccache” of https://ccache.dev/ ?

ETA: I think I’m addressing this question to Felix, not @dbuenzli … sorry. It looks like you’re installing Opam for a class ? Does this mean that other classmates are doing the same? Does anybody else have the same error? Or does anbody with similar hardware -not- have the same error?

Also, it would still be worth posting the config.log (or at least, the bottom end of it), so we can see what the actual failing operation was. That is to say, the -log itself- and not the summary of what the configure script made of the log.

Sorry I see you did post the tail of the config.log.

1 Like

He’s running Asahi Fedora

1 Like

oh geez, I saw the macbook air at the top, didn’t see the Fedora at the bottom. My eyes are going. Sorry.

1 Like

Do you have any ccache related environment variable set up? Do you also have the ccache binary installed?

env | grep -i ccache
command -v ccache
1 Like

oops. that was my mistake. tysm

What was the issue from? Ccache is supposed to work in the opam sandbox, we have special support for it (see here)

i didnt have a ccache related environment variable set up. thats it. after setting it up it worked

Next time, if you can, please copy-paste the logs in a code block rather than sharing screenshots.

1 Like