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 due to "'elementName' set but not used" error #16298

Closed LB-KacperBieniek closed 1 year ago

LB-KacperBieniek commented 1 year ago

Describe the bug Attempting to build Source configuration engine fails with an error:

gpc-94302@GPC-94302:~/o3de$ sudo cmake --build build/linux --target Editor --config profile -j 8
[5/767] Building CXX object Code/Frame...rk.dir/profile/Unity/unity_8_cxx.cxx.o
FAILED: Code/Framework/AzFramework/CMakeFiles/AzFramework.dir/profile/Unity/unity_8_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 -DPAL_TRAIT_LINUX_WINDOW_MANAGER_XCB -D_FORTIFY_SOURCE=2 -D_HAS_EXCEPTIONS=0 -D_PROFILE -D__linux__ -DCMAKE_INTDIR=\"profile\" -I/home/gpc-94302/o3de/Code/Framework/AzFramework/. -I/home/gpc-94302/o3de/Code/Framework/AzFramework/Platform/Linux -I/home/gpc-94302/o3de/Code/Framework/AzFramework/Platform/Common -I/home/gpc-94302/o3de/Code/Framework/AzFramework/Platform/Common/Xcb -I/home/gpc-94302/o3de/Code/Framework/AzCore/. -I/home/gpc-94302/o3de/Code/Framework/AzCore/Platform/Linux -I/home/gpc-94302/o3de/Code/Framework/AzCore/Platform/Common -I/home/gpc-94302/o3de/Code/Framework/AzNetworking/. -I/home/gpc-94302/o3de/Code/Framework/AzNetworking/Platform/Common -I/home/gpc-94302/o3de/Code/Framework/AzNetworking/Platform/Linux -I/home/gpc-94302/o3de/build/linux/Code/Framework/AzNetworking/Azcg/Generated/AzNetworking -isystem /home/gpc-94302/o3de-packages/packages/Lua-5.4.4-rev1-linux/Lua/include -isystem /home/gpc-94302/o3de-packages/packages/RapidJSON-1.1.0-rev1-multiplatform/RapidJSON/include -isystem /home/gpc-94302/o3de-packages/packages/RapidXML-1.13-rev1-multiplatform/RapidXML/include -isystem /home/gpc-94302/o3de-packages/packages/zlib-1.2.11-rev5-linux/zlib/include -isystem /home/gpc-94302/o3de-packages/packages/cityhash-1.1-multiplatform/cityhash/src -isystem /home/gpc-94302/o3de-packages/packages/lz4-1.9.4-rev2-linux/lz4/include -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/AzFramework/CMakeFiles/AzFramework.dir/profile/Unity/unity_8_cxx.cxx.o -MF Code/Framework/AzFramework/CMakeFiles/AzFramework.dir/profile/Unity/unity_8_cxx.cxx.o.d -o Code/Framework/AzFramework/CMakeFiles/AzFramework.dir/profile/Unity/unity_8_cxx.cxx.o -c /home/gpc-94302/o3de/build/linux/Code/Framework/AzFramework/CMakeFiles/AzFramework.dir/Unity/unity_8_cxx.cxx
In file included from /home/gpc-94302/o3de/build/linux/Code/Framework/AzFramework/CMakeFiles/AzFramework.dir/Unity/unity_8_cxx.cxx:3:
/home/gpc-94302/o3de/Code/Framework/AzFramework/AzFramework/DocumentPropertyEditor/Reflection/LegacyReflectionBridge.cpp:702:33: error: variable 'elementName' set but not used [-Werror,-Wunused-but-set-variable]
                    const char* elementName = "";
                                ^
1 error generated.
[12/767] Building CXX object Code/Fram...rk.dir/profile/Unity/unity_2_cxx.cxx.o
ninja: build stopped: subcommand failed.

Adding [[maybe_unused]] to const char* elementName = ""; fixes this issue: o3de/Code/Framework/AzFramework/AzFramework/DocumentPropertyEditor/Reflection/LegacyReflectionBridge.cpp: const char* elementName = ""; -> [[maybe_unused]] const char* elementName = "";

This issue occurred on Ubuntu 22.04.2 LTS, but did not occur on Ubuntu 20.04.4 LTS. Here is a similar issue found and resolved recently: https://github.com/o3de/o3de/issues/16263

Steps to reproduce Steps to reproduce the behavior:

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

Expected behavior Engine is built.

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

Found in Branch Development (e4ed834)

Commit ID from o3de/o3de Repository e4ed834

Desktop/Device:

AMZN-daimini commented 1 year ago

Likely my bad, will have a fix up ASAP :)

AMZN-daimini commented 1 year ago

Issue should be solved now that this change has been submitted, which removed the offending lines: https://github.com/o3de/o3de/pull/16290

LB-KacperBieniek commented 1 year ago

Issue verified as fixed on Development (bc68edc).