Error compilation - redefinition of __cpuidex
Created by: ChugunovRoman
Hi. I clone Open X-Ray repo, install all dev deps and exec next steps:
- mkdir bin && cd bin
- cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib
- make -j8
And I got error redefinition of void __cpuidex
:
Output
home/ruut/Projects/otherProjects/xray-16/src/xrCore/xrCore.cpp: In member function ‘void xrCore::Initialize(pcstr, pcstr, LogCallback, bool, pcstr, bool)’: /home/ruut/Projects/otherProjects/xray-16/src/xrCore/xrCore.cpp:185:30: warning: passing NULL to non-pointer argument 1 of ‘void Threading::SetThreadName(Threading::ThreadHandle, pcstr)’ [-Wconversion-null] 185 | Threading::SetThreadName(NULL, "X-Ray Primary thread"); | ^~~~ In file included from /home/ruut/Projects/otherProjects/xray-16/src/xrCore/xrCore.h:113, from /home/ruut/Projects/otherProjects/xray-16/src/xrCore/stdafx.h:6, from /home/ruut/Projects/otherProjects/xray-16/bin/src/xrCore/CMakeFiles/xrCore.dir/cmake_pch.hxx:5, from : /home/ruut/Projects/otherProjects/xray-16/src/xrCore/Threading/ThreadUtil.h:30:44: note: declared here 30 | XRCORE_API void SetThreadName(ThreadHandle threadHandle, pcstr name); | ~~~~~~~~~~~~~^~~~~~~~~~~~ [ 13%] Building CXX object src/xrCore/CMakeFiles/xrCore.dir/xrstring.cpp.o /home/ruut/Projects/otherProjects/xray-16/src/xrCore/xr_cpuid.cpp:51:6: error: redefinition of ‘void __cpuidex(int*, int, int)’ 51 | void __cpuidex(int regs[4], int i, int j) { nativeCpuId(regs, i); } | ^~~~~~~~~ In file included from /home/ruut/Projects/otherProjects/xray-16/src/xrCore/xr_cpuid.cpp:8: /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include/cpuid.h:334:1: note: ‘void __cpuidex(int*, int, int)’ previously defined here 334 | __cpuidex (int __cpuid_info[4], int __leaf, int __subleaf) | ^~~~~~~~~ make[2]: *** [src/xrCore/CMakeFiles/xrCore.dir/build.make:525: src/xrCore/CMakeFiles/xrCore.dir/xr_cpuid.cpp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... [ 13%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/class_registry.cpp.o [ 13%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/class_rep.cpp.o [ 13%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/create_class.cpp.o [ 13%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/error.cpp.o [ 13%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/exception_handler.cpp.o make[1]: *** [CMakeFiles/Makefile2:1274: src/xrCore/CMakeFiles/xrCore.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 13%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/function.cpp.o [ 13%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/function_introspection.cpp.o [ 13%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/headertest.cpp.o [ 14%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/inheritance.cpp.o [ 14%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/link_compatibility.cpp.o [ 14%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/memory.cpp.o [ 14%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/object_rep.cpp.o [ 14%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/open.cpp.o [ 14%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/operator.cpp.o [ 14%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/pcall.cpp.o [ 14%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/scope.cpp.o [ 14%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/set_package_preload.cpp.o [ 14%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/stack_content_by_name.cpp.o [ 14%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/weak_ref.cpp.o [ 14%] Building CXX object Externals/luabind/src/CMakeFiles/xrLuabind.dir/wrapper_base.cpp.o [ 14%] Linking CXX shared library ../../../x64/Debug/xrLuabind.so [ 14%] Built target xrLuabind make: *** [Makefile:156: all] Error 2
uname -a:
Linux arch-linux 5.12.7-arch1-1 #1 SMP PREEMPT Wed, 26 May 2021 22:03:57 +0000 x86_64 GNU/Linux
When I commented definition of __cpuidex
in src/xrCore/xr_cpuid.cpp
the code compile successful.
Should I build with other version of gcc or this is a bug? Can you advise me please