简体   繁体   中英

Portaudio won't compile using macports GCC 4.8 (-arch command option unrecognized / bad register name errors)

I use a lot of C++11 features, so I compile my C++ code using macports gcc/g++.

I can't get Portaudio to compile using macports gcc 4.8. Using the stable build (pa_stable_v19_20111121.tgz), running configure with gcc-mp-4.8 as the compiler resuls in:

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

Using the latest daily build (Apr 5), I get a bunch of "bad register name" errors:

/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'
... 

(more bad register name errors follow)

Your bad register message comes from the fact that CFLAGS are containing both -arch i386 and -arch x86_64. The first one is taken into account ... thus error about bad register for all x86_64 specific registers. An easy workaround is to edit the Makefile and remove -arch i386 in CFLAGS and SHARED_FLAGS variables. I am using a GCC 4.7 compiler and note that I had also to remove -Werror flags (error on warnings), because of the following warning:

variable 'err' set but not used [-Werror=unused-but-set-variable]

I am looking right now in how to fix the configure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM