New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`ar` permission errors on OS X 10.11 `El Capitan` with GHC 7.8.4 #2653

Closed
lukehoersten opened this Issue Jun 10, 2015 · 69 comments

Comments

Projects
None yet
@lukehoersten
Member

lukehoersten commented Jun 10, 2015

When running cabal operations, things fail with ar permission errors:

$ cabal install cabal-install
cabal: /usr/bin/ar: permission denied

This started happening after upgrading to OS X 10.11. Running with -v3 does not give any more information including the file that ar is being run on.

$ ls -al `which ar`
-rwxr-xr-x  1 root  wheel  18160 Jun  3 07:10 /usr/bin/ar

Permissions on the ar binary are fine and can be run directly with no issue. I suspect the file ar is being run on doesn't have read permissions.

@begriffs

This comment has been minimized.

Show comment
Hide comment
@begriffs

begriffs Jun 10, 2015

I encountered a similar error a year ago when building on Heroku. Although I don't remember what ultimately solved the problem, one thing you can experiment with is to copy the ar program to a new place (maybe your home directory) then pass --with-ar=/path/to/ar to the build. Just to see if the path itself somehow affects anything.

I encountered a similar error a year ago when building on Heroku. Although I don't remember what ultimately solved the problem, one thing you can experiment with is to copy the ar program to a new place (maybe your home directory) then pass --with-ar=/path/to/ar to the build. Just to see if the path itself somehow affects anything.

@lukehoersten

This comment has been minimized.

Show comment
Hide comment
@lukehoersten

lukehoersten Jun 10, 2015

Member

I tried copying to my home dir and it still had the permission issue.

Member

lukehoersten commented Jun 10, 2015

I tried copying to my home dir and it still had the permission issue.

@lukehoersten

This comment has been minimized.

Show comment
Hide comment
@lukehoersten

lukehoersten Jun 10, 2015

Member

OK something else is going on here: When I use the --with-ar setup it has a new error:
cabal: /usr/bin/gcc: permission denied

@begriffs seems this is more similar to your issue than I thought. Perhaps there's an issue with running commands from /usr/bin.

Member

lukehoersten commented Jun 10, 2015

OK something else is going on here: When I use the --with-ar setup it has a new error:
cabal: /usr/bin/gcc: permission denied

@begriffs seems this is more similar to your issue than I thought. Perhaps there's an issue with running commands from /usr/bin.

@iangcarroll

This comment has been minimized.

Show comment
Hide comment
@iangcarroll

iangcarroll Jun 11, 2015

/usr/bin appears read-only on 10.11.

/usr/bin appears read-only on 10.11.

@lukehoersten

This comment has been minimized.

Show comment
Hide comment
@lukehoersten

lukehoersten Jun 11, 2015

Member

Doesn't look like that's the case for me:
drwxr-xr-x 1068 root wheel 36312 Jun 8 19:31 bin

Also, I'm able to run ar directly just fine. Same with gcc.

Member

lukehoersten commented Jun 11, 2015

Doesn't look like that's the case for me:
drwxr-xr-x 1068 root wheel 36312 Jun 8 19:31 bin

Also, I'm able to run ar directly just fine. Same with gcc.

@Codas

This comment has been minimized.

Show comment
Hide comment
@Codas

Codas Jun 11, 2015

/usr/bin/ar also seems to be affected by the new rootless "feature" introduced in 10.11. sudo chmod +x /usr/bin/ar (just as an example) says I do not have the permissions to modify this file.

However, disabling rootless (sudo nvram boot-args="rootless 0") does not solve the issue with cabal...

Codas commented Jun 11, 2015

/usr/bin/ar also seems to be affected by the new rootless "feature" introduced in 10.11. sudo chmod +x /usr/bin/ar (just as an example) says I do not have the permissions to modify this file.

However, disabling rootless (sudo nvram boot-args="rootless 0") does not solve the issue with cabal...

@lukehoersten

This comment has been minimized.

Show comment
Hide comment
@lukehoersten

lukehoersten Jun 11, 2015

Member

Weirdly I was unable to move the binary with sudo. Is this a part of rootless as well? I've not yet heard of this feature.

Member

lukehoersten commented Jun 11, 2015

Weirdly I was unable to move the binary with sudo. Is this a part of rootless as well? I've not yet heard of this feature.

@samfoy

This comment has been minimized.

Show comment
Hide comment
@samfoy

samfoy Jun 11, 2015

@Codas, are you sure that rootless really got disabled? there has been a bug with disabling it.

samfoy commented Jun 11, 2015

@Codas, are you sure that rootless really got disabled? there has been a bug with disabling it.

@Codas

This comment has been minimized.

Show comment
Hide comment
@Codas

Codas Jun 11, 2015

You were right, rootless was not disabled as I thought it was. The problem is that sudo nvram boot-args="rootless 0" should really be sudo nvram boot-args="rootless=0".

Now everything seems to be working as expected.

Codas commented Jun 11, 2015

You were right, rootless was not disabled as I thought it was. The problem is that sudo nvram boot-args="rootless 0" should really be sudo nvram boot-args="rootless=0".

Now everything seems to be working as expected.

@lukehoersten

This comment has been minimized.

Show comment
Hide comment
@lukehoersten

lukehoersten Jun 11, 2015

Member

sudo nvram boot-args="rootless=0" worked for me as well. So we know what the problem is but now, how to fix this?

Member

lukehoersten commented Jun 11, 2015

sudo nvram boot-args="rootless=0" worked for me as well. So we know what the problem is but now, how to fix this?

@uchuugaka

This comment has been minimized.

Show comment
Hide comment
@uchuugaka

uchuugaka Jun 21, 2015

You have to build to install using components that do not require root access. (and/or file a bug with Apple)

You have to build to install using components that do not require root access. (and/or file a bug with Apple)

@lukehoersten

This comment has been minimized.

Show comment
Hide comment
@lukehoersten

lukehoersten Jun 21, 2015

Member

@uchuugaka can you be more specific about what you mean by "build to install using components that do not require root access"?

Member

lukehoersten commented Jun 21, 2015

@uchuugaka can you be more specific about what you mean by "build to install using components that do not require root access"?

@uchuugaka

This comment has been minimized.

Show comment
Hide comment
@uchuugaka

uchuugaka Jun 21, 2015

Simply disabling rootless isn't enough for everything. Many projects are waking up to realizing they need to find new places they can put things. Directories that are not locked down. I'm still looking into it. macports for example is finding they may need a new directory as their root.

Simply disabling rootless isn't enough for everything. Many projects are waking up to realizing they need to find new places they can put things. Directories that are not locked down. I'm still looking into it. macports for example is finding they may need a new directory as their root.

@lukehoersten

This comment has been minimized.

Show comment
Hide comment
@lukehoersten

lukehoersten Jun 22, 2015

Member

@uchuugaka Disabling rootless is only a workaround until a real fix is implemented. It doesn't sound like filing a bug with Apple is appropriate at this point.

Member

lukehoersten commented Jun 22, 2015

@uchuugaka Disabling rootless is only a workaround until a real fix is implemented. It doesn't sound like filing a bug with Apple is appropriate at this point.

@spicydonuts

This comment has been minimized.

Show comment
Hide comment
@spicydonuts

spicydonuts Jun 30, 2015

sudo nvram boot-args="rootless=0" did the trick for me on 10.11, but I'm not sure if it was a good idea.. haha

sudo nvram boot-args="rootless=0" did the trick for me on 10.11, but I'm not sure if it was a good idea.. haha

@PupaRebbe

This comment has been minimized.

Show comment
Hide comment
@PupaRebbe

PupaRebbe Jul 6, 2015

i had a problem making an alias for X11 in /usr, disabling rootless solved my problem, thanks all

i had a problem making an alias for X11 in /usr, disabling rootless solved my problem, thanks all

@lukehoersten

This comment has been minimized.

Show comment
Hide comment
@lukehoersten

lukehoersten Jul 7, 2015

Member

Rootless: Bans writing to /System, /usr, /bin, /sbin - So far /usr/local isn't write-protected.

Homebrew has to contend with the same thing: Homebrew/legacy-homebrew#40837

Member

lukehoersten commented Jul 7, 2015

Rootless: Bans writing to /System, /usr, /bin, /sbin - So far /usr/local isn't write-protected.

Homebrew has to contend with the same thing: Homebrew/legacy-homebrew#40837

@alexbiehl

This comment has been minimized.

Show comment
Hide comment
@alexbiehl

alexbiehl Jul 11, 2015

Member

I don't understand how write-protection is preventing ar and gcc from being invoked, since we want to execute, not write. Can someone elaborate?

Member

alexbiehl commented Jul 11, 2015

I don't understand how write-protection is preventing ar and gcc from being invoked, since we want to execute, not write. Can someone elaborate?

@notcome

This comment has been minimized.

Show comment
Hide comment
@notcome

notcome Jul 11, 2015

It is strange that cabal install cabal-install works fine on my El Capitan but when I used stack it reported a similar error (see the issue mentioned by @alexbiehl ). Can you give me details about your settings @lukehoersten ?

notcome commented Jul 11, 2015

It is strange that cabal install cabal-install works fine on my El Capitan but when I used stack it reported a similar error (see the issue mentioned by @alexbiehl ). Can you give me details about your settings @lukehoersten ?

@lukehoersten

This comment has been minimized.

Show comment
Hide comment
@lukehoersten

lukehoersten Jul 13, 2015

Member

@notcome settings for what in particular?

Member

lukehoersten commented Jul 13, 2015

@notcome settings for what in particular?

@phadej

This comment has been minimized.

Show comment
Hide comment
@phadej

phadej Jul 13, 2015

Collaborator

@lukehoersten which cabal version do you use / how you installed it (Haskell Platform, directly from binary?). I could try to reproduce and investigate this issue this week, as I get another mac to install El Capitan to.

Collaborator

phadej commented Jul 13, 2015

@lukehoersten which cabal version do you use / how you installed it (Haskell Platform, directly from binary?). I could try to reproduce and investigate this issue this week, as I get another mac to install El Capitan to.

@lukehoersten

This comment has been minimized.

Show comment
Hide comment
@lukehoersten

lukehoersten Jul 13, 2015

Member

Confirmed this is still an issue on the 10.11 Beta (15A216g) version of El Capitan (beta 2):

$ cabal --version
cabal-install version 1.22.4.0
using version 1.22.2.0 of the Cabal library 
Member

lukehoersten commented Jul 13, 2015

Confirmed this is still an issue on the 10.11 Beta (15A216g) version of El Capitan (beta 2):

$ cabal --version
cabal-install version 1.22.4.0
using version 1.22.2.0 of the Cabal library 
@notcome

This comment has been minimized.

Show comment
Hide comment
@notcome

notcome Jul 13, 2015

@lukehoersten It's strange that I cannot reproduce this error. I am using v1.22.0 and El Capitan 15A216g. But when I tried stack a similar error happened. Which version of GHC are you using?

stack + ghc 7.8.4 => permission error
ghc 7.10.1 + cabal 1.22.0 => everything works fine

notcome commented Jul 13, 2015

@lukehoersten It's strange that I cannot reproduce this error. I am using v1.22.0 and El Capitan 15A216g. But when I tried stack a similar error happened. Which version of GHC are you using?

stack + ghc 7.8.4 => permission error
ghc 7.10.1 + cabal 1.22.0 => everything works fine

@lukehoersten

This comment has been minimized.

Show comment
Hide comment
@lukehoersten

lukehoersten Jul 13, 2015

Member

ghc 7.8.4 for me. This could be the problem here. Can you try cabal w/ 7.8.4 and see if you can reproduce?

Member

lukehoersten commented Jul 13, 2015

ghc 7.8.4 for me. This could be the problem here. Can you try cabal w/ 7.8.4 and see if you can reproduce?

@notcome

This comment has been minimized.

Show comment
Hide comment
@notcome

notcome Jul 13, 2015

That's the problem:

➜  ~  export PATH=/Users/LiuMS/Downloads/ghc-7.8.4.app/Contents/bin:/Users/LiuMS/.cabal/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin:/usr/local/FDK/Tools/osx
➜  ~  $PATH
zsh: no such file or directory: /Users/LiuMS/Downloads/ghc-7.8.4.app/Contents/bin:/Users/LiuMS/.cabal/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin:/usr/local/FDK/Tools/osx
➜  ~  ghc -V
The Glorious Glasgow Haskell Compilation System, version 7.8.4
➜  ~  cabal install text
Resolving dependencies...
Configuring text-1.2.1.1...
Failed to install text-1.2.1.1
Build log ( /Users/LiuMS/.cabal/logs/text-1.2.1.1.log ):
[1 of 1] Compiling Main             ( /var/folders/f2/wgwjk8g552d7wch372rh_tq00000gn/T/text-1.2.1.1-2953/text-1.2.1.1/dist/setup/setup.hs, /var/folders/f2/wgwjk8g552d7wch372rh_tq00000gn/T/text-1.2.1.1-2953/text-1.2.1.1/dist/setup/Main.o )
Linking /var/folders/f2/wgwjk8g552d7wch372rh_tq00000gn/T/text-1.2.1.1-2953/text-1.2.1.1/dist/setup/setup ...
Configuring text-1.2.1.1...
setup-Simple-Cabal-1.18.1.5-x86_64-osx-ghc-7.8.4: /usr/bin/ar: permission
denied
cabal: Error: some packages failed to install:
text-1.2.1.1 failed during the configure step. The exception was:
ExitFailure 1

notcome commented Jul 13, 2015

That's the problem:

➜  ~  export PATH=/Users/LiuMS/Downloads/ghc-7.8.4.app/Contents/bin:/Users/LiuMS/.cabal/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin:/usr/local/FDK/Tools/osx
➜  ~  $PATH
zsh: no such file or directory: /Users/LiuMS/Downloads/ghc-7.8.4.app/Contents/bin:/Users/LiuMS/.cabal/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin:/usr/local/FDK/Tools/osx
➜  ~  ghc -V
The Glorious Glasgow Haskell Compilation System, version 7.8.4
➜  ~  cabal install text
Resolving dependencies...
Configuring text-1.2.1.1...
Failed to install text-1.2.1.1
Build log ( /Users/LiuMS/.cabal/logs/text-1.2.1.1.log ):
[1 of 1] Compiling Main             ( /var/folders/f2/wgwjk8g552d7wch372rh_tq00000gn/T/text-1.2.1.1-2953/text-1.2.1.1/dist/setup/setup.hs, /var/folders/f2/wgwjk8g552d7wch372rh_tq00000gn/T/text-1.2.1.1-2953/text-1.2.1.1/dist/setup/Main.o )
Linking /var/folders/f2/wgwjk8g552d7wch372rh_tq00000gn/T/text-1.2.1.1-2953/text-1.2.1.1/dist/setup/setup ...
Configuring text-1.2.1.1...
setup-Simple-Cabal-1.18.1.5-x86_64-osx-ghc-7.8.4: /usr/bin/ar: permission
denied
cabal: Error: some packages failed to install:
text-1.2.1.1 failed during the configure step. The exception was:
ExitFailure 1
@phadej

This comment has been minimized.

Show comment
Hide comment
@phadej

phadej Jul 14, 2015

Collaborator

The issue is probably the same as in: haskell/unix#18

 5545/0x5266:  stat64("/usr/bin/ar\0", 0x102E34370, 0x0)                 = 0 0
 5545/0x5266:  access("/usr/bin/ar\0", 0x4, 0x0)                 = 0 0
 5545/0x5266:  access("/usr/bin/ar\0", 0x2, 0x0)                 = -1 Err#1
Collaborator

phadej commented Jul 14, 2015

The issue is probably the same as in: haskell/unix#18

 5545/0x5266:  stat64("/usr/bin/ar\0", 0x102E34370, 0x0)                 = 0 0
 5545/0x5266:  access("/usr/bin/ar\0", 0x4, 0x0)                 = 0 0
 5545/0x5266:  access("/usr/bin/ar\0", 0x2, 0x0)                 = -1 Err#1
@phadej

This comment has been minimized.

Show comment
Hide comment
@phadej

phadej Jul 14, 2015

Collaborator

I installed ghc-7.8.4 from haskell.org site, and it has unix-2.7.0.1 package, the issue is fixed in 2.7.1.0. Could @notcome and @lukehoersten verify, i.e. check their package databases.

According to https://ghc.haskell.org/trac/ghc/wiki/Commentary/Libraries/VersionHistory there is no way to use 7.8.4 on El Capitan, except if you do special build with bumped unix package.

EDIT I installed binary GHC 7.10.1 and cabal-install, cannot reproduce with that configuration.

Collaborator

phadej commented Jul 14, 2015

I installed ghc-7.8.4 from haskell.org site, and it has unix-2.7.0.1 package, the issue is fixed in 2.7.1.0. Could @notcome and @lukehoersten verify, i.e. check their package databases.

According to https://ghc.haskell.org/trac/ghc/wiki/Commentary/Libraries/VersionHistory there is no way to use 7.8.4 on El Capitan, except if you do special build with bumped unix package.

EDIT I installed binary GHC 7.10.1 and cabal-install, cannot reproduce with that configuration.

@lukehoersten

This comment has been minimized.

Show comment
Hide comment
@lukehoersten

lukehoersten Jul 16, 2015

Member

Confirmed using --constraint=unix>=2.7.1.0 fixes the issue with rootless. Congrats on figuring this out. So I can confirm ghc-7.8.4 works when building cabal-install with --constraint=unix>=2.7.1.0.

Is there a 7.8.4 binary for cabal-install "batteries-included" packages should switch to?

Member

lukehoersten commented Jul 16, 2015

Confirmed using --constraint=unix>=2.7.1.0 fixes the issue with rootless. Congrats on figuring this out. So I can confirm ghc-7.8.4 works when building cabal-install with --constraint=unix>=2.7.1.0.

Is there a 7.8.4 binary for cabal-install "batteries-included" packages should switch to?

@lukehoersten

This comment has been minimized.

Show comment
Hide comment
@lukehoersten

lukehoersten Jul 16, 2015

Member

@phadej how do we make a new cabal-install binary release w/ the latest unix?

Member

lukehoersten commented Jul 16, 2015

@phadej how do we make a new cabal-install binary release w/ the latest unix?

@phadej

This comment has been minimized.

Show comment
Hide comment
@phadej

phadej Jul 16, 2015

Collaborator

I built cabal-install from not so old master (which includes #2633) on Yosemite. Using that binary I can install newer unix-2.7.1.0 and Cabal with

cabal install unix Cabal --global

on El Capitan with GHC 7.8.4. Using that cabal-install I can finally operate normally.

Installing into global database is important to make e.g. stack work, as it doesn't use user database.


The patch mentioned is required, otherwise cabal-install will compile setup using old unix, so even cabal-install itself uses newer one, things don't work.


And this makes next to impossible to bootstrap Haskell on El Capitan with GHC 7.8.4 (you need older osx and there quite many steps). I'd advice to start using 7.10.x there and leave 7.8.4 builds (including stackage lts-2) for Travis or other linux boxes.

Collaborator

phadej commented Jul 16, 2015

I built cabal-install from not so old master (which includes #2633) on Yosemite. Using that binary I can install newer unix-2.7.1.0 and Cabal with

cabal install unix Cabal --global

on El Capitan with GHC 7.8.4. Using that cabal-install I can finally operate normally.

Installing into global database is important to make e.g. stack work, as it doesn't use user database.


The patch mentioned is required, otherwise cabal-install will compile setup using old unix, so even cabal-install itself uses newer one, things don't work.


And this makes next to impossible to bootstrap Haskell on El Capitan with GHC 7.8.4 (you need older osx and there quite many steps). I'd advice to start using 7.10.x there and leave 7.8.4 builds (including stackage lts-2) for Travis or other linux boxes.

@lukehoersten

This comment has been minimized.

Show comment
Hide comment
@lukehoersten

lukehoersten Jul 16, 2015

Member

Some are unable to move to 7.10.x (including myself) due to a handful of reasons. For me there's a 4x performance degradation between 7.8.4 and 7.10.1. If we can produce a new 7.8.4 cabal-install binary then the ghcformacosx project can repackage with that.

Member

lukehoersten commented Jul 16, 2015

Some are unable to move to 7.10.x (including myself) due to a handful of reasons. For me there's a 4x performance degradation between 7.8.4 and 7.10.1. If we can produce a new 7.8.4 cabal-install binary then the ghcformacosx project can repackage with that.

@phadej

This comment has been minimized.

Show comment
Hide comment
@phadej

phadej Jul 16, 2015

Collaborator

@lukehoersten the binary doesn't solve anything. It's important to have Cabal (the-library) package build against newer unix in the global database (not cabal binary from cabal-install, the-tool).

Collaborator

phadej commented Jul 16, 2015

@lukehoersten the binary doesn't solve anything. It's important to have Cabal (the-library) package build against newer unix in the global database (not cabal binary from cabal-install, the-tool).

@lukehoersten

This comment has been minimized.

Show comment
Hide comment
@lukehoersten

lukehoersten Jul 16, 2015

Member

Are you sure it's not both the library and the binary? The binary is usually statically linked against haskell libraries. ghcformacosx, for example, only ships with cabal-install the binary and since it's statically linked against the wrong unix you can't bootstrap up to a later version.

Member

lukehoersten commented Jul 16, 2015

Are you sure it's not both the library and the binary? The binary is usually statically linked against haskell libraries. ghcformacosx, for example, only ships with cabal-install the binary and since it's statically linked against the wrong unix you can't bootstrap up to a later version.

@phadej

This comment has been minimized.

Show comment
Hide comment
@phadej

phadej Jul 16, 2015

Collaborator

You are correct. I'm a bit confused: Sometimes, when cabal configures the package, it builds a setup program, using Cabal the-library (not the one it's built against, but the one which is in the package database) sometimes it doesn't.

The patch #2633, makes cabal-the-tool to work as external setup method when possible, if I understand it right.

And again if my understanding is correct, currently:

  • cabal uses the library when used externally (to build dependencies)
  • and itself - the tool, when used internally (to build a package you are in)

So it might be possible to fetch all dependencies and build them by hand, but that's quite a job.

Collaborator

phadej commented Jul 16, 2015

You are correct. I'm a bit confused: Sometimes, when cabal configures the package, it builds a setup program, using Cabal the-library (not the one it's built against, but the one which is in the package database) sometimes it doesn't.

The patch #2633, makes cabal-the-tool to work as external setup method when possible, if I understand it right.

And again if my understanding is correct, currently:

  • cabal uses the library when used externally (to build dependencies)
  • and itself - the tool, when used internally (to build a package you are in)

So it might be possible to fetch all dependencies and build them by hand, but that's quite a job.

@lukehoersten

This comment has been minimized.

Show comment
Hide comment
@lukehoersten

lukehoersten Jul 16, 2015

Member

According to ghcformacosx/ghc-dot-app#39 (comment), a properly compiled binary cabal-install is all that's needed.

Member

lukehoersten commented Jul 16, 2015

According to ghcformacosx/ghc-dot-app#39 (comment), a properly compiled binary cabal-install is all that's needed.

@phadej

This comment has been minimized.

Show comment
Hide comment
@phadej

phadej Jul 22, 2015

Collaborator

Shortly: No GHC 7.8 for El Capitan. https://ghc.haskell.org/trac/ghc/blog/weekly20150721#MacOSXElCapitansupport

Thus there are no other ways to solve this issue, other than disabling rootless (instructions in the link or above in the thread). Thus this can be closed.

Collaborator

phadej commented Jul 22, 2015

Shortly: No GHC 7.8 for El Capitan. https://ghc.haskell.org/trac/ghc/blog/weekly20150721#MacOSXElCapitansupport

Thus there are no other ways to solve this issue, other than disabling rootless (instructions in the link or above in the thread). Thus this can be closed.

@michaelgwelch

This comment has been minimized.

Show comment
Hide comment
@michaelgwelch

michaelgwelch Oct 6, 2015

I just installed the Haskell Platform 7.10.2-a for OS X 10.11 It's the second download at the download page

I'm seeing the issue reported in this thread:

$ cabal install --dependencies-only --enable-tests
cabal: /usr/bin/ar: permission denied

Just to be clear this is the one I downloaded

I just installed the Haskell Platform 7.10.2-a for OS X 10.11 It's the second download at the download page

I'm seeing the issue reported in this thread:

$ cabal install --dependencies-only --enable-tests
cabal: /usr/bin/ar: permission denied

Just to be clear this is the one I downloaded

@michaelgwelch

This comment has been minimized.

Show comment
Hide comment
@michaelgwelch

michaelgwelch Oct 6, 2015

I'm not sure what is going on. If I run which cabal, I see it's running cabal from ~/Library/Haskell/bin/cabal If I explicitly run /Library/Haskell/ghc-7.10.2-x86_64/bin/cabal install --dependencies-only --enable-tests then it appears to be working.

Both locations show new directories that were added today (when I installed using the new install for 10.11) I'm not sure what should be installed where, or symlinked to other locations.

I guess I can install and make sure I don't have cabal or the rest of the binaries anywhere on my machine and then reinstall.

UPDATE: I checked my .bash_profile and I see that for some reason at some time I added $HOME/Library/Haskell/bin to my path. I assume if I remove that this will fix my problem. Yes, that did resolve my issue.

I'm not sure what is going on. If I run which cabal, I see it's running cabal from ~/Library/Haskell/bin/cabal If I explicitly run /Library/Haskell/ghc-7.10.2-x86_64/bin/cabal install --dependencies-only --enable-tests then it appears to be working.

Both locations show new directories that were added today (when I installed using the new install for 10.11) I'm not sure what should be installed where, or symlinked to other locations.

I guess I can install and make sure I don't have cabal or the rest of the binaries anywhere on my machine and then reinstall.

UPDATE: I checked my .bash_profile and I see that for some reason at some time I added $HOME/Library/Haskell/bin to my path. I assume if I remove that this will fix my problem. Yes, that did resolve my issue.

@gbaz

This comment has been minimized.

Show comment
Hide comment
@gbaz

gbaz Oct 6, 2015

Collaborator

Yes, I think that's correct. We should probably warn against that issue -- I think prior platforms added that back in the past before the current symlink approach. Thanks for the feedback!

Collaborator

gbaz commented Oct 6, 2015

Yes, I think that's correct. We should probably warn against that issue -- I think prior platforms added that back in the past before the current symlink approach. Thanks for the feedback!

@michaelgwelch

This comment has been minimized.

Show comment
Hide comment
@michaelgwelch

michaelgwelch Oct 6, 2015

@gbaz just to follow up, now when I type which cabal I do see it's running usr/local/bin/cabal as expected and that is symlinked to the location in /Library/Haskell that I mentioned above. Everything looks good.

@gbaz just to follow up, now when I type which cabal I do see it's running usr/local/bin/cabal as expected and that is symlinked to the location in /Library/Haskell that I mentioned above. Everything looks good.

@edsko

This comment has been minimized.

Show comment
Hide comment
@edsko

edsko Oct 16, 2015

Contributor

For the benefit of other people finding this thread: no idea why, but the nvram invocation did not solve the problem for me; disabling system integrity protection in recovery mode however did.

Contributor

edsko commented Oct 16, 2015

For the benefit of other people finding this thread: no idea why, but the nvram invocation did not solve the problem for me; disabling system integrity protection in recovery mode however did.

@dogweather

This comment has been minimized.

Show comment
Hide comment
@dogweather

dogweather Nov 6, 2015

So for someone new to Haskell on the Mac (e.g. me), what should one do?

I hit this error after installing http://ghcformacosx.github.io/ and then running cabal run in a project folder.

So for someone new to Haskell on the Mac (e.g. me), what should one do?

I hit this error after installing http://ghcformacosx.github.io/ and then running cabal run in a project folder.

@gbaz

This comment has been minimized.

Show comment
Hide comment
@gbaz

gbaz Nov 6, 2015

Collaborator

If you're using ghc for mac os x, you can download the fixed cabal binary from here: https://www.dropbox.com/s/rvvjlcmd85yyvy5/cabal?dl=0

You can also run stack install cabal-install apparently, to build your own fixed cabal.

The ghcformacosx ticket tracking this is here: ghcformacosx/ghc-dot-app#41

Also note that the current haskell platform ships the proper cabal.

Collaborator

gbaz commented Nov 6, 2015

If you're using ghc for mac os x, you can download the fixed cabal binary from here: https://www.dropbox.com/s/rvvjlcmd85yyvy5/cabal?dl=0

You can also run stack install cabal-install apparently, to build your own fixed cabal.

The ghcformacosx ticket tracking this is here: ghcformacosx/ghc-dot-app#41

Also note that the current haskell platform ships the proper cabal.

@nrolland

This comment has been minimized.

Show comment
Hide comment
@nrolland

nrolland Nov 6, 2015

Hi, if you are a newcomer I would really advise you to use stack as it pins
down more things, and does not pollute global environment.

On Friday, November 6, 2015, Robb Shecter notifications@github.com wrote:

So for someone new to Haskell on the Mac (e.g. me), what should one do?

I hit this error after installing http://ghcformacosx.github.io/ and then
running cabal run in a project folder.


Reply to this email directly or view it on GitHub
#2653 (comment).

Nicolas Rolland
mobile : +33 6 62 88 42 92

nrolland commented Nov 6, 2015

Hi, if you are a newcomer I would really advise you to use stack as it pins
down more things, and does not pollute global environment.

On Friday, November 6, 2015, Robb Shecter notifications@github.com wrote:

So for someone new to Haskell on the Mac (e.g. me), what should one do?

I hit this error after installing http://ghcformacosx.github.io/ and then
running cabal run in a project folder.


Reply to this email directly or view it on GitHub
#2653 (comment).

Nicolas Rolland
mobile : +33 6 62 88 42 92

@adinapoli

This comment has been minimized.

Show comment
Hide comment
@adinapoli

adinapoli Nov 10, 2015

My experience was the same as @edsko : Disabling SIP in recovery mode (following the guide he posted) solved the issue for me.

My experience was the same as @edsko : Disabling SIP in recovery mode (following the guide he posted) solved the issue for me.

@carlosacp

This comment has been minimized.

Show comment
Hide comment
@carlosacp

carlosacp Dec 3, 2015

running

$ stack install cabal-install
…
$ hash -r

from ghcformacosx/ghc-dot-app#41

fix

running

$ stack install cabal-install
…
$ hash -r

from ghcformacosx/ghc-dot-app#41

fix

@dagit

This comment has been minimized.

Show comment
Hide comment
@dagit

dagit Dec 9, 2015

Collaborator

Documenting my solution here for future generations:

  1. Install both ghc 7.8.4 and ghc 7.10.x, but below I assume ghc defaults to 7.8.4. That is the case on my system because I installed 7.8.4 more recently than 7.10.x.
  2. cabal update && cabal unpack process directory unix
  3. go into each of those packages (the order I used was directory, then unix, then process) and type ghc-7.10.x --make Setup.hs && ./Setup configure --with-ghc=ghc-7.8.4 && ./Setup build --with-ghc=ghc-7.8.4 && ./Setup copy && ./Setup register. The goal of that command is to use 7.10 to build Setup.hs but then use ghc-7.8.4 to build/register the packages. You'll know you've done it correctly when ghc-pkg-7.8.4 list | grep unix lists 2.7.1.0.
  4. cabal install Cabal
  5. use ghc-pkg-7.8.4 describe Cabal to make sure it depends on the correct version of unix (needs to be at least 2.7.1.0).

At this point I was able to use 7.8.4 as normal.

Thanks to @glguy for suggesting the trick with Setup.hs.

Collaborator

dagit commented Dec 9, 2015

Documenting my solution here for future generations:

  1. Install both ghc 7.8.4 and ghc 7.10.x, but below I assume ghc defaults to 7.8.4. That is the case on my system because I installed 7.8.4 more recently than 7.10.x.
  2. cabal update && cabal unpack process directory unix
  3. go into each of those packages (the order I used was directory, then unix, then process) and type ghc-7.10.x --make Setup.hs && ./Setup configure --with-ghc=ghc-7.8.4 && ./Setup build --with-ghc=ghc-7.8.4 && ./Setup copy && ./Setup register. The goal of that command is to use 7.10 to build Setup.hs but then use ghc-7.8.4 to build/register the packages. You'll know you've done it correctly when ghc-pkg-7.8.4 list | grep unix lists 2.7.1.0.
  4. cabal install Cabal
  5. use ghc-pkg-7.8.4 describe Cabal to make sure it depends on the correct version of unix (needs to be at least 2.7.1.0).

At this point I was able to use 7.8.4 as normal.

Thanks to @glguy for suggesting the trick with Setup.hs.

@nrolland

This comment has been minimized.

Show comment
Hide comment
@nrolland

nrolland Dec 9, 2015

@dagit future generations will be proud of us struggling haskellers

nrolland commented Dec 9, 2015

@dagit future generations will be proud of us struggling haskellers

@mcandre

This comment has been minimized.

Show comment
Hide comment

mcandre commented Dec 29, 2015

+1

@reeze reeze referenced this issue Jan 11, 2016

Closed

epub format #74

@mcandre

This comment has been minimized.

Show comment
Hide comment
@mcandre

mcandre Jan 16, 2016

Workaround:

$ brew update
$ brew upgrade ghc
$ brew unlink cabal-install
$ brew install cabal-install --constraint=unix>=2.7.1.0
$ brew link --overwrite cabal-install

System:

$ specs haskell os
specs haskell os
specs --version
0.21

cabal --version
cabal-install version 1.20.0.3
using version 1.20.0.2 of the Cabal library 

ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.10.3

system_profiler SPSoftwareDataType | grep 'System Version'
    System Software Overview:
      System Version: OS X 10.11.2 (15C50)
      System Integrity Protection: Enabled

mcandre commented Jan 16, 2016

Workaround:

$ brew update
$ brew upgrade ghc
$ brew unlink cabal-install
$ brew install cabal-install --constraint=unix>=2.7.1.0
$ brew link --overwrite cabal-install

System:

$ specs haskell os
specs haskell os
specs --version
0.21

cabal --version
cabal-install version 1.20.0.3
using version 1.20.0.2 of the Cabal library 

ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.10.3

system_profiler SPSoftwareDataType | grep 'System Version'
    System Software Overview:
      System Version: OS X 10.11.2 (15C50)
      System Integrity Protection: Enabled
@backus

This comment has been minimized.

Show comment
Hide comment
@backus

backus Jan 16, 2016

Thanks @mcandre that worked for me

backus commented Jan 16, 2016

Thanks @mcandre that worked for me

@creswick

This comment has been minimized.

Show comment
Hide comment
@creswick

creswick Jan 23, 2016

@dagit and @mcandre 's solutions both seemed to work for me, until I tried to install something with a custom Setup.hs (I think). eg: HDBC-postgresql-2.3.2.3, which failed with the ar problem.

@dagit and @mcandre 's solutions both seemed to work for me, until I tried to install something with a custom Setup.hs (I think). eg: HDBC-postgresql-2.3.2.3, which failed with the ar problem.

@dagit

This comment has been minimized.

Show comment
Hide comment
@dagit

dagit Jan 23, 2016

Collaborator

@creswick What is the output of ghc-pkg-7.8.4 describe Cabal on your system? If their Setup.hs pulls in the wrong version of unix that could explain the failure there.

Collaborator

dagit commented Jan 23, 2016

@creswick What is the output of ghc-pkg-7.8.4 describe Cabal on your system? If their Setup.hs pulls in the wrong version of unix that could explain the failure there.

@creswick

This comment has been minimized.

Show comment
Hide comment
@23Skidoo

This comment has been minimized.

Show comment
Hide comment
@23Skidoo

23Skidoo Jan 23, 2016

Member

@creswick Yes, it looks like the version of Cabal you have installed is built against unix-2.7.0.1. The issue was fixed in unix-2.7.1.0.

Member

23Skidoo commented Jan 23, 2016

@creswick Yes, it looks like the version of Cabal you have installed is built against unix-2.7.0.1. The issue was fixed in unix-2.7.1.0.

@creswick

This comment has been minimized.

Show comment
Hide comment
@creswick

creswick Jan 26, 2016

@23Skidoo @dagit thanks! This seemed to work:

$ cd && cabal --no-require-sandbox install Cabal --reinstall --force-reinstalls

@23Skidoo @dagit thanks! This seemed to work:

$ cd && cabal --no-require-sandbox install Cabal --reinstall --force-reinstalls
@Blaisorblade

This comment has been minimized.

Show comment
Hide comment
@Blaisorblade

Blaisorblade Jul 9, 2016

Collaborator

Trying to do this now, without ever disabling SIP. I'd guess disabling SIP, upgrading unix and Cabal in the global database and reenabling SIP is easiest, but involves rebooting, so I plan using this: #2653 (comment).

| tried other solutions but had trouble:

@gbaz wrote:

If you're using ghc for mac os x, you can download the fixed cabal binary from here: https://www.dropbox.com/s/rvvjlcmd85yyvy5/cabal?dl=0

Thanks, but that's not enough, because one also needs a fixed Cabal in the package database.

@mcandre wrote:

$ brew install cabal-install --constraint=unix>=2.7.1.0

brew ignores constraints, and without quotes the > is read as a shell redirection. At least that will typically give a prebuilt working cabal-install binary.

@phadej wrote:

You are correct. I'm a bit confused: Sometimes, when cabal configures the package, it builds a setup program, using Cabal the-library (not the one it's built against, but the one which is in the package database) sometimes it doesn't.

I think the "sometimes" might depend on ~/.cabal/setup-exe-cache/, which caches prebuild default Setup.hs — I have setup-Configure-Cabal-1.18.1.5-x86_64-osx-ghc-7.8.4 in there, still built using the wrong unix version.

Collaborator

Blaisorblade commented Jul 9, 2016

Trying to do this now, without ever disabling SIP. I'd guess disabling SIP, upgrading unix and Cabal in the global database and reenabling SIP is easiest, but involves rebooting, so I plan using this: #2653 (comment).

| tried other solutions but had trouble:

@gbaz wrote:

If you're using ghc for mac os x, you can download the fixed cabal binary from here: https://www.dropbox.com/s/rvvjlcmd85yyvy5/cabal?dl=0

Thanks, but that's not enough, because one also needs a fixed Cabal in the package database.

@mcandre wrote:

$ brew install cabal-install --constraint=unix>=2.7.1.0

brew ignores constraints, and without quotes the > is read as a shell redirection. At least that will typically give a prebuilt working cabal-install binary.

@phadej wrote:

You are correct. I'm a bit confused: Sometimes, when cabal configures the package, it builds a setup program, using Cabal the-library (not the one it's built against, but the one which is in the package database) sometimes it doesn't.

I think the "sometimes" might depend on ~/.cabal/setup-exe-cache/, which caches prebuild default Setup.hs — I have setup-Configure-Cabal-1.18.1.5-x86_64-osx-ghc-7.8.4 in there, still built using the wrong unix version.

@gbaz

This comment has been minimized.

Show comment
Hide comment
@gbaz

gbaz Jul 10, 2016

Collaborator

Thanks, but that's not enough, because one also needs a fixed Cabal in the package database.

Isn't it enough to just install the cabal binary (you can get it here now btw: https://www.haskell.org/cabal/release/cabal-install-1.24.0.0/cabal-install-1.24.0.0-x86_64-apple-darwin-yosemite.tar.gz ) and then install the Cabal library using that binary?

Collaborator

gbaz commented Jul 10, 2016

Thanks, but that's not enough, because one also needs a fixed Cabal in the package database.

Isn't it enough to just install the cabal binary (you can get it here now btw: https://www.haskell.org/cabal/release/cabal-install-1.24.0.0/cabal-install-1.24.0.0-x86_64-apple-darwin-yosemite.tar.gz ) and then install the Cabal library using that binary?

@Blaisorblade

This comment has been minimized.

Show comment
Hide comment
@Blaisorblade

Blaisorblade Jul 10, 2016

Collaborator

I got this working with @dagit's suggestion (with slight changes)!

Corrections:

  • I checked with cabal install unix Cabal --global --dry-run that the plan involved no reinstalls.
  • Following that plan, I installed unix, directory, then process
  • Following other tips, I installed Cabal globally to be able to use Stack.
  • if you use Stack, you must override in extra-deps the versions of unix, Cabal, directory and process. They need not be the ones you installed (the package you’re building might dislike that); but none can match the ones shipped with GHC, because even Stack can’t cope with two versions of the same package with different dependencies.
  • I had GHC 8.0.1 instead of 7.10 around, and it still worked — though building Cabal felt slow as hell when I watched (probably still reasonable though).
cabal unpack process directory unix
newver=8.0.1
for i in unix directory process; do
  (cd $i-* && ghc-$newver --make Setup.hs && ./Setup configure --with-ghc=ghc-7.8.4 && ./Setup build --with-ghc=ghc-7.8.4 && ./Setup copy && ./Setup register)
done
cabal install Cabal --global

Output w/ versions:

$ cabal install unix Cabal --global --dry-run
Resolving dependencies...
In order, the following would be installed (use -v for more details):
unix-2.7.2.0
directory-1.2.6.3
process-1.4.2.0
Cabal-1.24.0.0
$ cabal unpack process directory unix
Downloading process-1.4.2.0...
Unpacking to process-1.4.2.0/
Downloading directory-1.2.6.3...
Unpacking to directory-1.2.6.3/
Unpacking to unix-2.7.2.0/
Collaborator

Blaisorblade commented Jul 10, 2016

I got this working with @dagit's suggestion (with slight changes)!

Corrections:

  • I checked with cabal install unix Cabal --global --dry-run that the plan involved no reinstalls.
  • Following that plan, I installed unix, directory, then process
  • Following other tips, I installed Cabal globally to be able to use Stack.
  • if you use Stack, you must override in extra-deps the versions of unix, Cabal, directory and process. They need not be the ones you installed (the package you’re building might dislike that); but none can match the ones shipped with GHC, because even Stack can’t cope with two versions of the same package with different dependencies.
  • I had GHC 8.0.1 instead of 7.10 around, and it still worked — though building Cabal felt slow as hell when I watched (probably still reasonable though).
cabal unpack process directory unix
newver=8.0.1
for i in unix directory process; do
  (cd $i-* && ghc-$newver --make Setup.hs && ./Setup configure --with-ghc=ghc-7.8.4 && ./Setup build --with-ghc=ghc-7.8.4 && ./Setup copy && ./Setup register)
done
cabal install Cabal --global

Output w/ versions:

$ cabal install unix Cabal --global --dry-run
Resolving dependencies...
In order, the following would be installed (use -v for more details):
unix-2.7.2.0
directory-1.2.6.3
process-1.4.2.0
Cabal-1.24.0.0
$ cabal unpack process directory unix
Downloading process-1.4.2.0...
Unpacking to process-1.4.2.0/
Downloading directory-1.2.6.3...
Unpacking to directory-1.2.6.3/
Unpacking to unix-2.7.2.0/
@Blaisorblade

This comment has been minimized.

Show comment
Hide comment
@Blaisorblade

Blaisorblade Jul 10, 2016

Collaborator

Isn't it enough to just install the cabal binary and then install the Cabal library using that binary?

@gbaz Not quite (for me and with the previous binary), because the Setup binary would link against the existing unix library. That's even if you install unix and then Cabal, the setup of unix fails—I tried.

It might help if you had a newer version of unix already installed even in the user database (or if you install the newer Cabal with SIP disabled, but I'll trust you didn't miss that), but I did this from scratch with a GHC from https://ghcformacosx.github.io/.

Collaborator

Blaisorblade commented Jul 10, 2016

Isn't it enough to just install the cabal binary and then install the Cabal library using that binary?

@gbaz Not quite (for me and with the previous binary), because the Setup binary would link against the existing unix library. That's even if you install unix and then Cabal, the setup of unix fails—I tried.

It might help if you had a newer version of unix already installed even in the user database (or if you install the newer Cabal with SIP disabled, but I'll trust you didn't miss that), but I did this from scratch with a GHC from https://ghcformacosx.github.io/.

@Blaisorblade

This comment has been minimized.

Show comment
Hide comment
@Blaisorblade

Blaisorblade Jul 10, 2016

Collaborator

@gbaz I partially retract; your suggestion might work with cabal-install 1.24 (not the Dropbox version) because it includes 03b02fb, fixing #2633, as @phadej earlier explained. I haven't tried, but based on #2653 (comment) it should work.

EDIT: it worked, as long as I install unix too with cabal install unix Cabal --global. Thanks!

Collaborator

Blaisorblade commented Jul 10, 2016

@gbaz I partially retract; your suggestion might work with cabal-install 1.24 (not the Dropbox version) because it includes 03b02fb, fixing #2633, as @phadej earlier explained. I haven't tried, but based on #2653 (comment) it should work.

EDIT: it worked, as long as I install unix too with cabal install unix Cabal --global. Thanks!

bwbaugh added a commit to bwbaugh/codingame that referenced this issue Oct 6, 2016

Change GHC to workaround OS X issue
haskell/cabal#2653

    setup-Simple-Cabal-1.18.1.5-ghc-7.8.4: /usr/bin/ar: permission denied

y-kamiya added a commit to y-kamiya/strips-haskell that referenced this issue Nov 13, 2016

abhinav added a commit to abhinav/pinch that referenced this issue Jan 12, 2017

Fix `ar` permission issue for 7.8 on OSX
We can probably just drop support for 7.8 in a future version.

Related: haskell/cabal#2653 (comment)

@WillSewell WillSewell referenced this issue Nov 29, 2017

Merged

Update deps #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment