“未知类型名称'decltype'":在Mac上安装pyicu失败,出现gcc错误 [英] "unknown type name 'decltype'": Installing pyicu on mac failed, with gcc error

查看:153
本文介绍了“未知类型名称'decltype'":在Mac上安装pyicu失败,出现gcc错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行了以下命令(因为我的Mac上同时拥有python2和python3):

I ran the following command (because I have both python2 and python3 on my mac):

$ CFLAGS = -I/usr/local/opt/icu4c/include LDFLAGS = -L/usr/local/opt/icu4c/lib sudo python3 -m pip install pyicu

$ CFLAGS=-I/usr/local/opt/icu4c/include LDFLAGS=-L/usr/local/opt/icu4c/lib sudo python3 -m pip install pyicu

错误信息如下:

安装收集的软件包:pyicu 正在运行setup.py install for pyicu ...错误 来自命令/anaconda3/bin/python3 -u -c"import setuptools,tokenize; 文件 ='/private/tmp/pip-build-l71tm0m4/pyicu/setup.py'; f =的完整输出getattr(tokenize,'open',open)(文件); code = f.read().replace('\ r \ n','\ n'); f.close(); exec(compile(code, file ,'exec'))"install --record/tmp/pip-7298jccr-record/install-record.txt --single-version-externally-编译:

Installing collected packages: pyicu Running setup.py install for pyicu ... error Complete output from command /anaconda3/bin/python3 -u -c "import setuptools, tokenize;file='/private/tmp/pip-build-l71tm0m4/pyicu/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-7298jccr-record/install-record.txt --single-version-externally-managed --compile:

Building PyICU 2.0.3 for ICU 58.2

Adding CXXFLAGS="-I/anaconda3/include" from /anaconda3/bin/icu-config
Adding LDFLAGS="-Wl,-rpath,/anaconda3/lib -L/anaconda3/lib -licui18n -licuuc -licudata" from /anaconda3/bin/icu-config
running install
running build
running build_py
creating build
creating build/lib.macosx-10.7-x86_64-3.6
copying PyICU.py -> build/lib.macosx-10.7-x86_64-3.6
creating build/lib.macosx-10.7-x86_64-3.6/icu
copying icu/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/icu
running build_ext
building '_icu' extension
creating build/temp.macosx-10.7-x86_64-3.6
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -I/anaconda3/include/python3.6m -c _icu.cpp -o build/temp.macosx-10.7-x86_64-3.6/_icu.o -DPYICU_VER="2.0.3" -I/anaconda3/include
In file included from _icu.cpp:27:
./common.h:38:13: error: unknown type name 'decltype'
    typedef decltype(nullptr) nullptr_t;
            ^
./common.h:38:30: error: expected ';' after top level declarator
    typedef decltype(nullptr) nullptr_t;
                             ^
                             ;
2 errors generated.
error: command 'gcc' failed with exit status 1

----------------------------------------

命令"/anaconda3/bin/python3 -u -c"导入设置工具,标记化; 文件 ='/private/tmp/pip-build-l71tm0m4/pyicu/setup.py'; f = getattr(令牌,'打开',打开)(文件);代码= f.read().replace('\ r \ n','\ n'); f.close() ; exec(compile(code, file ,'exec'))"install --record/tmp/pip-7298jccr-record/install-record.txt --single-version-externally- -compile"失败,错误代码为/private/tmp/pip-build-l71tm0m4/pyicu/

Command "/anaconda3/bin/python3 -u -c "import setuptools, tokenize;file='/private/tmp/pip-build-l71tm0m4/pyicu/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-7298jccr-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-l71tm0m4/pyicu/

推荐答案

根据@ n.m.,需要将-std=c++11添加到CFLAGS.

According to @n.m., -std=c++11 needs to be added to CFLAGS.

这篇关于“未知类型名称'decltype'":在Mac上安装pyicu失败,出现gcc错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆