Skip to content

os/log.h does not work correctly on Catalina when building with gcc: #error using os/log.h requires Xcode 8 or later #132182

Open
@barracuda156

Description

@barracuda156

Bug report

Bug description:

Build fails on macOS with gcc.

/opt/local/bin/gcc-mp-14 -c -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64   -flto -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -DPy_BUILD_CORE -o Python/preconfig.o Python/preconfig.c
/opt/local/bin/gcc-mp-14 -c -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64   -flto -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -DPy_BUILD_CORE -o Python/pyarena.o Python/pyarena.c
/opt/local/bin/gcc-mp-14 -c -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64   -flto -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -DPy_BUILD_CORE -o Python/pyctype.o Python/pyctype.c
/opt/local/bin/gcc-mp-14 -c -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64   -flto -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -DPy_BUILD_CORE -o Python/pyfpe.o Python/pyfpe.c
/opt/local/bin/gcc-mp-14 -c -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64   -flto -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -DPy_BUILD_CORE -o Python/pyhash.o Python/pyhash.c
/opt/local/bin/gcc-mp-14 -c -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64   -flto -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -DPy_BUILD_CORE -o Python/pylifecycle.o Python/pylifecycle.c
/opt/local/bin/gcc-mp-14 -c -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64   -flto -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -DPy_BUILD_CORE -o Python/pymath.o Python/pymath.c
/opt/local/bin/gcc-mp-14 -c -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64   -flto -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -DPy_BUILD_CORE -o Python/pystate.o Python/pystate.c
/opt/local/bin/gcc-mp-14 -c -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64   -flto -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -DPy_BUILD_CORE -o Python/pythonrun.o Python/pythonrun.c
/opt/local/bin/gcc-mp-14 -c -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64   -flto -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -DPy_BUILD_CORE -o Python/pytime.o Python/pytime.c
In file included from Python/pylifecycle.c:64:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/os/log.h:17:2: error: #error using os/log.h requires Xcode 8 or later
   17 | #error using os/log.h requires Xcode 8 or later
      |  ^~~~~
/opt/local/bin/gcc-mp-14 -c -fno-strict-overflow -Wsign-compare -fno-common -dynamic -DNDEBUG -g -O3 -Wall -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64   -flto -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -DPy_BUILD_CORE -o Python/qsbr.o Python/qsbr.c
Python/pytime.c: In function 'py_get_system_clock':
Python/pytime.c:940:20: warning: unused variable 'tv' [-Wunused-variable]
  940 |     struct timeval tv;
      |                    ^~
Python/pylifecycle.c: In function 'apple_log_write_impl':
Python/pylifecycle.c:2973: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
 2973 |     os_log_with_type(OS_LOG_DEFAULT, logtype, "%s", text);
Python/pylifecycle.c:2973: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
Python/pylifecycle.c:2973: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
Python/pylifecycle.c:2973:5: warning: 'internal_linkage' attribute directive ignored [-Wattributes]
 2973 |     os_log_with_type(OS_LOG_DEFAULT, logtype, "%s", text);
      |     ^~~~~~~~~~~~~~~~
In file included from /opt/local/lib/gcc14/gcc/x86_64-apple-darwin19/14.2.0/include-fixed/os/trace.h:17,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/os/log.h:14:
Python/pylifecycle.c:2973:5: error: implicit declaration of function '__builtin_os_log_format_buffer_size' [-Wimplicit-function-declaration]
 2973 |     os_log_with_type(OS_LOG_DEFAULT, logtype, "%s", text);
      |     ^~~~~~~~~~~~~~~~
Python/pylifecycle.c:2973:5: error: implicit declaration of function '__builtin_os_log_format'; did you mean '__builtin_isnormal'? [-Wimplicit-function-declaration]
 2973 |     os_log_with_type(OS_LOG_DEFAULT, logtype, "%s", text);
      |     ^~~~~~~~~~~~~~~~
Python/pylifecycle.c:2973: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
 2973 |     os_log_with_type(OS_LOG_DEFAULT, logtype, "%s", text);
make: *** [Python/pylifecycle.o] Error 1

Catalina has Xcode 12 though:

% /usr/bin/xcodebuild -version
Xcode 12.4
Build version 12D4e

Is this Apple bug?

CPython versions tested on:

3.13

Operating systems tested on:

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-macbuildThe build process and cross-buildpendingThe issue will be closed if no feedback is providedtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions