perl5 icon indicating copy to clipboard operation
perl5 copied to clipboard

ext/Dynaloader build fails on OS X 10.3 due to undeclared type

Open sevan opened this issue 1 year ago • 1 comments

It is still possible to build Perl on OS X 10.3, however there's one error during the build. I applied the following patches to 5.38.2 source and ran ./Configure -des && make on OS X 10.3.9 https://github.com/Perl/perl5/pull/21023 https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/pull/444/files https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/pull/446 https://github.com/Perl/perl5/pull/21367

The build fails with `error: `bool' undeclared in ext/DynaLoader which is odd since bool is undefined in Dynaloader.xs and it's not an issue on newer versions of OS X (10.4 & up), also the code which undefines bool has been in place since 2000.

cc -c   -std=gnu99 -fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -Wall -W -Wno-long-long -Wwrite-strings -Os   -DVERSION=\"1.54\" -DXS_VERSION=\"1.54\"  "-I../.."  -DLIBC="" DynaLoader.c
DynaLoader.xs: In function `dlclose':
DynaLoader.xs:61: warning: unused parameter `handle'
DynaLoader.xs: In function `TranslateError':
DynaLoader.xs:80: warning: initialization discards qualifiers from pointer target type
DynaLoader.xs:81: warning: initialization discards qualifiers from pointer target type
DynaLoader.xs:82: warning: initialization discards qualifiers from pointer target type
DynaLoader.xs:83: warning: initialization discards qualifiers from pointer target type
DynaLoader.xs:84: warning: initialization discards qualifiers from pointer target type
DynaLoader.xs:85: warning: initialization discards qualifiers from pointer target type
DynaLoader.xs:86: warning: initialization discards qualifiers from pointer target type
DynaLoader.xs: In function `dlsym':
DynaLoader.xs:128: warning: unused parameter `handle'
DynaLoader.c: In function `XS_DynaLoader_dl_load_file':
DynaLoader.c:317: warning: unused variable `targ'
DynaLoader.c: In function `XS_DynaLoader_dl_find_symbol':
DynaLoader.c:355: warning: unused variable `targ'
DynaLoader.xs: In function `XS_DynaLoader_CLONE':
DynaLoader.xs:231: error: `bool' undeclared (first use in this function)
DynaLoader.xs:231: error: (Each undeclared identifier is reported only once
DynaLoader.xs:231: error: for each function it appears in.)
DynaLoader.c: In function `boot_DynaLoader':
DynaLoader.c:486: error: `bool' undeclared (first use in this function)
/usr/include/architecture/byte_order.h: At top level:
../../scope_types.h:87: warning: `leave_scope_arg_counts' defined but not used
../../sv_inline.h:349: warning: `fake_rv' defined but not used
../../sv_inline.h:352: warning: `fake_hv_with_aux' defined but not used
DynaLoader.xs:62: warning: `dlclose' defined but not used
make[1]: *** [DynaLoader.o] Error 1
cc -c   -std=gnu99 -fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -Wall -W -Wno-long-long -Wwrite-strings -Os   -DVERSION=\"1.54\" -DXS_VERSION=\"1.54\"  "-I../.."  -DLIBC="" DynaLoader.c
DynaLoader.xs: In function `dlclose':
DynaLoader.xs:61: warning: unused parameter `handle'
DynaLoader.xs: In function `TranslateError':
DynaLoader.xs:80: warning: initialization discards qualifiers from pointer target type
DynaLoader.xs:81: warning: initialization discards qualifiers from pointer target type
DynaLoader.xs:82: warning: initialization discards qualifiers from pointer target type
DynaLoader.xs:83: warning: initialization discards qualifiers from pointer target type
DynaLoader.xs:84: warning: initialization discards qualifiers from pointer target type
DynaLoader.xs:85: warning: initialization discards qualifiers from pointer target type
DynaLoader.xs:86: warning: initialization discards qualifiers from pointer target type
DynaLoader.xs: In function `dlsym':
DynaLoader.xs:128: warning: unused parameter `handle'
DynaLoader.c: In function `XS_DynaLoader_dl_load_file':
DynaLoader.c:317: warning: unused variable `targ'
DynaLoader.c: In function `XS_DynaLoader_dl_find_symbol':
DynaLoader.c:355: warning: unused variable `targ'
DynaLoader.xs: In function `XS_DynaLoader_CLONE':
DynaLoader.xs:231: error: `bool' undeclared (first use in this function)
DynaLoader.xs:231: error: (Each undeclared identifier is reported only once
DynaLoader.xs:231: error: for each function it appears in.)
DynaLoader.c: In function `boot_DynaLoader':
DynaLoader.c:486: error: `bool' undeclared (first use in this function)
/usr/include/architecture/byte_order.h: At top level:
../../scope_types.h:87: warning: `leave_scope_arg_counts' defined but not used
../../sv_inline.h:349: warning: `fake_rv' defined but not used
../../sv_inline.h:352: warning: `fake_hv_with_aux' defined but not used
DynaLoader.xs:62: warning: `dlclose' defined but not used
make[1]: *** [DynaLoader.o] Error 1
Unsuccessful make(ext/DynaLoader): code=512 at make_ext.pl line 584.
make: *** [DynaLoader.o] Error 25

To sidestep the issue, I commented out undef bool in Dynaloader.xs which allowed me to complete the build. I haven't completed a run of the test suite yet, but most of the UTF-8 tests failed, among others which I didn't note down. I plan to complete the run of the test suite to get a complete picture of what fails.

Summary of my perl5 (revision 5 version 38 subversion 2) configuration:
   
  Platform:
    osname=darwin
    osvers=7.9.0
    archname=darwin-thread-multi-2level
    uname='darwin ibook.local 7.9.0 darwin kernel version 7.9.0: wed mar 30 20:11:17 pst 2005; root:xnuxnu-517.12.7.obj~1release_ppc power macintosh powerpc '
    config_args='-des -Dprefix=/opt/tools'
    hint=previous
    useposix=true
    d_sigaction=define
    useithreads=define
    usemultiplicity=define
    use64bitint=undef
    use64bitall=undef
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
  Compiler:
    cc='cc'
    ccflags ='-std=gnu99 -fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe'
    optimize='-Os'
    cppflags='-std=gnu99 -fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe'
    ccversion=''
    gccversion='3.3 20030304 (Apple Computer, Inc. build 1666)'
    gccosandvers=''
    intsize=4
    longsize=4
    ptrsize=4
    doublesize=8
    byteorder=4321
    doublekind=4
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=8
    longdblkind=0
    ivtype='long'
    ivsize=4
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc'
    ldflags =''
    libpth=/usr/lib/gcc/darwin/3.3 /usr/lib
    libs=-lpthread -ldbm -ldl -lm -lc
    perllibs=-lpthread -ldl -lm -lc
    libc=
    so=dylib
    useshrplib=true
    libperl=libperl.dylib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dyld.xs
    dlext=bundle
    d_dlsymun=undef
    ccdlflags=' '
    cccdlflags=' '
    lddlflags=' -bundle -undefined dynamic_lookup'


Characteristics of this binary (from libperl): 
  Compile-time options:
    HAS_LONG_DOUBLE
    HAS_STRTOLD
    HAS_TIMES
    MULTIPLICITY
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_HASH_FUNC_ZAPHOD32
    PERL_HASH_USE_SBOX32
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_USE_SAFE_PUTENV
    USE_ITHREADS
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
    USE_REENTRANT_API
  Built under darwin
  Compiled at Dec 24 2023 18:07:21
  @INC:
    /opt/tools/lib/perl5/site_perl/5.38.2/darwin-thread-multi-2level
    /opt/tools/lib/perl5/site_perl/5.38.2
    /opt/tools/lib/perl5/5.38.2/darwin-thread-multi-2level
    /opt/tools/lib/perl5/5.38.2

sevan avatar Dec 25 '23 06:12 sevan

Failed 89 tests out of 2565, 96.53% okay.
 ../cpan/CPAN-Meta-YAML/t/30_yaml_spec_tml.t
 ../cpan/CPAN-Meta/t/converter.t
 ../cpan/ExtUtils-MakeMaker/t/unicode.t
 ../cpan/Pod-Simple/t/corpus.t
 ../cpan/Pod-Simple/t/rtf_utf8.t
 ../cpan/Scalar-List-Utils/t/exotic_names.t
 ../cpan/Text-ParseWords/t/ParseWords.t
 ../dist/PathTools/t/cwd_enoent.t
 ../ext/POSIX/t/math.t
 ../ext/XS-APItest/t/cophh.t
 ../ext/XS-APItest/t/handy00.t
 ../ext/XS-APItest/t/hash.t
 ../ext/XS-APItest/t/op.t
 ../ext/XS-APItest/t/utf8.t
 ../lib/charnames.t
 ../lib/overload.t
 ../lib/utf8.t
 ../lib/warnings.t
 io/open.t
 lib/croak.t
 mro/next_ineval_utf8.t
 mro/next_skip_utf8.t
 op/caller.t
 op/fresh_perl_utf8.t
 op/lexsub.t op/pack.t
 op/quotemeta.t
 op/split.t
 op/split_unicode.t
 op/sprintf2.t
 opbasic/concat.t
 re/charset.t
 re/fold_grind_a.t
 re/fold_grind_aa.t
 re/fold_grind_d.t
 re/fold_grind_l.t
 re/fold_grind_u.t
 re/overload.t
 re/pat.t
 re/pat_advanced.t
 re/pat_advanced_thr.t
 re/pat_re_eval.t
 re/pat_re_eval_thr.t
 re/pat_rt_report.t
 re/pat_rt_report_thr.t
 re/pat_special_cc.t
 re/pat_special_cc_thr.t
 re/pat_thr.t
 re/reg_fold.t
 re/reg_mesg.t
 re/reg_posixcc.t
 re/regex_sets.t
 re/regex_sets_compat.t
 re/regexp.t
 re/regexp_noamp.t
 re/regexp_nonull.t
 re/regexp_notrie.t
 re/regexp_qr.t
 re/regexp_qr_embed.t
 re/regexp_qr_embed_thr.t
 re/regexp_trielist.t
 re/regexp_unicode_prop.t
 re/regexp_unicode_prop_thr.t
 re/subst.t re/substT.t
 re/subst_wamp.t
 re/uniprops03.t
 re/uniprops04.t
 uni/attrs.t
 uni/bless.t
 uni/caller.t
 uni/fold.t
 uni/goto.t
 uni/gv.t
 uni/labels.t
 uni/lex_utf8.t
 uni/lower.t
 uni/method.t
 uni/opcroak.t
 uni/parser.t
 uni/readline.t
 uni/sprintf.t
 uni/stash.t
 uni/title.t
 uni/tr_utf8.t
 uni/universal.t
 uni/upper.t
 uni/variables.t
 uni/write.t
### Since not all tests were successful, you may want to run some of
### them individually and examine any diagnostic messages they produce.
### See the INSTALL document's section on "make test".
### You have a good chance to get more information by running
###   ./perl harness
### in the 't' directory since most (>=80%) of the tests succeeded.
### You may have to set your dynamic library search path,
### DYLD_LIBRARY_PATH, to point to the build directory:
###   setenv DYLD_LIBRARY_PATH `pwd`:$DYLD_LIBRARY_PATH; cd t; ./perl harness
###   DYLD_LIBRARY_PATH=`pwd`:$DYLD_LIBRARY_PATH; export DYLD_LIBRARY_PATH; cd t; ./perl harness
###   export DYLD_LIBRARY_PATH=`pwd`:$DYLD_LIBRARY_PATH; cd t; ./perl harness
### for csh-style shells, like tcsh; or for traditional/modern
### Bourne-style shells, like bash, ksh, and zsh, respectively.
Elapsed: 22056 sec
u=262.66  s=171.33  cu=17828.72  cs=1927.77  scripts=2565  tests=805912
make: *** [GNUmakefile:836: test] Error 1

Haven't run perl harness to fish out the results yet.

sevan avatar Dec 28 '23 03:12 sevan