dslm4515 / CMLFS

Clang-Built Musl Linux From Scratch
MIT License
99 stars 18 forks source link

perl fails to build with zlib-ng #20

Open dslm4515 opened 3 years ago

dslm4515 commented 3 years ago

Looks like zlib-ng (with zlib-compat) isn't compatible with perl?

Perl fails to build:

In file included from Zlib.xs:34:
/usr/include/zlib.h:1781:31: error: unknown type name 'gzFile'
Z_EXTERN int Z_EXPORT gzgetc_(gzFile file);  /* backward compatibility */
                              ^
/usr/include/zlib.h:1818:13: error: unknown type name 'gzFile'
   Z_EXTERN gzFile Z_EXPORT gzopen(const char *, const char *);
            ^
/usr/include/zlib.h:1819:45: error: unexpected type name 'off_t': expected identifier
   Z_EXTERN z_off_t Z_EXPORT gzseek(gzFile, z_off_t, int);
                                            ^
/usr/include/zconf.h:159:21: note: expanded from macro 'z_off_t'
#    define z_off_t off_t
                    ^
In file included from Zlib.xs:34:
/usr/include/zlib.h:1819:54: error: expected identifier
   Z_EXTERN z_off_t Z_EXPORT gzseek(gzFile, z_off_t, int);
                                                     ^
/usr/include/zlib.h:1820:37: error: a parameter list without types is only allowed in a function definition
   Z_EXTERN z_off_t Z_EXPORT gztell(gzFile); 
                                    ^
/usr/include/zlib.h:1821:39: error: a parameter list without types is only allowed in a function definition
   Z_EXTERN z_off_t Z_EXPORT gzoffset(gzFile);   
                                      ^
/usr/include/zlib.h:1840:35: error: unknown type name 'gzFile'
Z_EXTERN int Z_EXPORTVA gzvprintf(gzFile file, const char *format, va_list va);
                                  ^
In file included from Zlib.xs:743:
./constants.h:370:18: warning: incompatible pointer to integer conversion assigning to 'IV' (aka 'long') from 'void *' [-Wint-conversion]
      *iv_return = Z_NULL;
                 ^ ~~~~~~
dslm4515 commented 3 years ago

Looks like there is a patch for zlib-ng from OpenMandriva

https://github.com/OpenMandrivaAssociation/zlib-ng/blob/master/0001-Fix-Z_SOLO-mode.patch

dslm4515 commented 3 years ago

Perl still fails. Only 2 of 7 errors fixed with patch.

In file included from Zlib.xs:34:
/usr/include/zlib.h:1820:13: error: unknown type name 'gzFile'
   Z_EXTERN gzFile Z_EXPORT gzopen(const char *, const char *);
            ^
/usr/include/zlib.h:1821:45: error: unexpected type name 'off_t': expected identifier
   Z_EXTERN z_off_t Z_EXPORT gzseek(gzFile, z_off_t, int);
                                            ^
/usr/include/zconf.h:159:21: note: expanded from macro 'z_off_t'
#    define z_off_t off_t
                    ^
In file included from Zlib.xs:34:
/usr/include/zlib.h:1821:54: error: expected identifier
   Z_EXTERN z_off_t Z_EXPORT gzseek(gzFile, z_off_t, int);
                                                     ^
/usr/include/zlib.h:1822:37: error: a parameter list without types is only allowed in a function definition
   Z_EXTERN z_off_t Z_EXPORT gztell(gzFile);
                                    ^
/usr/include/zlib.h:1823:39: error: a parameter list without types is only allowed in a function definition
   Z_EXTERN z_off_t Z_EXPORT gzoffset(gzFile);
                                      ^
449 warnings and 5 errors generated.
make[1]: *** [Makefile:348: Zlib.o] Error 1
make[1]: Leaving directory '/sources/perl-5.34.0/cpan/Compress-Raw-Zlib'
Unsuccessful make(cpan/Compress-Raw-Zlib): code=512 at make_ext.pl line 584.
make: *** [makefile:575: lib/auto/Compress/Raw/Zlib/Zlib.so] Error 2
dslm4515 commented 3 years ago

For now, will allow Perl to use it's bundled zlib source:

# Ensure that we never accidentally bundle bzip2
rm -rf cpan/Compress-Raw-Bzip2/bzip2-src
sed -i '/\bzip2\-src/d' MANIFEST
owl4ce commented 3 years ago

Build successful without these commands. 😄 https://github.com/dslm4515/CMLFS/blob/9ff93739462b3f75406f26c707ad819c28648975/3-chroot/042-perl#L10-L13

dslm4515 commented 3 years ago

Without those commands, perl builds with the bundled bzip2 and zlib source in the perl source.

I assume LFS forced perl to not use the bundled sources (zlib & bzip2) in case those bundled sources are out of date.

Main issue is incompatible zlib-ng headers causes the Compress-Raw-Zlib perl module to not compile... I can't find anyone who has built perl with zlib-ng.

I do not have enough programming experience to fix the Compress-Raw-Zlib` perl module source to work with zlib-ng

owl4ce commented 3 years ago

Confusing ..

dslm4515 commented 3 years ago

Normally when building a system from source, one would rather use the freshly built libraries than a package's bundled 3rd-party library source.

The perl source has bundled copies of the sourcecode for bzip2 and zlib. This is handy if building perl on a system that may not have bzip2 or zlib installed. Otherwise, its like compiling zlib and bzip2 twice: once for the system and again for perl.