Thursday, March 7, 2019

[Discuss-gnuradio] patch -- fix pkgconfig libs

From 2b1c8dde0fe4d4ae4b1b1bb623f3a7945b8cc014 Mon Sep 17 00:00:00 2001
From: "A. Maitland Bottoms" <bottoms@debian.org>
Date: Thu, 7 Mar 2019 20:02:10 -0500
Subject: [PATCH] fix pkgconfig libs

Lintian reported
pkg-config-references-unknown-shared-library
usr/lib/x86_64-linux-gnu/pkgconfig/gnuradio-runtime.pc -lgmpxx (line 10)
pkg-config-references-unknown-shared-library
usr/lib/x86_64-linux-gnu/pkgconfig/gnuradio-runtime.pc -lgmp (line 10)

from the pkg-config man page:
"Libs: This line should give the link flags specific to your package.
Don't add any flags for required packages; pkg-config will add those
automatically."

No need to have a CMake variable to keep track of these. Just let ld work.
---
cmake/Modules/FindGMP.cmake | 1 -
cmake/Modules/FindMPIR.cmake | 1 -
cmake/Modules/FindMPLIB.cmake | 2 --
gnuradio-runtime/CMakeLists.txt | 1 -
gnuradio-runtime/gnuradio-runtime.pc.in | 2 +-
5 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/cmake/Modules/FindGMP.cmake b/cmake/Modules/FindGMP.cmake
index 8782334e80..b2fe51d328 100644
--- a/cmake/Modules/FindGMP.cmake
+++ b/cmake/Modules/FindGMP.cmake
@@ -38,7 +38,6 @@ find_library(
/usr/lib64
)
set(GMP_LIBRARIES ${GMPXX_LIBRARY} ${GMP_LIBRARY})
-set(GMP_PC_ADD_LIBS "-lgmpxx -lgmp")

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GMP DEFAULT_MSG GMPXX_LIBRARY GMP_LIBRARY GMP_INCLUDE_DIR)
diff --git a/cmake/Modules/FindMPIR.cmake b/cmake/Modules/FindMPIR.cmake
index 647b3815a4..1ba5682484 100644
--- a/cmake/Modules/FindMPIR.cmake
+++ b/cmake/Modules/FindMPIR.cmake
@@ -38,7 +38,6 @@ find_library(
/usr/lib64
)
set(MPIR_LIBRARIES ${MPIRXX_LIBRARY} ${MPIR_LIBRARY})
-set(MPIR_PC_ADD_LIBS "-lmpirxx -lmpir")

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MPIR DEFAULT_MSG MPIRXX_LIBRARY MPIR_LIBRARY MPIR_INCLUDE_DIR)
diff --git a/cmake/Modules/FindMPLIB.cmake b/cmake/Modules/FindMPLIB.cmake
index 37673b136b..7353604cad 100644
--- a/cmake/Modules/FindMPLIB.cmake
+++ b/cmake/Modules/FindMPLIB.cmake
@@ -8,7 +8,6 @@ if(GMP_FOUND)
set(MPLIB_LIBRARY ${GMP_LIBRARY})
set(MPLIBXX_LIBRARY ${GMPXX_LIBRARY})
set(MPLIB_PC_ADD_CFLAGS ${GMP_PC_ADD_CFLAGS})
- set(MPLIB_PC_ADD_LIBS ${GMP_PC_ADD_LIBS})
else(GMP_FOUND)
set(GR_MPLIB_MPIR True)
set(MPLIB_DEFINITIONS "-DGR_MPLIB_MPIR" ${MPIR_DEFINITIONS})
@@ -16,7 +15,6 @@ else(GMP_FOUND)
set(MPLIB_LIBRARY ${MPIR_LIBRARY})
set(MPLIBXX_LIBRARY ${MPIRXX_LIBRARY})
set(MPLIB_PC_ADD_CFLAGS ${MPIR_PC_ADD_CFLAGS})
- set(MPLIB_PC_ADD_LIBS ${MPIR_PC_ADD_LIBS})
endif(GMP_FOUND)

set(MPLIB_INCLUDE_DIRS ${MPLIB_INCLUDE_DIR})
diff --git a/gnuradio-runtime/CMakeLists.txt b/gnuradio-runtime/CMakeLists.txt
index e24ffab344..f53adc7b7c 100644
--- a/gnuradio-runtime/CMakeLists.txt
+++ b/gnuradio-runtime/CMakeLists.txt
@@ -84,7 +84,6 @@ install(FILES
DESTINATION ${GR_PREFSDIR}
)

-set(PC_ADD_LIBS "${MPLIB_PC_ADD_LIBS} ${PC_ADD_LIBS}")
set(PC_ADD_CFLAGS ${MPLIB_PC_ADD_CFLAGS})

########################################################################
diff --git a/gnuradio-runtime/gnuradio-runtime.pc.in b/gnuradio-runtime/gnuradio-runtime.pc.in
index 280adaddd1..e10deceb97 100644
--- a/gnuradio-runtime/gnuradio-runtime.pc.in
+++ b/gnuradio-runtime/gnuradio-runtime.pc.in
@@ -7,5 +7,5 @@ Name: gnuradio-runtime
Description: GNU Radio core runtime infrastructure
Requires:
Version: @LIBVER@
-Libs: -L${libdir} -lgnuradio-runtime -lgnuradio-pmt @PC_ADD_LIBS@
+Libs: -L${libdir} -lgnuradio-runtime -lgnuradio-pmt
Cflags: -I${includedir} @PC_ADD_CFLAGS@
--
2.11.0

As part of the goal to fix bugs for a 3.8, please consider this patch
against current gnuradio master.

A small patch for the build system.
It removes a few lines and a few variables of CMake,
and yields a better gnuradio-runtime.pc file.

Looking forward to 3.8,
-Maitland

enc:
fix-pkgconfig-libs.patch
can be applied to git via
`git am fix-pkgconfig-libs.patch`

No comments:

Post a Comment