1

我正在尝试为 iOS 编译OpenFST,这是 make 失败的地方:

cd openfst-1.6.5/src/lib
/Applications/Xcode.app/Contents/Developer/usr/bin/g++ 
  -DHAVE_CONFIG_H 
  -I./../include 
  -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/c++/4.2.1/ 
  -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/ 
  -miphoneos-version-min=8.1 
  -arch armv7 
  -fno-exceptions 
  -funsigned-char 
  -pipe 
  -no-cpp-precomp 
  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk 
  -std=c++11 
  -MT compat.lo -MD -MP -MF .deps/compat.Tpo -c compat.cc -o compat.o

它抛出了许多类似的错误,比如这些

/../iPhoneOS.sdk/usr/include/c++/4.2.1/cwchar:212:12: 
  error: cannot initialize return object of type
  'wchar_t *' with an rvalue of type 'const wchar_t *'
{ return wcschr(const_cast<const wchar_t*>(__p), __c); }
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/../iPhoneOS.sdk/usr/include/c++/4.2.1/cwchar:218:12: 
  error: cannot initialize return object of type
  'wchar_t *' with an rvalue of type 'const wchar_t *'
{ return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/../usr/include/c++/v1/tuple:1352:22: 
error: C++ requires a type specifier for all declarations
pair<_T1, _T2>::pair(piecewise_construct_t,
                     ^
/../usr/include/c++/v1/tuple:1351:1: 
error: declarator requires an identifier
inline _LIBCPP_INLINE_VISIBILITY
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

我觉得我在这里使用了错误的 c++ 版本还是什么?

4

1 回答 1

0

如果c++/4.2.1在您的回溯中意味着 GCC 4.2.1,那么这是一个非常古老的编译器套件(11 岁)。OpenFst README 说它需要 GCC 4.7 或更高版本。(这大概是为了 C++11 和 C99 支持。)我不知道如何将 XCode 版本映射到 Clang 编译器版本(以及哪些 Clang 版本对 C++11 有实质性支持),但我想这在某处有记录。

FWIW 我在 Linux + armv7 + GCC 5.4.0(便宜的 Chromebook + Crouton)上运行 OpenFst,所以我怀疑 ARM 支持是问题所在。

于 2018-01-12T15:04:26.467 回答