Set R(UN)PATH to fix running

```
[user@rosa2019 tmp]$ /opt/llvm11/bin/clang c.c
/opt/llvm11/bin/clang: error while loading shared libraries: libclang-cpp.so.11: cannot open shared object file: No such file or directory
[user@rosa2019 tmp]$ LD_LIBRARY_PATH=/opt/llvm11/lib64 /opt/llvm11/bin/clang c.c
[user@rosa2019 tmp]$ ./a.out
[user@rosa2019 tmp]$
```
This commit is contained in:
Mikhail Novosyolov 2021-01-20 15:12:25 +03:00
parent c0c17f776c
commit b71cbaa7a0

View file

@ -12,6 +12,9 @@
%define debugcflags %{nil}
%define debug_package %{nil}
%global optflags %{optflags} -fno-strict-aliasing
%global ldflags %{ldflags} -Wl,-rpath,%{_libdir}
# clang header paths are hard-coded at compile time
# and need adjustment whenever there's a new GCC version
%define gcc_version %(gcc -dumpversion)
@ -25,7 +28,7 @@ Summary: LLVM and Clang in %{_prefix}
# llvm11
Name: llvm%{maj_ver}
Version: %{maj_ver}.0.1
Release: 1
Release: 2
License: NCSA
Group: Development/Other
Url: http://llvm.org
@ -49,6 +52,8 @@ BuildRequires: libstdc++-devel
BuildRequires: libtool
BuildRequires: pkgconfig(libffi)
BuildRequires: pkgconfig(libtirpc)
# patchelf is for %%check
BuildRequires: patchelf
BuildRequires: sed
BuildRequires: tcl
BuildRequires: zip
@ -150,7 +155,6 @@ cd tools/clang
cd -
%build
%global optflags %{optflags} -fno-strict-aliasing
# Build with gcc/g++, not clang if it happens to be installed
export CC=gcc
export CXX=g++
@ -227,3 +231,6 @@ cp -a build/%{_lib}/LLVMHello.so %{buildroot}%{_libdir}
# Versionize shebangs python
sed '1 s,^.*$,#!%{__python3},' -i %{buildroot}%{_bindir}/{hmaptool,scan-view}
%check
patchelf --print-rpath %{buildroot}%{_bindir}/clang | grep -q %{_libdir}