| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…sing The fallback for systems with no mpdecimal .pc files used AC_LINK_IFELSE directly, which relied on LIBMPDEC_LIBS being set. On failure this was empty so the link test ran without -lmpdec. Use AC_CHECK_HEADER and AC_CHECK_LIB instead.
|
Found when trying to test what configure options to add for my buildbots and I saw the _decimal module wasn't actually building on centos stream 9 and 10, because they ship mpdecimal 2.5.1, hence no .pc files. I followed the convention of other libraries. |
Sorry, something went wrong.
|
Could you please add a news entry? |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM (modulo news entry)
Thanks for fixing this, it was my fault to believe, that pkg-config support was introduced in v2.5.0. But it was v4.0.0.
(Tested with v2.5.0)
Sorry, something went wrong.
Sorry, something went wrong.
|
How can I test this change? I need a system with libmpdec library and header files installed, but where pkg-config 'libmpdec >= 2.5.0' --libs fails? Can I replace libmpdec >= 2.5.0 with libmpdec >= 55.0 to test the change for example? What is the expected behavior? |
Sorry, something went wrong.
You can install libmpdec from sources for versions < 4.0.0. (./configure && make all install) I also checked Debian and derivatives, nobody ships *.pc files as a patch :(. |
Sorry, something went wrong.
|
I applied the following change on configure.ac and I ran make regen-configure. diff --git a/configure.ac b/configure.ac
index c8dce3fd49b..b9020368664 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4376,7 +4376,7 @@ if test "$ac_cv_ffi_complex_double_supported" = "yes"; then
fi
dnl Check for libmpdec >= 2.5.0
-PKG_CHECK_MODULES([LIBMPDEC], [libmpdec >= 2.5.0], [have_mpdec=yes], [
+PKG_CHECK_MODULES([LIBMPDEC], [libmpdec >= 55.0], [have_mpdec=yes], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $LIBMPDEC_CFLAGS"
LIBS="$LIBS $LIBMPDEC_LIBS"./configure fails to locate libmpdecimal: checking for libmpdec >= 55.0... no ... checking for stdlib extension module _decimal... missing I downloaded this PR, made a similar ./configure.ac change, and ran make regen-configure. This time, it succeeded: checking for libmpdec >= 55.0... no checking for mpdecimal.h... (cached) yes checking for mpd_version in -lmpdec... (cached) yes ... checking for stdlib extension module _decimal... yes I get these flags in Makefile: $ grep ^MODULE__DECIMAL Makefile MODULE__DECIMAL_STATE=yes MODULE__DECIMAL_CFLAGS= -DTEST_COVERAGE MODULE__DECIMAL_LDFLAGS=-lmpdec -lm Python builds successfully and I can import the decimal module. |
Sorry, something went wrong.
| ], [const char *x = mpd_version();])], | ||
| [have_mpdec=yes], | ||
| [have_mpdec=no]) | ||
| AC_CHECK_HEADER([mpdecimal.h], [ |
There was a problem hiding this comment.
AC_CHECK_HEADER([mpdecimal.h] seems to be redundant to me. Is it really useful? We already check we can build/link a C program which starts with #include <mpdecimal.h> (below).
Sorry, something went wrong.
There was a problem hiding this comment.
I think it's good to have it there for the helpful error message, referencing that the header is missing aka "checking for mpdecimal.h... no". In the case the library is there without the header it will move on to compile the program with "checking for mpd_version in -lmpdec... yes" and then fail.
Sorry, something went wrong.
There was a problem hiding this comment.
Agreed. These checks are logically distinct: first is for the header, next is for the library version.
Sorry, something went wrong.
|
Merged, thanks for the fix. The 3.15 branch has different code in configure.ac, it doesn't seem to be affected. |
Sorry, something went wrong.
Old releases are affected. But in such cases the fallback is using bundled libmpdec, instead of undetected from the system. I think it's less severe issue, probably not worth to be fixed. |
Sorry, something went wrong.
I don't see any issues via testing on previous branches, some stale makefile rules but if the system libmpdec option is used then it will properly link to that one without building the bundled one. |
Sorry, something went wrong.
I don't understand how this could be. See code e.g. in the v3.14: Lines 4218 to 4232 in 7756f59 If PKG_CHECK_MODULES() fails - USE_BUNDLED_LIBMPDEC() is used with with_system_libmpdec=no. |
Sorry, something went wrong.
USE_BUNDLED_LIBMPDEC() is the argument to AS_VAR_IF() so it won't fall through if PKG_CHECK_MODULES() fails. I've also verified this on a Centos Stream 9 machine on the 3.14 branch, no bundled object files and _decimal.so is linked against the system library (assuming of course I tested properly). |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
The fallback for systems with no mpdecimal .pc files used AC_LINK_IFELSE directly, which relied on LIBMPDEC_LIBS being set. On failure this was empty so the link test ran without -lmpdec.
Use AC_CHECK_HEADER and AC_CHECK_LIB instead.