mirror of
https://src.fedoraproject.org/rpms/llvm.git
synced 2024-11-28 02:34:52 +00:00
Only disable rpath during installation
We currently disable rpath during both build and install. Instead, we use LD_LIBRARY_PATH to allow the built clang to find the libLLVM.so etc objects. However, this does not work well if the system clang and the clang being built have the same version. During the build, we use both the system clang and the just-built clang, and they need to use the system and just-built shared objects respectively. However, use of LD_LIBRARY_PATH causes us to always use the just-built objects as long as the versions match. This is a problem in two scenarios: When building compat packages for the current system LLVM version, we mix system clang with compat libraries, which assume different paths. And when building release candidates, a build using a previous rc of a newer rc may use ABI-incompatible objects, because we don't version sonames on rc versions. Fix this by keeping the rpath during the build and only stripping it on installation using the CMAKE_SKIP_INSTALL_RPATH option. For manually installed binaries, we need to also manually strip the rpath using chrpath. This way system clang will use system libraries, and just-built clang will use just-built libraries.
This commit is contained in:
parent
4f254e51b9
commit
10f88a7d35
1 changed files with 11 additions and 3 deletions
14
llvm.spec
14
llvm.spec
|
@ -240,6 +240,7 @@ BuildRequires: gcc
|
||||||
BuildRequires: gcc-c++
|
BuildRequires: gcc-c++
|
||||||
BuildRequires: clang
|
BuildRequires: clang
|
||||||
BuildRequires: cmake
|
BuildRequires: cmake
|
||||||
|
BuildRequires: chrpath
|
||||||
BuildRequires: ninja-build
|
BuildRequires: ninja-build
|
||||||
BuildRequires: zlib-devel
|
BuildRequires: zlib-devel
|
||||||
BuildRequires: libffi-devel
|
BuildRequires: libffi-devel
|
||||||
|
@ -805,8 +806,6 @@ export ASMFLAGS="%{build_cflags}"
|
||||||
%define _find_debuginfo_dwz_opts %{nil}
|
%define _find_debuginfo_dwz_opts %{nil}
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:`pwd`/%{build_libdir}"
|
|
||||||
|
|
||||||
cd llvm
|
cd llvm
|
||||||
|
|
||||||
#region LLVM lit
|
#region LLVM lit
|
||||||
|
@ -941,11 +940,19 @@ popd
|
||||||
-DBUILD_SHARED_LIBS:BOOL=OFF \\\
|
-DBUILD_SHARED_LIBS:BOOL=OFF \\\
|
||||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \\\
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \\\
|
||||||
-DCMAKE_INSTALL_PREFIX=%{install_prefix} \\\
|
-DCMAKE_INSTALL_PREFIX=%{install_prefix} \\\
|
||||||
-DCMAKE_SKIP_RPATH:BOOL=ON \\\
|
|
||||||
-DENABLE_LINKER_BUILD_ID:BOOL=ON \\\
|
-DENABLE_LINKER_BUILD_ID:BOOL=ON \\\
|
||||||
-DOFFLOAD_INSTALL_LIBDIR=%{unprefixed_libdir} \\\
|
-DOFFLOAD_INSTALL_LIBDIR=%{unprefixed_libdir} \\\
|
||||||
-DPython3_EXECUTABLE=%{__python3}
|
-DPython3_EXECUTABLE=%{__python3}
|
||||||
|
|
||||||
|
# During the build, we use both the system clang and the just-built clang, and
|
||||||
|
# they need to use the system and just-built shared objects respectively. If
|
||||||
|
# we use LD_LIBRARY_PATH to point to our build directory, the system clang
|
||||||
|
# may use the just-built shared objects instead, which may not be compatible
|
||||||
|
# even if the version matches (e.g. when building compat libs or different rcs).
|
||||||
|
# Instead, we make use of rpath during the build and only strip it on
|
||||||
|
# installation using the CMAKE_SKIP_INSTALL_RPATH option.
|
||||||
|
%global cmake_config_args %{cmake_config_args} -DCMAKE_SKIP_INSTALL_RPATH:BOOL=ON
|
||||||
|
|
||||||
%if 0%{?fedora} || 0%{?rhel} > 9
|
%if 0%{?fedora} || 0%{?rhel} > 9
|
||||||
%global cmake_config_args %{cmake_config_args} -DPPC_LINUX_DEFAULT_IEEELONGDOUBLE=ON
|
%global cmake_config_args %{cmake_config_args} -DPPC_LINUX_DEFAULT_IEEELONGDOUBLE=ON
|
||||||
%endif
|
%endif
|
||||||
|
@ -1057,6 +1064,7 @@ mkdir -p %{buildroot}/%{_bindir}
|
||||||
for f in %{test_binaries}
|
for f in %{test_binaries}
|
||||||
do
|
do
|
||||||
install -m 0755 llvm/%{_vpath_builddir}/bin/$f %{buildroot}%{install_bindir}
|
install -m 0755 llvm/%{_vpath_builddir}/bin/$f %{buildroot}%{install_bindir}
|
||||||
|
chrpath --delete %{buildroot}%{install_bindir}/$f
|
||||||
done
|
done
|
||||||
|
|
||||||
# Install libraries needed for unittests
|
# Install libraries needed for unittests
|
||||||
|
|
Loading…
Reference in a new issue