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

bpo-26317: Support OBJC and OBJCXX configure command line variables #20176

Merged
merged 12 commits into from
May 18, 2020

Conversation

ned-deily
Copy link
Member

@ned-deily ned-deily commented May 18, 2020

Add support to the configure script for OBJC and OBJCXX command line options so that the macOS builds can use the clang compiler for the macOS-specific Objective C source files. This allows third-party compilers, like GNU gcc, to be used to build the rest of the project since some of the Objective C system header files are not compilable by GNU gcc.

Also, _scproxy.o is built outside of setup.py so that we can force the use of the OBJC compiler when the CC compiler is different. The Makefile builds _scproxy.o and the setup.py script takes care of using the object file to create the _scproxy module instead of compiling the file itself. This approach is taken because setup.py is designed to use a single compiler for everything. Adding support for a second alternative compiler would require re-plumbing distutils, which is complicated and unnecessary because setup.py allows module definitions to specify object files without any .c source files.

This fixes the PythonLauncher build when CC is set to the GNU C compiler. In this case, OBJC can be set explicitly to "clang", or it can be left out and the configure script will automatically discover the clang compiler as the Objective C compiler. For example, a system that used brew to install the GNU C compiler as gcc-8 can specify CC=gcc-8 and the configure script will discover and use the clang compiler as if OBJC=gcc had been specified on the command line. The same behavior applies to the OBJCXX and CXX options.

Patch contributed by Jeffrey Kintscher (@websurfer5).

https://bugs.python.org/issue26317

websurfer5 and others added 12 commits May 11, 2019 21:38
command line options so that the MacOSX builds can use the clang
compiler for the MacOSX-specific Objective C source files. This allows
the GNU compiler to be used to build the rest of the project since some
of the Objective C system header files are not compilable with the GNU
compiler.
…e can force

the use of the OBJC compiler when the CC compiler is different. For
example, it allows _scproxy.c to be compiled using the clang compiler
while the rest of the project uses the GNU C compiler.
@ned-deily ned-deily requested a review from a team as a code owner May 18, 2020 12:53
@ned-deily ned-deily merged commit 0da5466 into python:master May 18, 2020
@ned-deily ned-deily deleted the fix-issue-26317 branch May 18, 2020 13:17
ned-deily added a commit to ned-deily/cpython that referenced this pull request May 18, 2020
…iables (pythonGH-20176)"

This reverts commit 0da5466.

The commit is causing make failures on a FreeBSD buildbot.
Due to the imminent 3.9.0b1 cutoff, revert this commit for
now pending further investigation.
ned-deily added a commit that referenced this pull request May 18, 2020
…iables (GH-20176)" (GH-20182)

This reverts commit 0da5466.

The commit is causing make failures on a FreeBSD buildbot.
Due to the imminent 3.9.0b1 cutoff, revert this commit for
now pending further investigation.
arturoescaip pushed a commit to arturoescaip/cpython that referenced this pull request May 24, 2020
…ythonGH-20176)

Add support to the configure script for OBJC and OBJCXX command line options so that the macOS builds can use the clang compiler for the macOS-specific Objective C source files. This allows third-party compilers, like GNU gcc, to be used to build the rest of the project since some of the Objective C system header files are not compilable by GNU gcc.

Co-authored-by: Jeffrey Kintscher <websurfer@surf2c.net>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
arturoescaip pushed a commit to arturoescaip/cpython that referenced this pull request May 24, 2020
…iables (pythonGH-20176)" (pythonGH-20182)

This reverts commit 0da5466.

The commit is causing make failures on a FreeBSD buildbot.
Due to the imminent 3.9.0b1 cutoff, revert this commit for
now pending further investigation.
@ax3l
Copy link

ax3l commented Aug 25, 2020

@ned-deily @websurfer5 I am unsure about the state of this fix since it seems to have been reverted due to a regression on FreeBSD? Do GCC builds on macOS now work with the objective C sources (includes) for the upcoming 3.9 release?

@@ -1,5 +1,7 @@
CC=@CC@
LD=@CC@
OBJC=@OBJC@
OBJCFLAFS=@OBJCFLAGS@
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo according to https://bugs.python.org/issue26317#msg369325

OBJCFLAGS=@OBJCFLAGS@

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

Successfully merging this pull request may close these issues.

6 participants