【发布时间】:2013-04-06 12:18:23
【问题描述】:
我使用了很多 C++11 功能,所以我使用 macports gcc/g++ 编译我的 C++ 代码。
我无法让 Portaudio 使用 macports gcc 4.8 进行编译。使用稳定版本 (pa_stable_v19_20111121.tgz),使用 gcc-mp-4.8 运行 configure 作为编译器结果:
bash-3.2$ make
mkdir lib
mkdir -p src/common src/hostapi/alsa src/hostapi/asihpi src/hostapi/asio src/hostapi/coreaudio src/hostapi/dsound src/hostapi/jack src/hostapi/oss src/hostapi/wasapi src/hostapi/wdmks src/hostapi/wmme src/os/unix src/os/win
touch lib-stamp
/bin/sh ./libtool --mode=compile /opt/local/bin/gcc-mp-4.8 -c -std=c99 -O2 -Wall -pedantic -pipe -fPIC -DNDEBUG -DPA_LITTLE_ENDIAN -I./include -I./src/common -I./src/os/unix -Werror -arch i386 -arch ppc -arch x86_64 -arch ppc64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.3 -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=8 -DHAVE_NANOSLEEP=1 -DPA_USE_COREAUDIO=1 src/common/pa_allocation.c -o src/common/pa_allocation.lo
libtool: compile: /opt/local/bin/gcc-mp-4.8 -c -std=c99 -O2 -Wall -pedantic -pipe -fPIC -DNDEBUG -DPA_LITTLE_ENDIAN -I./include -I./src/common -I./src/os/unix -Werror -arch i386 -arch ppc -arch x86_64 -arch ppc64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.3 -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=8 -DHAVE_NANOSLEEP=1 -DPA_USE_COREAUDIO=1 src/common/pa_allocation.c -fno-common -DPIC -o src/common/.libs/pa_allocation.o
gcc-mp-4.8: error: unrecognized command line option '-arch'
gcc-mp-4.8: error: unrecognized command line option '-arch'
make: *** [src/common/pa_allocation.lo] Error 1
使用最新的每日构建(4 月 5 日),我收到一堆“错误的寄存器名称”错误:
/bin/sh ./libtool --mode=compile /opt/local/bin/gcc-mp-4.8 -c -std=c99 -O2 -Wall -pedantic -pipe -fPIC -DNDEBUG -DPA_LITTLE_ENDIAN -I./include -I./src/common -I./src/os/unix -Werror -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.3 -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=8 -DHAVE_NANOSLEEP=1 -DPA_USE_COREAUDIO=1 src/common/pa_allocation.c -o src/common/pa_allocation.lo
libtool: compile: /opt/local/bin/gcc-mp-4.8 -c -std=c99 -O2 -Wall -pedantic -pipe -fPIC -DNDEBUG -DPA_LITTLE_ENDIAN -I./include -I./src/common -I./src/os/unix -Werror -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.3 -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=8 -DHAVE_NANOSLEEP=1 -DPA_USE_COREAUDIO=1 src/common/pa_allocation.c -fno-common -DPIC -o src/common/.libs/pa_allocation.o
{standard input}:5:bad register name `%r13'
{standard input}:7:bad register name `%rsi'
{standard input}:8:bad register name `%r12'
{standard input}:10:bad register name `%rdx'
...
(后面会出现更多错误的寄存器名称错误)
【问题讨论】:
-
几件事:clang 支持带有 -std=c++11 的 c++11 以及带有 -stdlib=libc++ 标志的库。关于您的问题,几周前我遇到了同样的问题,最终使用 fmod 而不是端口音频。此外,我更喜欢自制软件而不是 macports,因为根据我的经验,我发现这些软件包往往是最新的。但是我不明白为什么端口音频没有在这里编译。
-
也许我用错了,但尽管在clang.llvm.org/cxx_status.html 有全面的 c++11 清单,但我遇到了很多烦人的小不兼容(最近的一些缺少 std:: stoi 和 fstream 构造函数不接受 C++ 字符串)
标签: c++ gcc macports portaudio