Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perl fails to build with zlib-ng #20

Open
dslm4515 opened this issue Jul 2, 2021 · 7 comments
Open

perl fails to build with zlib-ng #20

dslm4515 opened this issue Jul 2, 2021 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@dslm4515
Copy link
Owner

dslm4515 commented Jul 2, 2021

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 dslm4515 added the bug Something isn't working label Jul 2, 2021
@dslm4515 dslm4515 self-assigned this Jul 2, 2021
@dslm4515
Copy link
Owner Author

dslm4515 commented Jul 2, 2021

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
Copy link
Owner Author

dslm4515 commented Jul 2, 2021

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
Copy link
Owner Author

dslm4515 commented Jul 3, 2021

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
Copy link

owl4ce commented Jul 5, 2021

Build successful without these commands. 😄

CMLFS/3-chroot/042-perl

Lines 10 to 13 in 9ff9373

# Ensure that we never accidentally bundle zlib or bzip2
rm -rf cpan/Compress-Raw-Zlib/zlib-src
rm -rf cpan/Compress-Raw-Bzip2/bzip2-src
sed -i '/\(bzip2\|zlib\)-src/d' MANIFEST

@dslm4515
Copy link
Owner Author

dslm4515 commented Jul 5, 2021

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
Copy link

owl4ce commented Jul 5, 2021

Confusing ..

@dslm4515
Copy link
Owner Author

dslm4515 commented Jul 5, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: To do
Development

No branches or pull requests

2 participants