o3de / o3de

Open 3D Engine (O3DE) is an Apache 2.0-licensed multi-platform 3D engine that enables developers and content creators to build AAA games, cinema-quality 3D worlds, and high-fidelity simulations without any fees or commercial obligations.
https://o3de.org
Other
7.8k stars 2.2k forks source link

Linux: O3DE fails to build on a certain PC due to "'targetFieldName' set but not used" error #16263

Closed LB-ArturZieba closed 1 year ago

LB-ArturZieba commented 1 year ago

Describe the bug Attempting to build Source or Pre-built SDK configuration engine on a certain PC fails with an error (full log and PCs specification can be viewed in the Terminal build log and hardinfo of affected PC section):

[16/2367] Building CXX object Code/Framework/AzCore/CMakeFiles/AzCore.dir/profile/Unity/unity_22_cxx.cxx.o
FAILED: Code/Framework/AzCore/CMakeFiles/AzCore.dir/profile/Unity/unity_22_cxx.cxx.o 
/usr/bin/clang++-14 -DAZ_BUILD_CONFIGURATION_TYPE=\"profile\" -DAZ_ENABLE_DEBUG_TOOLS -DAZ_ENABLE_TRACING -DAZ_PROFILE_BUILD -DLINUX -DLINUX64 -DNDEBUG -D_FORTIFY_SOURCE=2 -D_HAS_EXCEPTIONS=0 -D_PROFILE -D__linux__ -DCMAKE_INTDIR=\"profile\" -I/home/gpc-800/builds/o3de/Code/Framework/AzCore/. -I/home/gpc-800/builds/o3de/Code/Framework/AzCore/Platform/Linux -I/home/gpc-800/builds/o3de/Code/Framework/AzCore/Platform/Common -isystem /home/gpc-800/o3de-packages/packages/Lua-5.4.4-rev1-linux/Lua/include -isystem /home/gpc-800/o3de-packages/packages/RapidJSON-1.1.0-rev1-multiplatform/RapidJSON/include -isystem /home/gpc-800/o3de-packages/packages/RapidXML-1.13-rev1-multiplatform/RapidXML/include -isystem /home/gpc-800/o3de-packages/packages/zlib-1.2.11-rev5-linux/zlib/include -isystem /home/gpc-800/o3de-packages/packages/cityhash-1.1-multiplatform/cityhash/src -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Werror -Wno-inconsistent-missing-override -Wrange-loop-analysis -Wno-unknown-warning-option -Wno-parentheses -Wno-reorder -Wno-switch -Wno-undefined-var-template -msse4.1  -O2 -g -fstack-protector-all -fstack-check -fPIC -std=c++17 -MD -MT Code/Framework/AzCore/CMakeFiles/AzCore.dir/profile/Unity/unity_22_cxx.cxx.o -MF Code/Framework/AzCore/CMakeFiles/AzCore.dir/profile/Unity/unity_22_cxx.cxx.o.d -o Code/Framework/AzCore/CMakeFiles/AzCore.dir/profile/Unity/unity_22_cxx.cxx.o -c /home/gpc-800/builds/o3de/build/linux/Code/Framework/AzCore/CMakeFiles/AzCore.dir/Unity/unity_22_cxx.cxx
In file included from /home/gpc-800/builds/o3de/build/linux/Code/Framework/AzCore/CMakeFiles/AzCore.dir/Unity/unity_22_cxx.cxx:15:
/home/gpc-800/builds/o3de/Code/Framework/AzCore/AzCore/Serialization/Json/JsonImporter.cpp:315:27: error: variable 'targetFieldName' set but not used [-Werror,-Wunused-but-set-variable]
        rapidjson::Value* targetFieldName{};
                          ^
1 error generated.

It should be noted that this issue also occurs on Development (2581515) on the same PC, but does not on the Development (8e12e7c).

Steps to reproduce

  1. Delete all of the files left after earlier O3DE installations/builds if present.
  2. Clone, configure and build O3DE (Source or Pre-built SDK configuration).

Expected behavior Engine is built.

Actual behavior Engine build fails at the start, after successful clone and configuration.

Terminal build log and hardinfo of affected PC BuildLog.txt GPC-800-hardinfo_report.txt

Found in Branch Development (9730572)

Commit ID from o3de/o3de Repository 9730572ef3909d48e8c945fbdd29c0e6b7e5ed6f

Desktop

LB-ArturZieba commented 1 year ago

Adding [[maybe_unused]] to two variables fixes this issue: o3de/Code/Framework/AzCore/AzCore/Serialization/Json/JsonImporter.cpp: rapidjson::Value* targetFieldName{}; -> [[maybe_unused]] rapidjson::Value* targetFieldName{};

o3de/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Views/EntryDelegate.cpp (not mentioned in this issue, but occurs some time after targetFieldName error is skipped): bool isEnabled = (option.state & QStyle::State_Enabled) != 0; -> [[maybe_unused]] bool isEnabled = (option.state & QStyle::State_Enabled) != 0;

LB-ArturZieba commented 1 year ago

Issue verified as fixed on the Development (e243595) branch.