I always build the game using command:
``make -j$(nproc) NATIVE=linux64 CCACHE=1 RELEASE=1 LTO=1 TILES=1 SOUND=1 CLANG=1 BACKTRACE=0 RUNTESTS=0
When i was on commit 5c118cddba6c2d8effbc2420851b70bc1c6a7587 everything was fine, but on commit 36d06eb1f6a31111b5f5b37d83414c2f2d7a557d i am getting errors like that:
`[nikow@thinira Cataclysm-DDA]$ make -j$(nproc) NATIVE=linux64 CCACHE=1 RELEASE=1 LTO=1 TILES=1 SOUND=1 CLANG=1 BACKTRACE=0 RUNTESTS=0
astyle -V: Artistic Style Version 3.1
find data -name "*.json" -print0 | grep -v -z -F -f json_blacklist | \
xargs -0 -L 1 tools/format/json_formatter.cgi
no astyle regressions
CCACHE_CPP2=1 CCACHE_SLOPPINESS=pch_defines,time_macros ccache clang++ -DRELEASE -DGIT_VERSION -DTILES -DLOCALIZE -ffast-math -O3 -flto -Xclang -fno-pch-timestamp -Werror -Wall -Wextra -Wformat-signedness -Wlogical-op -Wmissing-declarations -Wmissing-noreturn -Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual -Wpedantic -Wsuggest-override -Wunused-macros -Wzero-as-null-pointer-constant -Wno-unknown-warning-option -Wredundant-decls -fsigned-char -std=c++14 -MMD -MP -m64 -I/usr/include/SDL2 -D_REENTRANT -DSDL_SOUND -I/usr/include/SDL2 -D_REENTRANT -I/usr/include/SDL2 -D_REENTRANT -I/usr/include/SDL2 -D_REENTRANT -Ipch -Winvalid-pch -include-pch pch/pch.hpp.pch -c src/activity_actor.cpp -o obj/tiles/activity_actor.o
CCACHE_CPP2=1 CCACHE_SLOPPINESS=pch_defines,time_macros ccache clang++ -DRELEASE -DGIT_VERSION -DTILES -DLOCALIZE -ffast-math -O3 -flto -Xclang -fno-pch-timestamp -Werror -Wall -Wextra -Wformat-signedness -Wlogical-op -Wmissing-declarations -Wmissing-noreturn -Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual -Wpedantic -Wsuggest-override -Wunused-macros -Wzero-as-null-pointer-constant -Wno-unknown-warning-option -Wredundant-decls -fsigned-char -std=c++14 -MMD -MP -m64 -I/usr/include/SDL2 -D_REENTRANT -DSDL_SOUND -I/usr/include/SDL2 -D_REENTRANT -I/usr/include/SDL2 -D_REENTRANT -I/usr/include/SDL2 -D_REENTRANT -Ipch -Winvalid-pch -include-pch pch/pch.hpp.pch -c src/activity_handlers.cpp -o obj/tiles/activity_handlers.o
CCACHE_CPP2=1 CCACHE_SLOPPINESS=pch_defines,time_macros ccache clang++ -DRELEASE -DGIT_VERSION -DTILES -DLOCALIZE -ffast-math -O3 -flto -Xclang -fno-pch-timestamp -Werror -Wall -Wextra -Wformat-signedness -Wlogical-op -Wmissing-declarations -Wmissing-noreturn -Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual -Wpedantic -Wsuggest-override -Wunused-macros -Wzero-as-null-pointer-constant -Wno-unknown-warning-option -Wredundant-decls -fsigned-char -std=c++14 -MMD -MP -m64 -I/usr/include/SDL2 -D_REENTRANT -DSDL_SOUND -I/usr/include/SDL2 -D_REENTRANT -I/usr/include/SDL2 -D_REENTRANT -I/usr/include/SDL2 -D_REENTRANT -Ipch -Winvalid-pch -include-pch pch/pch.hpp.pch -c src/activity_item_handling.cpp -o obj/tiles/activity_item_handling.o
CCACHE_CPP2=1 CCACHE_SLOPPINESS=pch_defines,time_macros ccache clang++ -DRELEASE -DGIT_VERSION -DTILES -DLOCALIZE -ffast-math -O3 -flto -Xclang -fno-pch-timestamp -Werror -Wall -Wextra -Wformat-signedness -Wlogical-op -Wmissing-declarations -Wmissing-noreturn -Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual -Wpedantic -Wsuggest-override -Wunused-macros -Wzero-as-null-pointer-constant -Wno-unknown-warning-option -Wredundant-decls -fsigned-char -std=c++14 -MMD -MP -m64 -I/usr/include/SDL2 -D_REENTRANT -DSDL_SOUND -I/usr/include/SDL2 -D_REENTRANT -I/usr/include/SDL2 -D_REENTRANT -I/usr/include/SDL2 -D_REENTRANT -Ipch -Winvalid-pch -include-pch pch/pch.hpp.pch -c src/advanced_inv.cpp -o obj/tiles/advanced_inv.o
CCACHE_CPP2=1 CCACHE_SLOPPINESS=pch_defines,time_macros ccache clang++ -DRELEASE -DGIT_VERSION -DTILES -DLOCALIZE -ffast-math -O3 -flto -Xclang -fno-pch-timestamp -Werror -Wall -Wextra -Wformat-signedness -Wlogical-op -Wmissing-declarations -Wmissing-noreturn -Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual -Wpedantic -Wsuggest-override -Wunused-macros -Wzero-as-null-pointer-constant -Wno-unknown-warning-option -Wredundant-decls -fsigned-char -std=c++14 -MMD -MP -m64 -I/usr/include/SDL2 -D_REENTRANT -DSDL_SOUND -I/usr/include/SDL2 -D_REENTRANT -I/usr/include/SDL2 -D_REENTRANT -I/usr/include/SDL2 -D_REENTRANT -Ipch -Winvalid-pch -include-pch pch/pch.hpp.pch -c src/advanced_inv_area.cpp -o obj/tiles/advanced_inv_area.o
CCACHE_CPP2=1 CCACHE_SLOPPINESS=pch_defines,time_macros ccache clang++ -DRELEASE -DGIT_VERSION -DTILES -DLOCALIZE -ffast-math -O3 -flto -Xclang -fno-pch-timestamp -Werror -Wall -Wextra -Wformat-signedness -Wlogical-op -Wmissing-declarations -Wmissing-noreturn -Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual -Wpedantic -Wsuggest-override -Wunused-macros -Wzero-as-null-pointer-constant -Wno-unknown-warning-option -Wredundant-decls -fsigned-char -std=c++14 -MMD -MP -m64 -I/usr/include/SDL2 -D_REENTRANT -DSDL_SOUND -I/usr/include/SDL2 -D_REENTRANT -I/usr/include/SDL2 -D_REENTRANT -I/usr/include/SDL2 -D_REENTRANT -Ipch -Winvalid-pch -include-pch pch/pch.hpp.pch -c src/advanced_inv_pane.cpp -o obj/tiles/advanced_inv_pane.o
CCACHE_CPP2=1 CCACHE_SLOPPINESS=pch_defines,time_macros ccache clang++ -DRELEASE -DGIT_VERSION -DTILES -DLOCALIZE -ffast-math -O3 -flto -Xclang -fno-pch-timestamp -Werror -Wall -Wextra -Wformat-signedness -Wlogical-op -Wmissing-declarations -Wmissing-noreturn -Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual -Wpedantic -Wsuggest-override -Wunused-macros -Wzero-as-null-pointer-constant -Wno-unknown-warning-option -Wredundant-decls -fsigned-char -std=c++14 -MMD -MP -m64 -I/usr/include/SDL2 -D_REENTRANT -DSDL_SOUND -I/usr/include/SDL2 -D_REENTRANT -I/usr/include/SDL2 -D_REENTRANT -I/usr/include/SDL2 -D_REENTRANT -Ipch -Winvalid-pch -include-pch pch/pch.hpp.pch -c src/ammo.cpp -o obj/tiles/ammo.o
^
^
^
3 errors generated.
make: * [Makefile:912: obj/tiles/ammo.o] B艂膮d 1
make: * Oczekiwanie na niezako艅czone zadania....
^
^
^
3 errors generated.
make: * [Makefile:912: obj/tiles/advanced_inv_pane.o] B艂膮d 1
^
^
^
3 errors generated.
make: * [Makefile:912: obj/tiles/advanced_inv_area.o] B艂膮d 1
^
^
^
3 errors generated.
make: * [Makefile:912: obj/tiles/advanced_inv.o] B艂膮d 1
^
^
^
3 errors generated.
make: * [Makefile:912: obj/tiles/activity_actor.o] B艂膮d 1
^
^
^
3 errors generated.
make: * [Makefile:912: obj/tiles/activity_item_handling.o] B艂膮d 1
^
^
^
3 errors generated.
make: * [Makefile:912: obj/tiles/activity_handlers.o] B艂膮d 1```
git checkout 5c118cddba6c2d8effbc2420851b70bc1c6a7587
make -j$(nproc) NATIVE=linux64 CCACHE=1 RELEASE=1 LTO=1 CLANG=1 BACKTRACE=0 RUNTESTS=0
make -j$(nproc) NATIVE=linux64 CCACHE=1 RELEASE=1 LTO=1 TILES=1 SOUND=1 CLANG=1 BACKTRACE=0 RUNTESTS=0
git checkout 36d06eb1f6a31111b5f5b37d83414c2f2d7a557d
make -j$(nproc) NATIVE=linux64 CCACHE=1 RELEASE=1 LTO=1 TILES=1 SOUND=1 CLANG=1 BACKTRACE=0 RUNTESTS=0
Game compiles and creates playable executable.
There is workaround provided by @anothersimulacrum, flag PCH=0
solves issue.
Looks like your clang complains about -DTILES
, -DSDL_SOUND
, etc which don't affect the pch at all. Pretty confusing...
What's your clang version? I don't get the errors with 10.0.1
(also use ``` when quoting multi-line text to preserve line breaks)
Wait a minute what's this bit here
Autogen and call ./configure
That's not part of the build process. Doesn't that alter the makefile?
The same problem is also triggered by the Archlinux AUR build script, or simply the following commands :
make clean && make TILES=1 && make TILES=0
The second build always fails with
cc1plus: error: pch/pch.hpp.gch: not used because '_REENTRANT' not undefined [-Werror=invalid-pch]
Reversing the TILES=0|1 build order only changes the error :
cc1plus: error: pch/pch.hpp.gch: not used because '_XOPEN_SOURCE' not defined [-Werror=invalid-pch]
Removing PCH between builds does solve the problem (rm -f pch/pch.hpp.{gch,pch}
).
(Cross-link to the PR introducing this change : #42535 )
That makes more sense, thanks. That's a limitation of make
and I don't know how to work around it. Running make clean
when changing project options should be mandatory (saner build systems also enforce it...)
edit: and just to be clear: you gain nothing by skipping make clean
in this case since your extra flags invalidate ccache as well. It's a full rebuild either way
Actually a workaround might be to infix -tiles
in the pch's name when TILES=1 (and maybe similar for SOUND, etc..?). It's pretty ugly but it should work
Excuse me, step 3. Autogen and call ./configure
is mistake on my side. Is there a way to build both version (text one and tiles one) without using PCH=0
flag? If not, i think that should be mentioned in compilation docs somewhere.
In-between make TILES=0
and make TILES=1
, you can either
1) run rm {tests/,}pch/pch.hpp.{gch,pch}
as mentioned above (note: this will still likely fail if you change other flags besides TILES
)
2) copy the target binary, then run make clean
3) run make install
, then make clean
I'm not really sure if that is acceptable workflow for this project, so I won't submit a documentation change. The workaround I mention above is also pretty untenable for all the defines in our current Makefile (and I personally am not interested in writing it atm)
There's no real consideration for building both tiles and curses sequentially, but it is expecting that you make clean between each recompile with different make flags, so option 2 or 3 would be what I'd generally expect for that.
If one wishes to build both tiles and curses then it's best to use the CMake build and separate build dirs.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not \'bump\' or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.
This issue has been automatically closed due to lack of activity. This does not mean that we do not value the issue. Feel free to request that it be re-opened if you are going to actively work on it
Most helpful comment
Actually a workaround might be to infix
-tiles
in the pch's name when TILES=1 (and maybe similar for SOUND, etc..?). It's pretty ugly but it should work