Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't install on macOs Monterey 12.1 (21C52) #79

Open
sathia-musso opened this issue Dec 22, 2021 · 2 comments
Open

can't install on macOs Monterey 12.1 (21C52) #79

sathia-musso opened this issue Dec 22, 2021 · 2 comments

Comments

@sathia-musso
Copy link

I get this error

gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include -DWEBRTC_POSIX -Icbits -I/Users/sat/localhost/webrtcvad/venv/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c cbits/pywebrtcvad.c -o build/temp.macosx-10.9-x86_64-3.7/cbits/pywebrtcvad.o -std=c++11

error: invalid argument '-std=c++11' not allowed with 'C'
gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin21.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin``` 

@Invisibility
Copy link

Invisibility commented Jan 19, 2023

The reason is that clang doesn't allow -std=c++11 for C source file but -std=c++11 is needed for one C++ file in the extension.

I figured out one hack.

  1. Comment out this line in setup.py: extra_compile_args.extend(['-std=libc++'])
  2. Create the following shell script, chmod 755 the shell script and name it the same as your compiler (e.g. clang)
#!/bin/sh
echo wrapper called
if [[ "$@" == *"checks.cc"* ]]; then
   echo "c++ detected"
   /usr/bin/clang "$@" -std=c++11
else
   /usr/bin/clang "$@"
fi
  1. change the $PATH (using export PATH=<path to shell script>:$PATH) so the shell script will be invoked first
  2. run the install command

@arkadijs
Copy link

Instead of the wrapper script, another option is to install Clang 16 or later which defaults to C++17 standard. May also use CC=/path/to/clang.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants