PortAudio / portaudio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
Other
1.43k stars 296 forks source link

make not working on Mac Monterey #832

Closed scfleming closed 1 year ago

scfleming commented 1 year ago

Describe the bug I downloaded pa_stable_v190700_20210406.tgz and untarred the file. I then ran ./configure and got the following summary:

Configuration summary: Target ...................... arm-apple-darwin21.6.0 C++ bindings ................ no Debug output ................ no Mac debug flags ............. no

I then ran make clean and then make and get the following errors:

/bin/sh ./libtool --mode=compile gcc -c -std=c99 -O2 -Wall -pedantic -pipe -fPIC -DNDEBUG -DPA_LITTLE_ENDIAN -I./include -I./src/common -I./src/os/unix -Wno-deprecated -Werror -arch x86_64 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=10.6 -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_CLOCK_GETTIME=1 -DHAVE_NANOSLEEP=1 -DPA_USE_COREAUDIO=1 src/common/pa_converters.c -o src/common/pa_converters.lo libtool: compile: gcc -c -std=c99 -O2 -Wall -pedantic -pipe -fPIC -DNDEBUG -DPA_LITTLE_ENDIAN -I./include -I./src/common -I./src/os/unix -Wno-deprecated -Werror -arch x86_64 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=10.6 -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_CLOCK_GETTIME=1 -DHAVE_NANOSLEEP=1 -DPA_USE_COREAUDIO=1 src/common/pa_converters.c -fno-common -DPIC -o src/common/.libs/pa_converters.o src/common/pa_converters.c:1058:14: error: variable 'src' set but not used [-Werror,-Wunused-but-set-variable] PaInt32 src = (PaInt32)sourceBuffer; ^ src/common/pa_converters.c:1059:20: error: variable 'dest' set but not used [-Werror,-Wunused-but-set-variable] unsigned char dest = (unsigned char)destinationBuffer; ^ src/common/pa_converters.c:1420:18: error: variable 'dest' set but not used [-Werror,-Wunused-but-set-variable] signed char dest = (signed char)destinationBuffer; ^ src/common/pa_converters.c:1419:14: error: variable 'src' set but not used [-Werror,-Wunused-but-set-variable] PaInt16 src = (PaInt16)sourceBuffer; ^ src/common/pa_converters.c:1460:20: error: variable 'dest' set but not used [-Werror,-Wunused-but-set-variable] unsigned char dest = (unsigned char)destinationBuffer; ^ src/common/pa_converters.c:1459:14: error: variable 'src' set but not used [-Werror,-Wunused-but-set-variable] PaInt16 src = (PaInt16)sourceBuffer; ^ 6 errors generated. make: *** [src/common/pa_converters.lo] Error 1

To Reproduce Steps to reproduce the behavior. Include code if applicable.

  1. Download the latest, stable .tar.gz build file.
  2. Run ./configure and then try to make

Expected behavior Expect to install without errors.

Actual behavior Installation fails.

Desktop (please complete the following information):

scfleming commented 1 year ago

I ran a bunch of combinations of ./configure --enable-mac-debug and make, make install and others, and I did eventually find the expected files in /user/local/lib/, so I don't know for sure what ultimately got it to build, but it appears it has now for me. Oddly, I did not find any errors when running with the debug mode on (for example), but it didn't appear to install the expected files in /usr/local/lib/, at least just by doing the configure+debug mode and a regular make. Sorry if this is not super helpful to investigate with.

dechamps commented 1 year ago

Your issue is caused by compilation warnings being incorrectly turned into errors due to the unfortunate -Werror flag the Darwin build uses. This was fixed in bc3ad0214a358be3cc01f6b2cc2eaaf284c6de34 but you're attempting to build an older version. You should be able to proceed if you apply that patch locally, or if you check out a more recent version of PortAudio (e.g. latest master), or (possibly) if you use CMake instead of configure.

The reason why it works with --enable-mac-debug is because that parameter gets rid of -Wall, which is what causes the unused-but-set-variable warning which is then turned into an error by -Werror.

scfleming commented 1 year ago

Thanks for the info!

PabloLION commented 11 months ago

For whom have the same error with clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [lib/libportaudio.la] Error 1 or -Wunused-but-set-variable It happened to me too on my mac with Apple Silicon and maybe the #800 is not released yet. I used cmake . && make to build this. (TLDR But after that I still couldn't pip install PyAudio, and the solution was brew install portaudio)