Opened 8 years ago

Last modified 8 years ago

#50578 new defect

python34 + GCC + El Capitain

Reported by: citibob@… Owned by: jyrkiwahlstedt
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: Cc:
Port:

Description (last modified by ryandesign (Ryan Carsten Schmidt))

Changes to OS X 10.11 render GCC's Objective-C compiler useless. However, I want to compile the main part of Python in GCC (because my C++ / Fortran Cython modules use GCC).

I tried to build Python (via MacPorts) using Clang for Objective-C and GCC for C/C++. The environment upon running ./configure included:

  CC='/Users/rpfische/macports/mpgompi-4.9.3/bin/gcc-mp-4.9'
  CXX='/Users/rpfische/macports/mpgompi-4.9.3/bin/gcc-mp-4.9'
  OBJC='/usr/bin/clang'
  OBJCXX='/usr/bin/clang++'

HOWEVER... the build still tried to use GCC to compile Objective-C, and failed miserably:

:info:destroot /Users/rpfische/macports/mpgompi-4.9.3/bin/gcc-mp-4.9 -pipe -Os -arch x86_64 -Wno-unused-result -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -o FileSettings.o -c ./FileSettings.m
:info:destroot /usr/include/objc/NSObject.h:22:4: error: unknown type name 'instancetype'
:info:destroot  - (instancetype)self;
:info:destroot     ^
...

Log file attached.

Attachments (1)

log (3.1 MB) - added by citibob@… 8 years ago.

Change History (3)

Changed 8 years ago by citibob@…

Attachment: log added

comment:1 in reply to:  description Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Owner: changed from macports-tickets@… to jwa@…

Replying to citibob@…:

I want to compile the main part of Python in GCC (because my C++ / Fortran Cython modules use GCC).

As far as I know, MacPorts python ports don't provide a way to do that.

comment:2 Changed 8 years ago by citibob@…

It's looking like it's a bug in the Python distro, not MacPorts.

http://bugs.python.org/issue26317

Python.org is likely to fix it for Python 3.5 and above, but definitely not 3.4. Once the bug is fixed, one should be able to install with GCC on MacPorts via by setting the CC and OBJC env variables separately when running ./configure. I believe this can be accomplished in MacPorts via:

port install python34 configure.cc=/path/to/gcc configure.objc=clang

Things that maybe should be changed on the MacPorts side:

  • Should MacPorts check for GCC and automatically switch to Clang for the Objective-C portion (or at least complain with an error, recommending that you try configure.objc=clang)? I suppose this is only a problem for certain versions of GCC and OS X, and might be resolved with future updates to GCC. So it's not clear that anything should change in MacPorts.
  • May be MacPorts should provide a variant that disables the Objective-C Python Launcher. I'm pretty sure the launcher is useless for my work. There's a configure option to disable it in the Python.org distro, but that option is not made available as a MacPorts variant.
Note: See TracTickets for help on using tickets.