Discussion:
rpmbuild SPEC file - shared library path
arnaud gaboury
2015-09-14 10:00:01 UTC
Permalink
I build my app with shared libraries. In my spec file, I source a
script which export LD_LIBRARY_PATH.
Below is how I proceed in my spec file:

************************************
%global _prod_dir /opt/intel/compilers_and_libraries_2016/linux
%global _mklroot_dir %{_prod_dir}/mkl
%global _mkllibpath %{_mklroot_dir}/lib/intel64_lin
%global _openmplibpath %{_prod_dir}/compiler/lib/intel64_lin
...............
%build
source /opt/intel/bin/compilervars.sh intel64
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:%{_mkllibpath}:%{_openmplibpath}:%{_builddir_full}/lib
..............
**************************************

make complains at one point about not finding one shared library:

/home/poisonivy/rpmbuild/BUILD/R-3.2.1/bin/exec/R: error while loading
shared libraries: libiomp5.so: cannot open shared object file: No such
file or directory

This library is indeed in %{_openmplibpath}. I conclude that
LD_LIBRARY_PATH has not been correctly populated in my build
environment.
Further evidence is to source /opt/intel/bin/compilervars.sh intel64
and export LD_LIBRARY_PATH in my shell environment before I start
rpmbuild. This way, there is no make error about the shared library.

I don't understand why variable LD_LIBRARY_PATH is not took into
account in my rpmbuild environment. Does the issue come from the
${LD_LIBRARY_PATH} env variable declaration? Maybe something like
%{....} ?

Thank you for hints.
--
google.com/+arnaudgabourygabx
--
devel mailing list
***@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedorapr
Jonathan Wakely
2015-09-14 12:26:35 UTC
Permalink
Post by arnaud gaboury
I build my app with shared libraries. In my spec file, I source a
script which export LD_LIBRARY_PATH.
************************************
%global _prod_dir /opt/intel/compilers_and_libraries_2016/linux
%global _mklroot_dir %{_prod_dir}/mkl
%global _mkllibpath %{_mklroot_dir}/lib/intel64_lin
%global _openmplibpath %{_prod_dir}/compiler/lib/intel64_lin
...............
%build
source /opt/intel/bin/compilervars.sh intel64
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:%{_mkllibpath}:%{_openmplibpath}:%{_builddir_full}/lib
..............
**************************************
/home/poisonivy/rpmbuild/BUILD/R-3.2.1/bin/exec/R: error while loading
shared libraries: libiomp5.so: cannot open shared object file: No such
file or directory
This library is indeed in %{_openmplibpath}. I conclude that
LD_LIBRARY_PATH has not been correctly populated in my build
environment.
Instead of guessing, make the %build section print it out so you can
check it:

echo $LD_LIBRARY_PATH
--
devel mailing list
***@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject
arnaud gaboury
2015-09-14 13:17:15 UTC
Permalink
Post by Jonathan Wakely
Post by arnaud gaboury
I build my app with shared libraries. In my spec file, I source a
script which export LD_LIBRARY_PATH.
************************************
%global _prod_dir /opt/intel/compilers_and_libraries_2016/linux
%global _mklroot_dir %{_prod_dir}/mkl
%global _mkllibpath %{_mklroot_dir}/lib/intel64_lin
%global _openmplibpath %{_prod_dir}/compiler/lib/intel64_lin
...............
%build
source /opt/intel/bin/compilervars.sh intel64
export
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:%{_mkllibpath}:%{_openmplibpath}:%{_builddir_full}/lib
..............
**************************************
/home/poisonivy/rpmbuild/BUILD/R-3.2.1/bin/exec/R: error while loading
shared libraries: libiomp5.so: cannot open shared object file: No such
file or directory
This library is indeed in %{_openmplibpath}. I conclude that
LD_LIBRARY_PATH has not been correctly populated in my build
environment.
Instead of guessing, make the %build section print it out so you can
echo $LD_LIBRARY_PATH
I just found the root of my issue. The LD_LIBRARY_PATH in my shell
environment was not correctly set. In fact, there are some issue in
the parallel_studio_xe_2016, with bad sylink who prevent to access
the correct path to the libraries. Once I corrected the path:

***@poppy ➤➤ ~/rpmbuild % ldd
/home/poisonivy/rpmbuild/BUILD/R-3.2.1/bin/exec/R
.....................
libiomp5.so => /opt/intel/compilers_and_libraries_2016.0.109/linux/compiler/lib/intel64_lin/libiomp5.so
(0x00007f4b8f7f9000)

The missing shared library is here. Nothing to do with my spec file
and build environment.
***@poppy ➤➤ ~/rpmbuild % echo $LD_LIBRARY_PATH
/opt/intel/compilers_and_libraries_2016.0.109/linux/compiler/lib/intel64_lin:/opt/intel/compilers_and_libraries_2016.0.9/mkl/lib/intel64_lin
Post by Jonathan Wakely
--
devel mailing list
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
--
google.com/+arnaudgabourygabx
--
devel mailing list
***@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: h
Loading...