macos 无法安装 Orange:“错误:命令‘clang’失败,退出状态为 1”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10238458/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 09:06:26  来源:igfitidea点击:

Can't install Orange: "error: command 'clang' failed with exit status 1"

pythonmacosgccorange

提问by Steve L

I am trying to install Orangeon my Mac OS X 10.7.3 (Lion) and I keep getting an error when using either pip or building from source. First, I was getting an error that read:

我正在尝试在我的 Mac OS X 10.7.3 (Lion) 上安装Orange,但在使用 pip 或从源代码构建时不断收到错误消息。首先,我收到一个错误消息:

error: command 'gcc-4.0' failed with exit status 1

I have Xcode 4, which comes bundled with gcc 4.2.1. So I installed 64-bit/32-bit Python 2.7.3, which has gcc 4.2 built in. I also tried to override the compiler choice using:

我有 Xcode 4,它与 gcc 4.2.1 捆绑在一起。所以我安装了64-bit/32-bit Python 2.7.3,它内置了 gcc 4.2。我还尝试使用以下方法覆盖编译器选择:

export CC=gcc-4.2

But this produced a different error:

但这产生了不同的错误:

gcc-4.2 not found, using clang instead
...
error: command 'clang' failed with exit status 1

Here is the full log:

这是完整的日志:

$ python setup.py build
running build
running build_py
copying Orange/version.py -> build/lib.macosx-10.6-intel-2.7/Orange
running build_ext
gcc-4.2 not found, using clang instead
building 'Orange.orange' extension
running pyxtract for Orange.orange
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python ../pyxtract/defvectors.py
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python ../pyxtract/pyprops.py -n orange
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python ../pyxtract/pyxtract.py -m -n orange lib_kernel.cpp lib_components.cpp lib_preprocess.cpp lib_learner.cpp lib_io.cpp lib_vectors.cpp cls_example.cpp cls_value.cpp cls_orange.cpp cls_misc.cpp functions.cpp orange.cpp
Parsing lib_kernel.cpp
Parsing lib_components.cpp
Parsing lib_preprocess.cpp
Parsing lib_learner.cpp
Parsing lib_io.cpp
Parsing lib_vectors.cpp
Parsing cls_example.cpp
Parsing cls_value.cpp
Parsing cls_orange.cpp
Parsing cls_misc.cpp
Parsing functions.cpp
Parsing orange.cpp
Warning: class 'PearsonCorrelation' will not be picklable
Warning: class 'ItemsetNodeProxy' will not be picklable
clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -INone -Isource/include -Isource/orange/liblinear -Isource/orange/ppp -Isource/orange/px -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c source/orange/assoc.cpp -o build/temp.macosx-10.6-intel-2.7/source/orange/assoc.o -fPIC -fpermissive -fno-common -w -DDARWIN -DORANGE_EXPORTS
clang: warning: argument unused during compilation: '-fpermissive'
In file included from source/orange/assoc.cpp:25:
In file included from source/orange/random.hpp:26:
In file included from source/orange/root.hpp:25:
source/orange/garbage.hpp:221:9: error: use of undeclared identifier 'raiseError'
        raiseError("bad cast from %s to %s", typeid(U).name(), typeid(T).name());
        ^
source/orange/garbage.hpp:253:7: error: use of undeclared identifier 'raiseError'
      raiseError("Orange internal error: NULL pointer to '%s'", TYPENAME(typeid(T)));
      ^
source/orange/garbage.hpp:261:7: error: use of undeclared identifier 'raiseError'
      raiseError("Orange internal error: NULL pointer to '%s'", TYPENAME(typeid(T)));
      ^
source/orange/garbage.hpp:301:7: error: use of undeclared identifier 'raiseError'
      raiseError("Orange internal error: NULL pointer to '%s'", TYPENAME(typeid(T)));
      ^
source/orange/garbage.hpp:312:7: error: use of undeclared identifier 'raiseError'
      raiseError("Orange internal error: NULL pointer to '%s'", TYPENAME(typeid(T)));
      ^
In file included from source/orange/assoc.cpp:27:
source/orange/examplegen.hpp:143:38: error: expected member name or ';' after declaration specifiers
  TExampleIterator::TExampleIterator(const TExampleIterator &other);
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
source/orange/examplegen.hpp:143:38: error: expected ')'
source/orange/examplegen.hpp:143:37: note: to match this '('
  TExampleIterator::TExampleIterator(const TExampleIterator &other);
                                    ^
source/orange/assoc.cpp:33:1: error: explicit specialization of 'st_classDescription' after instantiation
DEFINE_TOrangeVector_classDescription(PAssociationRule, "TAssociationRules", true, ORANGE_API)
^
source/orange/orvector.hpp:105:57: note: expanded from macro 'DEFINE_TOrangeVector_classDescription'
    TClassDescription TOrangeVector< _TYPE, _WRAPPED >::st_classDescription = { _NAME, &typeid(TOrangeVector< _TYPE, _WRAPPED >), &TOrange::st_classDescription, TOrange_properties, TOrange_components };
                                                        ^
source/orange/ppp/assoc.ppp:111:72: note: implicit instantiation first required here
  {"rules", "association rules", &typeid(POrange), &TAssociationRules::st_classDescription, offsetof(TAssociationClassifier, rules), false, false, 0},
                                                                       ^
8 errors generated.
error: command 'clang' failed with exit status 1

回答by Steve L

Problem solved: Xcode 4 doesn't actually come with gcc-4.2; it comes with the new LLVM compilers.

问题已解决:Xcode 4 实际上并未附带 gcc-4.2;它带有新的 LLVM 编译器。

It was just a matter of doing:

这只是一个问题:

export CC=llvm-gcc-4.2
export CXX=llvm-g++-4.2

then building Orange.

然后建造橙色。

回答by David J.

From http://orange.biolab.si/forum/viewtopic.php?f=4&t=1568

来自http://orange.biolab.si/forum/viewtopic.php?f=4&t=1568

export CC=gcc
export CXX=g++
pip install orange # for example

It seems more robust to not have to get into version number details if you don't have to, right? (I have not had to do this sort of thing before, so I don't know for sure.)

如果您不需要,则不必进入版本号详细信息似乎更可靠,对吗?(我以前没有做过这种事情,所以我不确定。)

Update: The pip install orangeexample (above) currently installs an older version of Orange (version 2.5a4 ) instead of 2.6. To get the development version, use:

更新pip install orange示例(上图)当前安装的是旧版本的 Orange(版本 2.5a4 )而不是 2.6。要获取开发版本,请使用:

pip install -e hg+https://bitbucket.org/biolab/orange#egg=Orange

I got the above command from here.

我从这里得到了上面的命令。