Open deldotbrain opened 3 weeks ago
I've thought of this discrepancy in the last few weeks, but haven't had the peace of mind to figure out a solution.
I'm not at all convinced that the user CFLAGS should be the same as the build CFLAGS. it shouldn't be necessary... but perhaps we'll have to in some sort of interim.
Prerequisites
LTC_ARGCHK 'ltc_mp.name != NULL' failure ...
). c.f. Ch. "Math Descriptors" of the developer manual.Description
I opened nixos/nixpkgs#346707 against nixpkgs while packaging an application that used its shared libtomcrypt library. Before I hack around the issue in nixpkgs, I thought I should report it here.
The pkg-config file installed by libtomcrypt doesn't capture the CFLAGS that LTC was built with. Applications using pkg-config to link against a shared LTC library will not automatically build with the same CFLAGS as LTC, which can cause problems.
For some flags (e.g(Edit: I see that since the release of 1.18.2, a change was made so theLTM_DESC
in the application I was packaging), that's a nuisance.LTM_DESC
flag is captured in the pkg-config file)However, for the
LTC_PTHREAD
flag specifically, it can cause a major bug. SinceLTC_PTHREAD
changes the size ofstruct prng_state
, building LTC with it enabled (as nixpkgs does), then using pkg-config to build an application against it causes e.g.rng_make_prng()
to overwrite glibc's malloc metadata and crash the program.Steps to Reproduce
The test program will crash and burn with a failed assertion from glibc.
Version
libtomcrypt 1.18.2
GCC 13.3.0 with glibc 2.39-52 on NixOS unstable (24.11)