Opened 4 years ago

Closed 4 years ago

#59985 closed defect (wontfix)

python37, python38: error: cannot run C compiled programs

Reported by: AgilentGCMS Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port:

Description

I'm trying to install python37 and/or python38 with the following command line:

port install -d python38 configure.compiler=macports-gcc

because I'd like to compile python with the macports-installed gcc instead of the system clang. However, that operation fails with the following ouptut

$ port install -d python38 configure.compiler=macports-gcc
--->  Computing dependencies for python38
--->  Fetching distfiles for python38
--->  Verifying checksums for python38
--->  Extracting python38
--->  Applying patches to python38
--->  Configuring python38
Error: Failed to configure python38, consult /Users/sbasu1/packages/macports/var/macports/build/_Users_sbasu1_packages_macports_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python38/python38/work/Python-3.8.1/config.log
Error: Failed to configure python38: configure failure: command execution failed
Error: See /Users/sbasu1/packages/macports/var/macports/logs/_Users_sbasu1_packages_macports_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python38/python38/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets to report a bug.
Error: Processing of port python38 failed

main.log attached.

Attachments (2)

main.log (43.6 KB) - added by AgilentGCMS 4 years ago.
main.log from the failed port install
config.log (23.5 KB) - added by AgilentGCMS 4 years ago.

Download all attachments as: .zip

Change History (8)

Changed 4 years ago by AgilentGCMS

Attachment: main.log added

main.log from the failed port install

comment:1 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Summary: port install python38 or python37 fails with failure to destrootpython37, python38: error: cannot run C compiled programs

Overriding the compiler is not generally recommended. Why do you want to do this?

The log says:

:info:configure configure: error: cannot run C compiled programs.
:info:configure If you meant to cross compile, use `--host'.
:info:configure See `config.log' for more details
:info:configure Command failed:  cd "/Users/sbasu1/packages/macports/var/macports/build/_Users_sbasu1_packages_macports_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python38/python38/work/Python-3.8.1" && ./configure --prefix=/Users/sbasu1/packages/macports --enable-framework=/Users/sbasu1/packages/macports/Library/Frameworks --enable-ipv6 --enable-loadable-sqlite-extensions --with-computed-gotos --with-ensurepip=no --with-system-expat --with-system-ffi
:info:configure Exit code: 1
:error:configure Failed to configure python38, consult /Users/sbasu1/packages/macports/var/macports/build/_Users_sbasu1_packages_macports_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_python38/python38/work/Python-3.8.1/config.log

So what does that config.log say about you "cannot run C compiled programs"? You may want to attach it here as well.

comment:2 Changed 4 years ago by AgilentGCMS

I want to use the macports-installed compiler because in my experience clang is usually a few builds behind the official GCC releases, and lacks certain features. E.g., clang, at least on my mac, does not support openmp. This is not to say that python requires openmp, but since I compile everything on my system with the gcc installed by macports, I wanted to have a consistent system. My idea is that it *should* work, even though it's not recommended.

I'm attaching the config.log, sorry for not attaching it earlier.

Changed 4 years ago by AgilentGCMS

Attachment: config.log added

comment:3 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Ok, that's certainly not how MacPorts is intended to be used and it's not something I'm going to support. gcc on macOS is dead to me, and probably to Apple as well. As you're seeing here, gcc can't even compile a simple test program used during configuration due to some disagreement between gcc's headers and macOS system headers. I'm not going to debug this further.

comment:4 Changed 4 years ago by AgilentGCMS

I'm surprised by the assertion that gcc is dead on macOS, since gcc is usually the stablest compiler suite on most Unix-y platforms. Also, why bother having so many gcc ports if they're unusable? Nonetheless, there's not much I can do, since fixing gcc on macOS is way beyond my capability. I wish clang was a bit more full featured, like supporting openmp, if Apple's desire was indeed to have that as the only functioning compiler on macOS. I guess I'll just live with the fact that despite the Unix-y veneer, macOS was not built for those who want the full flexibility of a unix OS (sorry, nothing personal, I'm just expressing my frustration of trying to adjust to a mac after years of linux/unix development).

comment:5 Changed 4 years ago by kencu (Ken)

gcc-9 has been fixed to work with the newer headers in Apple's latest SDK.

You are using configure.compiler=macports-gcc which is not specific, and will call the gcc version that you have set up using port select gcc. In your case that is gcc8.

So you will get past your header error by calling configure.compler=macports-gcc-9 but there will likely be other problems found soon, as a lot of software just assumes now that Apple systems will be using clang and so forces compiler flags, standard libraries, and other assumptions without actually doing the proper thing and testing for them first.

gcc can be made to support a lot of the current clang traditions, like multiple arch flags for cross-compiling, and setting a specific stdlib to link against libc++ -- out on the web you will find such patches quite easily, and I may integrate these into MacPorts someday, if acceptable. The Darwin lead for gcc, Iain Sandoe, is a very very skilled compiler writer, and has most all of these things on his github forks.

At present though, clang is much more capable than you think it is, and the open source versions all support openmp since about five years ago now. The only thing of real interest that gcc has that clang does not have is fortran compiling capabiltiy, at present -- this is being worked on with a flang front end for llvm, and so one day that will be covered as well.

You can beat your head against the wall trying to make all Darwin/Apple/MacPorts software build with gcc, and you might have some success -- but life is short, and you probably have better things to do with your time than figure out how to make that work....

Last edited 4 years ago by kencu (Ken) (previous) (diff)

comment:6 Changed 4 years ago by kencu (Ken)

Resolution: wontfix
Status: newclosed

If you don't mind, for general maintenance, we'll close this ticket now as a "won't fix" -- the issue of this ticket is really that gcc8 doesn't support apple's latest headers, and has nothing to do with python at all.

Note: See TracTickets for help on using tickets.