2

A bit of an irritating problem with pip on OSX. A python program I am trying to install requires GCC.

The suggested invocation is:

env CC=/usr/local/bin/gcc-6 pip install angr 

However this results in an error suggested OSX decided to run CLANG instead:

clang: error: unknown argument: '-malign-double'

This makes sense since:

$ env CC
clang: error: no input files

Despite the fact that:

$env 
...
cc=/usr/local/bin/gcc-6
CC=/usr/local/bin/gcc-6

Of course I tried:

$CC-/usr/local/bin/gcc-6 
env $CC pip install angr 

but of course:

$ env $CC pip install angr
gcc-6: error: pip: No such file or directory
gcc-6: error: install: No such file or directory
gcc-6: error: angr: No such file or directory
gcc-6: fatal error: no input files

and despite what env tells me just running

$ pip install angr 

results in more

clang: error: unknown argument: '-malign-double'

So what am I missing here? Does OSX hate GCC that bad or is there some basic shell fu I am missing out on here?

Patrick Trentin
  • 7,126
  • 3
  • 23
  • 40
MrSynAckSter
  • 1,681
  • 1
  • 18
  • 34
  • Did you try putting that within quotes, `env CC="/usr/local/bin/gcc-6 pip install angr"`, without the same the value may not be exported properly – Inian Apr 02 '17 at 05:56
  • That command also does not work. – MrSynAckSter Apr 03 '17 at 00:44
  • @baordog, did you find a solution? – luizv Oct 12 '17 at 23:43
  • I ended up giving up and running it on Linux. I might try the below example when I next need to use Angr on OSX. It really has too many customizations to play nicely outside a sandbox, from what I've seen. – MrSynAckSter Oct 21 '17 at 00:32

1 Answers1

4

Your test command env $CC pip install angr fails because the dollar sign evaluates the variable and it effectively ran gcc rather than pip!

Inian's suggested command env CC="/usr/local/bin/gcc-6 pip install angr" has the closing quote in the wrong place, making it a no-op.

The syntax for env CC=/usr/local/bin/gcc-6 pip install angr is correct, but the gcc error could be in angr or any of the 26 packages it depends on such as ana, bintrees, cachetools, capstone, cooldict, z3-solver...

So let's get back to clang. Looking at angr issues on github, it appears that a clang-incompatibility for z3-solver was fixed on May 10th, a month after this question was posted. See: https://github.com/Z3Prover/z3/issues/1016

So this now works fine for me with the latest pip (pip install --upgrade pip) on macOS 10.13 High Sierra + Xcode 9.0.1:

pip install --user angr

Well, the above command actually defaults to using binary packages so of course it works. With 10 minutes, you can verify that the compiled path works with clang by uninstalling all pips then:

pip install --user --no-cache-dir --no-binary :all: angr
jdonald
  • 670
  • 7
  • 15