Skip to content

bpo-26317: Build Problem with GCC + Macintosh OS X 10.11 El Capitain #13306

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

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Mac/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ PYTHONFRAMEWORK=@PYTHONFRAMEWORK@
PYTHONFRAMEWORKIDENTIFIER=@PYTHONFRAMEWORKIDENTIFIER@
LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@
CC=@CC@
OBJC=@OBJC@
MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
export MACOSX_DEPLOYMENT_TARGET

Expand Down
16 changes: 9 additions & 7 deletions Mac/PythonLauncher/Makefile.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
CC=@CC@
LD=@CC@
OBJC=@OBJC@
OBJCFLAFS=@OBJCFLAGS@
BASECFLAGS=@BASECFLAGS@
OPT=@OPT@
CFLAGS=@CFLAGS@ $(BASECFLAGS) $(OPT)
Expand Down Expand Up @@ -52,25 +54,25 @@ Python\ Launcher.app: Info.plist \
cp -R $(srcdir)/English.lproj "Python Launcher.app/Contents/Resources"

FileSettings.o: $(srcdir)/FileSettings.m
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/FileSettings.m
$(OBJC) $(CFLAGS) -o $@ -c $(srcdir)/FileSettings.m

MyAppDelegate.o: $(srcdir)/MyAppDelegate.m
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/MyAppDelegate.m
$(OBJC) $(CFLAGS) -o $@ -c $(srcdir)/MyAppDelegate.m

MyDocument.o: $(srcdir)/MyDocument.m
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/MyDocument.m
$(OBJC) $(CFLAGS) -o $@ -c $(srcdir)/MyDocument.m

PreferencesWindowController.o: $(srcdir)/PreferencesWindowController.m
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/PreferencesWindowController.m
$(OBJC) $(CFLAGS) -o $@ -c $(srcdir)/PreferencesWindowController.m

doscript.o: $(srcdir)/doscript.m
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/doscript.m
$(OBJC) $(CFLAGS) -o $@ -c $(srcdir)/doscript.m

main.o: $(srcdir)/main.m
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/main.m
$(OBJC) $(CFLAGS) -o $@ -c $(srcdir)/main.m

Python\ Launcher: $(OBJECTS)
$(CC) $(LDFLAGS) -o "Python Launcher" $(OBJECTS) -framework AppKit -framework Carbon
$(OBJC) $(LDFLAGS) -o "Python Launcher" $(OBJECTS) -framework AppKit -framework Carbon

Info.plist: $(srcdir)/Info.plist.in
sed 's/%VERSION%/'"`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print(platform.python_version())'`"'/g' < $(srcdir)/Info.plist.in > Info.plist
13 changes: 12 additions & 1 deletion Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ abs_builddir= @abs_builddir@

CC= @CC@
CXX= @CXX@
OBJC= @OBJC@
MAINCC= @MAINCC@
LINKCC= @LINKCC@
AR= @AR@
Expand Down Expand Up @@ -593,12 +594,22 @@ $(srcdir)/Modules/_blake2/blake2s_impl.c: $(srcdir)/Modules/_blake2/blake2b_impl
$(PYTHON_FOR_REGEN) $(srcdir)/Modules/_blake2/blake2b2s.py
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py -f $@

# _scproxy.o needs to be built outside of setup.py so that we 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.
#
# see issue #26317 for details
@SCPROXY@Modules/_scproxy.o: $(srcdir)/Modules/_scproxy.c $(srcdir)/Include/Python.h
@SCPROXY@ $(OBJC) -c $(CCSHARED) $(PY_CORE_CFLAGS) -o $@ $<
@NOSCPROXY@.PHONY: Modules/_scproxy.o

# Build the shared modules
# Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for
# -s, --silent or --quiet is always the first char.
# Under BSD make, MAKEFLAGS might be " -s -v x=y".
# Ignore macros passed by GNU make, passed after --
sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o Modules/_scproxy.o
@case "`echo X $$MAKEFLAGS | sed 's/^X //;s/ -- .*//'`" in \
*\ -s*|s*) quiet="-q";; \
*) quiet="";; \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The OBJC and OBJCXX standard command line options for the configure script are now supported. This is required to support building on Mac OS X using the GNU compiler for everything except the system-specific source files that include system headers that are incompatible with the GNU compiler (e.g. PythonLauncher and the _scproxy module).
10 changes: 5 additions & 5 deletions aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dnl
dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require.
m4_defun([PKG_PREREQ],
[m4_define([PKG_MACROS_VERSION], [0.29.1])
[m4_define([PKG_MACROS_VERSION], [0.29.2])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ
Expand Down Expand Up @@ -156,7 +156,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl

pkg_failed=no
AC_MSG_CHECKING([for $1])
AC_MSG_CHECKING([for $2])

_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
Expand All @@ -166,11 +166,11 @@ and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])

if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
Expand All @@ -187,7 +187,7 @@ installed software in a non-standard prefix.
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
AC_MSG_RESULT([no])
AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
Expand Down
Loading