Closed RarogCmex closed 1 month ago
I've tried to add -fPIC manually in Gentoo ebuild, but it still builds without Here it the complete build log with all circumstances: build.log
Thanks for reporting, @RarogCmex. Are you able to provide the full cmake invocation used?
Are you able to provide the full cmake invocation used?
If it doesn't have in build log, I'm not able.
I think incorrect behavior of cmake can be caused by https://github.com/GPUOpen-Drivers/llpc/blob/dev/tool/vfx/Makefile.apicompilertoolvfx However, I am not C++ programmer, so I'm not sure.
I found this in the log:
cmake -C /var/tmp/portage/media-libs/amdvlk-2021.4.2/work/xgl_build-abi_x86_64.amd64/gentoo_common_config.cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_WAYLAND_SUPPORT=yes -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/media-libs/amdvlk-2021.4.2/work/xgl_build-abi_x86_64.amd64/gentoo_toolchain.cmake /var/tmp/portage/media-libs/amdvlk-2021.4.2/work/xgl
Where can we find the gentoo .cmake
files?
I should brief introduce you into Gentoo Ebuild system. It uses ebuild files, in ebuild there are eclass methods, which performs build. In ebuild there are cmake_compile method (may be hidden if we use default ones) which perform cmake build
gentoo_common_config.cmake comes from cmake-utils.eclass helper: https://github.com/gentoo/gentoo/blob/master/eclass/cmake-utils.eclass
local common_config=${BUILD_DIR}/gentoo_common_config.cmake
local libdir=$(get_libdir)
cat > "${common_config}" <<- _EOF_ || die
SET (CMAKE_GENTOO_BUILD ON CACHE BOOL "Indicate Gentoo package build")
SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" FORCE)
SET (CMAKE_INSTALL_LIBDIR ${libdir} CACHE PATH "Output directory for libraries")
SET (CMAKE_INSTALL_INFODIR "${EPREFIX}/usr/share/info" CACHE PATH "")
SET (CMAKE_INSTALL_MANDIR "${EPREFIX}/usr/share/man" CACHE PATH "")
SET (CMAKE_USER_MAKE_RULES_OVERRIDE "${build_rules}" CACHE FILEPATH "Gentoo override rules")
_EOF_
I've pack all generated .cmake files: cmake-files.tar.gz
Also Gentoo ebuild file (instructions for Gentoo portage package manager) amdvlk-2021.4.2.ebuild.zip
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: compiler/vfx/libvfx.a(vfxParser.cpp.o): relocation R_X86_64_PC32 against symbol `_ZN3Vfx7Section13m_sectionInfoB5cxx11E' can not be used when making a shared object; recompile with -fPIC
This kind of error occurs when you've compiled something with -fPIC
(default on Gentoo) and try to link it to something that has not been compiled with -fPIC
. Very likely the sources contain something that has been pre-compiled without -fPIC
, the solution is usually to delete the pre-compiled file and force it to be rebuild by the build system. If that doesn't work you can try building the entire thing without -fPIC
(though that might cause problems down the line).
@AndrewAmmerlaan Sorry, sure, cpt. Obvious. I've wondering why llpc/tool/vfx/vfxParser.cpp are building without -fPIC despite it should be build with it and there is no other visible reasons why it shouldn't. Even if I force -fPIC it builds without, so reason for this exist, but I can't find it.
I'm Gentoo Linux proxy maintainer, working for packaging AMDVLK for Gentoo. There are weird bug where
Here is the build stage of vfxParser.cpp.o from log:
It does not have -fPIC flag