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

pip install fails with gcc error using gcc-7.2.0 on macOS High Sierra #1165

Closed
jeizenga opened this issue Oct 31, 2017 · 7 comments
Closed

Comments

@jeizenga
Copy link

I'm running macOS High Sierra 10.13, and pip install psutil fails with this error:

/opt/local/bin/gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=540 -DPSUTIL_OSX=1 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c psutil/_psutil_common.c -o build/temp.macosx-10.13-intel-2.7/psutil/_psutil_common.o
    gcc: warning: x86_64 conflicts with i386 (arch flags ignored)
    gcc: error: unrecognized command line option '-Wshorten-64-to-32'
    error: command '/opt/local/bin/gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/88/29kfb0qd3b1c3c_mccnm56vc0000gn/T/pip-build-FZnO2r/psutil/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/88/29kfb0qd3b1c3c_mccnm56vc0000gn/T/pip-a4GqPn-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/88/29kfb0qd3b1c3c_mccnm56vc0000gn/T/pip-build-FZnO2r/psutil/
@giampaolo
Copy link
Owner

giampaolo commented Oct 31, 2017

Don't have that OSX version sorry. Have you tried to google for unrecognized command line option '-Wshorten-64-to-32'? It seems you're not alone out there.

@jeizenga
Copy link
Author

Yeah, unfortunately everything I found refers to versions of gcc that I'm not using :/

@wiggin15
Copy link
Collaborator

wiggin15 commented Nov 7, 2017

This works for me, both with Apple's XCode Command Line Tools's gcc (which supports '-Wshorten-64-to-32) and gcc-7.2 installed by brew (which doesn't).
Can you please paste the output of:
gcc --version and python -c "import sysconfig; print sysconfig.get_config_vars('CFLAGS').

The flags that are used for compilation are taken from sysconfig, and I think they have something to do with the way the Python binary was compiled. If the definitions from sysconfig mismatch your version of gcc, you may want to edit them.

@giampaolo
Copy link
Owner

@wiggin15 unrelated, but since you're on OSX... it would be great to implement sensors_temperatures() (#371 (comment)) and sensors_battery() on OSX. Is this something which would intrigue you? I can't do it because I virtualize OSX via VirtualBox and both temperatures and battery are not emulated.

@wiggin15
Copy link
Collaborator

Looks like the code attached in your comment works, so it's just a matter of adding to psutil. I'll see what I can do.

@giampaolo
Copy link
Owner

Cool! I kinda knew I could count on you for this. =)

@giampaolo
Copy link
Owner

Cloising out as outdated.

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

No branches or pull requests

3 participants