Closed icculus closed 1 year ago
The warning is not obvious to me.
The warning hints we're doing multiple -includeXXX
's, but the command line shows we're not doing that.
Either ways, the CMake script is not force including anything.
So I can only make guesses. A bisection would be most welcome.
-includeXXX
to the front as much as possible.Unix Makefiles
generator, does the warning also occur? (Suggestion from an upstream CMake report with the same warning message.) You need to clean the build folder first for this.For reference, this is the compile command when using clang on Linux (no warnings):
/usr/bin/ccache /usr/lib64/ccache/clang -DSDL3_shared_EXPORTS -DSDL_BUILD_MAJOR_VERSION=3 -DSDL_BUILD_MICRO_VERSION=0 -DSDL_BUILD_MINOR_VERSION=0 -DUSING_GENERATED_CONFIG_H -I/home/maarten/projects/SDL/cmake-build-debug-llvm/include-config- -I/home/maarten/projects/SDL/src -I/home/maarten/projects/SDL/cmake-build-debug-llvm/include -I/home/maarten/projects/SDL/include -I/home/maarten/projects/SDL/include/SDL3 -isystem /usr/include/pipewire-0.3 -isystem /usr/include/spa-0.2 -isystem /home/maarten/projects/SDL/cmake-build-debug-llvm/wayland-generated-protocols -isystem /usr/include/libdecor-0 -isystem /usr/include/dbus-1.0 -isystem /usr/lib64/dbus-1.0/include -isystem /usr/include/ibus-1.0 -isystem /usr/include/glib-2.0 -isystem /usr/lib64/glib-2.0/include -isystem /usr/include/sysprof-4 -isystem /usr/include/libmount -isystem /usr/include/blkid -fPIC -fvisibility=hidden -mmmx -msse -msse2 -msse3 -D_REENTRANT -idirafter /home/maarten/projects/SDL/src/video/khronos -Wall -fno-strict-aliasing -Wdeclaration-after-statement -Wdocumentation -Wdocumentation-unknown-command -fcomment-block-commands=threadsafety -Wshadow -fcolor-diagnostics -Winvalid-pch -Xclang -include-pch -Xclang /home/maarten/projects/SDL/cmake-build-debug-llvm/CMakeFiles/SDL3-shared.dir/cmake_pch.h.pch -Xclang -include -Xclang /home/maarten/projects/SDL/cmake-build-debug-llvm/CMakeFiles/SDL3-shared.dir/cmake_pch.h -MD -MT CMakeFiles/SDL3-shared.dir/src/SDL.c.o -MF CMakeFiles/SDL3-shared.dir/src/SDL.c.o.d -o CMakeFiles/SDL3-shared.dir/src/SDL.c.o -c /home/maarten/projects/SDL/src/SDL.c
On Linux, the pch is added using a slightly different method as yours:
-Xclang -include-pch -Xclang /path/to/cmake_pch.h.pch -Xclang -include -Xclang /path/to/cmake_pch.h.pch
Ah, it's ccache causing the problem, for reasons I don't really understand. It's weird, this isn't a new install of anything.
Before you do a ccache -C
to clean your cache, perhaps the ccache logs can make you wiser?
Prepend the compile command with the following, and look at the files in the ccache_debug
folder
CCACHE_DEBUGDIR=$PWD/ccache_debug CCACHE_DEBUG=1
My log contains the following lines, which means ccache is currently not working with pch.
[2023-03-09T01:23:14.997864 95216] You have to specify "pch_defines,time_macros" sloppiness when creating precompiled headers
[2023-03-09T01:23:14.997868 95216] Failed; falling back to running the real compiler
[2023-03-09T01:23:14.997871 95216] Executing /usr/bin/clang -Dpchlib_EXPORTS -fPIC -fvisibility=hidden -Winvalid-pch -fpch-instantiate-templates -Xclang -emit-pch -Xclang -include -Xclang /tmp/pchtest/build/CMakeFiles/pchlib.dir/cmake_pch.h -x c-header -MD -MT CMakeFiles/pchlib.dir/cmake_pch.h.pch -MF CMakeFiles/pchlib.dir/cmake_pch.h.pch.d -o CMakeFiles/pchlib.dir/cmake_pch.h.pch -c /tmp/pchtest/build/CMakeFiles/pchlib.dir/cmake_pch.h.c
edit
After running ccache -o sloppiness=pch_defines,time_macros,include_file_mtime,include_file_ctime
, cache retrieval seems to work.
Yeah, same message in the debug logs here.
But honestly, start to finish on the Mac Mini, a non-ccache build takes under 3 seconds, so I'd rather not use it (and wonder if this is something we should be forcing upon people in CMakeLists, instead of SDL_CCACHE defaulting to OFF).
Let's disable it by default. I just tried testing ccache on ci, and for an unknown reason it took much longer to finish.
See c304fbded
Seeing this with every file compiled, with the latest in SDL3 on macOS:
Example command line:
This is with CMake 3.25.0 on macOS, using this command line:
I have not bisected this, but I will if the problem isn't obvious.
CC @madebr