summaryrefslogtreecommitdiff
path: root/sci-mathematics/plfit/files/plfit-0.9.4-underlinking.patch
blob: 5574756e35f46d8f6082cd0a6a5c4b0166fce710 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From 0559e4683ec72d7608560414d8d6797f83c74ea7 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <michael@orlitzky.com>
Date: Fri, 8 Mar 2024 17:17:45 -0500
Subject: [PATCH] src/CMakeLists.txt: link libplfit against $MATH_LIBRARY

The libplfit library makes use of several math functions (exp, log,
...) , and so should be linked to libm directly when libm is required
for those functions. If it is not, then compilation may succeed
leaving the resulting library underlinked. This can lead to errors
like,

  test_discrete: symbol lookup error: .../src/libplfit.so.0: undefined
  symbol: log

when linking with lld and LDFLAGS="Wl,--as-needed". (The error above
comes from plfit's own test suite.)

Gentoo-bug: https://bugs.gentoo.org/926433
---
 src/CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fbfb3e8..3dd50fb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -13,6 +13,7 @@ set(PLFIT_CORE_SRCS error.c gss.c kolmogorov.c lbfgs.c mt.c platform.c plfit.c o
 add_library(plfit ${PLFIT_CORE_SRCS})
 target_include_directories(plfit PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
 set_target_properties(plfit PROPERTIES SOVERSION 0)
+target_link_libraries(plfit ${MATH_LIBRARY})
 
 if(PLFIT_USE_OPENMP AND OPENMP_FOUND)
     target_link_libraries(plfit OpenMP::OpenMP_C)
-- 
2.43.0