pip install salt returns 'clang: error: unknow

2019-07-31 11:24发布

问题:

I'm on OSX. I'm installing Salt by following Salt's official guide here and I've ran into a problem. Running 'sudo pip install salt' gives me the following error.

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

I put the entire installation text in this gist. I just want to install salt via pip. Any ideas?

Attempted Solutions used from other overflow questions

  1. I've tried export CFLAGS=-Qunused-arguments and export CPPFLAGS=-Qunused-arguments in sudo bash
  2. I've tried running sudo pip install salt with ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
  3. Updating xcode from 5.1 to 5.1.1, as I read this might be an xcode problem.

All of these return the same exact error. I don't know what to do. I've been hitting my head against this wall for about 2 hours with no resolve. Can someone help please?

回答1:

Try putting the environmental variable assignment after sudo:

sudo ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future" pip install gdal

Or, become root, then do the export:

sudo su - 
export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future" install gdal
pip install ...

It appears that the sudo command does not inherit the environmental variables, and they certainly aren't saved across multiple runs with sudo:

$ export  ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
$ sudo printenv | grep ARCHFLAGS
$