Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build broken on Ubuntu noble due to redefining -D_FORTIFY_SOURCE #320

Open
tjaalton opened this issue Feb 29, 2024 · 2 comments
Open

Build broken on Ubuntu noble due to redefining -D_FORTIFY_SOURCE #320

tjaalton opened this issue Feb 29, 2024 · 2 comments

Comments

@tjaalton
Copy link

cd /<<PKGBUILDDIR>>/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /<<PKGBUILDDIR>> /<<PKGBUILDDIR>>/IGC/GenISAIntrinsics /<<PKGBUILDDIR>>/build /<<PKGBUILDDIR>>/build/IGC/GenISAIntrinsics /<<PKGBUILDDIR>>/build/IGC/GenISAIntrinsics/CMakeFiles/GenISAIntrinsics.dir/DependInfo.cmake "--color="
make[4]: Leaving directory '/<<PKGBUILDDIR>>/build'
make  -f IGC/GenISAIntrinsics/CMakeFiles/GenISAIntrinsics.dir/build.make IGC/GenISAIntrinsics/CMakeFiles/GenISAIntrinsics.dir/build
make[4]: Entering directory '/<<PKGBUILDDIR>>/build'
[  0%] Building CXX object IGC/GenISAIntrinsics/CMakeFiles/GenISAIntrinsics.dir/__/Release/GenIntrinsicDefinition.cpp.o
cd /<<PKGBUILDDIR>>/build/IGC/GenISAIntrinsics && /usr/bin/c++ -DCL_KHR_FP64_EXT -DGHAL3D=USC -DICBE_LINUX -DIGC_CMAKE -DIGC_EXPORTS=1 -DIGC_SPIRV_ENABLED -DIGC_SPIRV_TOOLS_ENABLED -DIGC_VC_ENABLED -DINSIDE_PLUGIN -DISTDLIB_UMD -DLINUX -DLLVM_VERSION_MAJOR=14 -DNDEBUG -DNOMINMAX -DSTD_CALL -DUSC_EXPORTS=1 -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -DUSE_SSE3 -DUSE_SSSE3 -D_AMD64_ -D_COMPILER_DLL_ -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_IGC_ -D_SCL_SECURE_NO_WARNINGS -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -I/<<PKGBUILDDIR>> -I/<<PKGBUILDDIR>>/IGC/WrapperLLVM/include -I/<<PKGBUILDDIR>>/build/IGC/autogen -I/<<PKGBUILDDIR>>/IGC -I/<<PKGBUILDDIR>>/IGC/common -I/<<PKGBUILDDIR>>/IGC/.. -I/<<PKGBUILDDIR>>/IGC/../Common -I/<<PKGBUILDDIR>>/IGC/../3d/common -I/<<PKGBUILDDIR>>/IGC/../inc -I/<<PKGBUILDDIR>>/IGC/../inc/common -I/<<PKGBUILDDIR>>/IGC/../inc/common/Compiler -I/<<PKGBUILDDIR>>/IGC/../inc/common/Compiler/API -I/<<PKGBUILDDIR>>/IGC/../visa/include -I/<<PKGBUILDDIR>>/build/IGC/Release -I/<<PKGBUILDDIR>>/build/IGC -I/<<PKGBUILDDIR>>/IGC/AdaptorOCL/ocl_igc_shared/executable_format -I/<<PKGBUILDDIR>>/IGC/AdaptorOCL -I/<<PKGBUILDDIR>>/build/IGC/AdaptorOCL/ocl_igc_interface/impl -I/<<PKGBUILDDIR>>/IGC/Options -I/<<PKGBUILDDIR>>/IGC/Options/include -I/<<PKGBUILDDIR>>/build/IGC/Options/include -I/<<PKGBUILDDIR>>/IGC/../inc/common/Compiler/common -I/<<PKGBUILDDIR>>/IGC/AdaptorOCL/cif/cif/.. -I/<<PKGBUILDDIR>>/IGC/ZEBinWriter/zebin/source -I/<<PKGBUILDDIR>>/IGC/ZEBinWriter/zebin/source/autogen -I/include -I/usr/lib/x86_64-linux-gnu/cmake/SPIRV-Tools/../../../include -I/<<PKGBUILDDIR>>/IGC/GenISAIntrinsics -isystem /usr/lib/llvm-14/include -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fdebug-prefix-map=/<<PKGBUILDDIR>>=/usr/src/intel-graphics-compiler-1.0.15468.25-2 -Wdate-time -fexceptions -fdata-sections -ffunction-sections -O2 -pipe -fmessage-length=0 -march=corei7 -mstackrealign -fms-extensions -Werror -Wno-unused-parameter -Wno-missing-field-initializers -Wwrite-strings -Wno-long-long -Wswitch -Wno-sign-compare -Wno-unused-result -Wno-enum-compare -Wno-type-limits -Wno-ignored-qualifiers -Wno-shadow -Wformat-security -Wno-extra -Wno-write-strings -finline -fno-strict-aliasing -msse -msse2 -msse3 -mssse3 -msse4 -msse4.1 -msse4.2 -Wno-unknown-pragmas -fPIC -Bsymbolic -D_FORTIFY_SOURCE=2 -fstack-protector -finline-functions -funswitch-loops -Wno-maybe-uninitialized -lrt -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -DNDEBUG -g -std=gnu++17 -MD -MT IGC/GenISAIntrinsics/CMakeFiles/GenISAIntrinsics.dir/__/Release/GenIntrinsicDefinition.cpp.o -MF CMakeFiles/GenISAIntrinsics.dir/__/Release/GenIntrinsicDefinition.cpp.o.d -o CMakeFiles/GenISAIntrinsics.dir/__/Release/GenIntrinsicDefinition.cpp.o -c /<<PKGBUILDDIR>>/build/IGC/Release/GenIntrinsicDefinition.cpp
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition

so please add -U_FORTIFY_SOURCE before defining it in IGC/CMakeLists.txt

@hector-cao
Copy link

An alternative solution would be to make IGC/CMakeLists.txt aware of the presence of D_FORTIFY_SOURCE in the environment and skip defining it again (or in case you strongly want to set the value of _FORTIFY_SOURCE to 2 for some reasons, undefine it first with -U as @tjaalton proposed)

@eero-t
Copy link

eero-t commented May 10, 2024

An alternative solution would be to make IGC/CMakeLists.txt aware of the presence of D_FORTIFY_SOURCE in the environment and skip defining it again (or in case you strongly want to set the value of _FORTIFY_SOURCE to 2 for some reasons, undefine it first with -U as @tjaalton proposed)

@pszymich Ubuntu updating its FORTIFY_SOURCE value of 2 in 22.04, to 3 in 24.04: https://ubuntu.com/blog/whats-new-in-security-for-ubuntu-24-04-lts

Is not the only distro doing such change. Fedora did similar change in 38: https://fedoraproject.org/wiki/Changes/Add_FORTIFY_SOURCE%3D3_to_distribution_build_flags

So that change is going to eventually propagate to RHEL too...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants