Conversation
sentry.pc.in
Outdated
| @@ -0,0 +1,11 @@ | |||
| prefix=@PREFIX@ | |||
| exec_prefix=${prefix} | |||
| libdir=${prefix}/lib | |||
There was a problem hiding this comment.
Potential bug: The pkg-config template hardcodes the library directory to lib, but the actual installation may use lib64 on some systems, causing linker errors.
-
Description: The
pkg-configtemplate filesentry.pc.inhardcodes the library directory withlibdir=${prefix}/lib. However, the actual library installation uses theCMAKE_INSTALL_LIBDIRvariable, which resolves tolib64on many common 64-bit Linux distributions like RHEL, Fedora, and CentOS. This discrepancy causespkg-configto provide an incorrect library path to downstream projects. As a result, the linker will fail to find thesentrylibrary because it searches in the wrong directory, preventing dependent applications from building successfully on these platforms. -
Suggested fix: The
sentry.pc.intemplate should not hardcode thelibdir. Instead, it should be configured by CMake during the build process. Replace the hardcodedlibdir=${prefix}/libline with a placeholder likelibdir=@CMAKE_INSTALL_FULL_LIBDIR@. Then, inCMakeLists.txt, use theconfigure_filecommand to substitute this placeholder with the correct value fromCMAKE_INSTALL_LIBDIRwhen generating the finalsentry.pcfile.
severity: 0.75, confidence: 0.95
Did we get this right? 👍 / 👎 to inform future reviews.
610a789 to
67ba9b8
Compare
06fe500 to
c4b2054
Compare
- Added support for generating and installing a .pc file for pkg-config - Controlled by the SENTRY_INSTALL_PKGCONFIG CMake option - Uses CMAKE_INSTALL_LIBDIR and CMAKE_INSTALL_INCLUDEDIR to support non-standard layouts (e.g., lib64) - Installs the generated file to the standard pkg-config directory
c4b2054 to
7582025
Compare
Summary
.pcfile for pkg-configSENTRY_INSTALL_PKGCONFIGCMake optionsentry.pc.intemplate to generate the pkg-config file${CMAKE_INSTALL_LIBDIR}/pkgconfig)Benefits
This allows downstream projects to easily discover and link against sentry-native using pkg-config:
Test plan
SENTRY_INSTALL_PKGCONFIGenabledsentry.pcfile is generated in build directorysentry.pcfile is installed to correct location