View Issue Details

IDProjectCategoryView StatusLast Update
0000127file[All Projects] Generalpublic2019-12-24 17:41
ReporterpierreAssigned Tochristos 
PrioritynormalSeverityminorReproducibilityalways
Status feedbackResolutionopen 
PlatformLinux from scratchOSGNU/LinuxOS Version
Product Version5.38 
Target VersionFixed in Version 
Summary0000127: Problems building when only a static libbz2 is installed
DescriptionThere are two issues actually, the second one I think can be easily fixed:
1. When building file in chapter 5 of LFS (http://www.linuxfromscratch.org/lfs/view/development/), there is only libbz2.a available.
This leads to an error when linking libmagic, since it tries to link a shared library with a static one. This can be worked around in two ways (either --disable-bzlib, or --disable-shared --enable-static), but maybe there could be a check somewhere to rpevent this from happening.
2. Now, when building in chapter 6, the libbz2 library is not found by configure, but the bzip.h header is found. This leads correctly to /* #undef BZLIBSUPPORT */ and #define HAVE_BZLIB_H 1 in config.h. But then, src/compress.c has:

#if defined(HAVE_BZLIB_H) || defined(BZLIBSUPPORT)
#define BUILTIN_BZLIB
#include <bzlib.h>
#endif

then

#ifdef BUILTIN_BZLIB
private int uncompressbzlib(const unsigned char *, unsigned char **, size_t,
    size_t *);
#endif

so that BZ2_bzDecompressInit is called, and leads to undefined symbols...
Steps To ReproduceRemove libbz2.so - > first issue
Remove libbz2.* and keep /usr/include/bzip.h -> second issue
Additional InformationI guess the second issue is because the stanza in compress.c should be:

#if defined(HAVE_BZLIB_H) && defined(BZLIBSUPPORT)
#define BUILTIN_BZLIB
#include <bzlib.h>
#endif

(change || to &&, as is done with zlib). Note that I think there is the same issue with xz, but I have not tested.
Tagscompression

Activities

christos

2019-12-24 17:41

manager   ~0003340

I fixed the ifdef's but I don't see an easy way to check for shared libraries in autoconf: https://www.gnu.org/software/gnulib/manual/html_node/Searching-for-Libraries.html

Issue History

Date Modified Username Field Change
2019-12-21 08:31 pierre New Issue
2019-12-21 08:31 pierre Tag Attached: compression
2019-12-24 17:37 christos Assigned To => christos
2019-12-24 17:37 christos Status new => assigned
2019-12-24 17:41 christos Status assigned => feedback
2019-12-24 17:41 christos Note Added: 0003340