Incorrect libdir in pkg-config files
blue42u opened this issue · 0 comments
In some cases, the generated libze_loader.pc
and level-zero.pc
produce a -L
flag (i.e. set libdir
) to a path that doesn't contain any of the libze*.so
libraries. On RPM-based platforms this results in link failures if the libraries are not installed to a default path (cannot find -lze_loader: No such file or directory
), since the path produced refers to lib
and not the canonical lib64
.
For example, when installing to /usr
the libdir
is missing the architecture triple:
$ cmake -DCMAKE_INSTALL_PREFIX=/usr ..
$ make package
$ dpkg-deb -c level-zero-devel_1.15.8+d_amd64.deb | grep 'libze_[^/]*\.so'
lrwxrwxrwx root/root 0 2024-02-01 16:57 ./usr/lib/x86_64-linux-gnu/libze_loader.so -> libze_loader.so.1
lrwxrwxrwx root/root 0 2024-02-01 16:57 ./usr/lib/x86_64-linux-gnu/libze_tracing_layer.so -> libze_tracing_layer.so.1
lrwxrwxrwx root/root 0 2024-02-01 16:57 ./usr/lib/x86_64-linux-gnu/libze_validation_layer.so -> libze_validation_layer.so.1
$ dpkg-deb --fsys-tarfile level-zero-devel_1.15.8+d_amd64.deb | tar xO ./usr/lib/x86_64-linux-gnu/pkgconfig/libze_loader.pc | head -n3
prefix=/usr
includedir=${prefix}/include
libdir=${prefix}/lib # Should be ${prefix}/lib/x86_64-linux-gnu
When installing to a custom prefix with a custom library subdirectory, the subdirectory is missing from libdir
:
$ cmake -DCMAKE_INSTALL_PREFIX=/my/install/prefix -DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu ..
$ make package
$ dpkg-deb -c level-zero-devel_1.15.8+d_amd64.deb | grep 'libze_[^/]*\.so'
lrwxrwxrwx root/root 0 2024-02-01 17:09 ./my/install/prefix/lib/level_zero/libze_loader.so -> libze_loader.so.1
lrwxrwxrwx root/root 0 2024-02-01 17:09 ./my/install/prefix/lib/level_zero/libze_tracing_layer.so -> libze_tracing_layer.so.1
lrwxrwxrwx root/root 0 2024-02-01 17:09 ./my/install/prefix/lib/level_zero/libze_validation_layer.so -> libze_validation_layer.so.1
$ dpkg-deb --fsys-tarfile level-zero-devel_1.15.8+d_amd64.deb | tar xO ./my/install/prefix/lib/level_zero/pkgconfig/libze_loader.pc | head -n3
prefix=/my/install/prefix
includedir=${prefix}/include
libdir=${prefix}/lib # Should be ${prefix}/lib/level_zero
The situation is even more dire on RPM-based platforms. If /my/install/prefix/lib64
is not already on the LIBRARY_PATH
this setup will result in link failures:
$ cmake -DCMAKE_INSTALL_PREFIX=/my/install/prefix ..
$ make package
$ rpm -qlp level-zero-devel-1.15.8-a8.9.x86_64.rpm | grep 'libze_[^/]*\.so'
/my/install/prefix/lib64/libze_loader.so
/my/install/prefix/lib64/libze_tracing_layer.so
/my/install/prefix/lib64/libze_validation_layer.so
$ rpm2cpio level-zero-devel-1.15.8-a8.9.x86_64.rpm | cpio -iv --to-stdout ./my/install/prefix/lib64/pkgconfig/libze_loader.pc | head -n3
./my/install/prefix/lib64/pkgconfig/libze_loader.pc
prefix=/my/install/prefix
includedir=${prefix}/include
libdir=${prefix}/lib # Should be ${prefix}/lib64