Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

perl built with -DDEBUGGING causes "failed to extend arg stack" error with XS modules

by parv (Parson)
on Jul 24, 2021 at 21:44 UTC ( [id://11135360]=perlquestion: print w/replies, xml ) Need Help??

parv has asked for the wisdom of the Perl Monks concerning the following question:

I recently built perl 5.32.1 with -DDEBUGGING & DateTime 1.54 from source (Ports, FreeBSD 13-STABLE). Now use of DateTime results in "failed to extend arg stack" (a solution seems not likely any time soon, tagged as "low serverity) ...

# perl -MDateTime -e0 panic: XSUB Package::Stash::XS::list_all_symbols (XS.c) failed to exte +nd arg stack: base=801cff418, sp=801cff480, hwm=801cff440 Compilation failed in require at /usr/local/lib/perl5/site_perl/mach/5 +.32/DateTime/Duration.pm line 12. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/ma +ch/5.32/DateTime/Duration.pm line 12. Compilation failed in require at /usr/local/lib/perl5/site_perl/mach/5 +.32/DateTime.pm line 14. BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/ma +ch/5.32/DateTime.pm line 14. Compilation failed in require. BEGIN failed--compilation aborted.

What good is -DDEBUGGING now if it XS modules cannot run.

# perl -V Summary of my perl5 (revision 5 version 32 subversion 1) configuration +: Platform: osname=freebsd osvers=13.0-stable archname=amd64-freebsd-thread-multi uname='freebsd gaia 13.0-stable freebsd 13.0-stable #1 zfs-arc-uni +t-n246112-d528d2685de: mon jun 28 01:30:03 hst 2021 root@gaia:src-bui +ldobjsrc-buildsrcamd64.amd64sysinvm-efi amd64 ' config_args='-Darchlib=/usr/local/lib/perl5/5.32/mach -Dcc=cc -Dcf +_by=mat -Dcf_email=mat@FreeBSD.org -Dcf_time=Sat Jan 23 04:56:40 HST +2021 -Dinc_version_list=none -Dlibperl=libperl.so.5.32.1 -Dman1dir=/u +sr/local/lib/perl5/5.32/perl/man/man1 -Dman3dir=/usr/local/lib/perl5/ +5.32/perl/man/man3 -Dprefix=/usr/local -Dprivlib=/usr/local/lib/perl5 +/5.32 -Dscriptdir=/usr/local/bin -Dsitearch=/usr/local/lib/perl5/site +_perl/mach/5.32 -Dsitelib=/usr/local/lib/perl5/site_perl -Dsiteman1di +r=/usr/local/lib/perl5/site_perl/man/man1 -Dsiteman3dir=/usr/local/li +b/perl5/site_perl/man/man3 -Dusenm=n -Duseshrplib -sde -Ui_iconv -Ui_ +malloc -Uinstallusrbinperl -Alddlflags=-L/src-build/ports-build/src-b +uild/ports/lang/perl5.32/work/perl-5.32.1 -L/usr/local/lib/perl5/5.32 +/mach/CORE -lperl -Dshrpldflags=$(LDDLFLAGS:N-L/src-build/ports-build +/src-build/ports/lang/perl5.32/work/perl-5.32.1:N-L/usr/local/lib/per +l5/5.32/mach/CORE:N-lperl) -Wl,-soname,$(LIBPERL:R) -DDEBUGGING -Dopt +imize=-g -Dusedtrace -Ui_gdbm -Dusemultiplicity=y -Dusemymalloc=n -Du +sesitecustomize -Dusethreads=y -Accflags=-DUSE_THREAD_SAFE_LOCALE' hint=recommended useposix=true d_sigaction=define useithreads=define usemultiplicity=define use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n default_inc_excludes_dot=define bincompat5005=undef Compiler: cc='cc' ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DUSE_THREAD_SAFE_ +LOCALE -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-stron +g -I/usr/local/include' optimize='-g' cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DUSE_THREAD_SAFE_ +LOCALE -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-stron +g -I/usr/local/include' ccversion='' gccversion='FreeBSD Clang 11.0.1 (git@github.com:llvm/llvm-project +.git llvmorg-11.0.1-0-g43ff75f2c3fe)' gccosandvers='' intsize=4 longsize=8 ptrsize=8 doublesize=8 byteorder=12345678 doublekind=3 d_longlong=define longlongsize=8 d_longdbl=define longdblsize=16 longdblkind=3 ivtype='long' ivsize=8 nvtype='double' nvsize=8 Off_t='off_t' lseeksize=8 alignbytes=8 prototype=define Linker and Libraries: ld='cc' ldflags ='-pthread -Wl,-E -fstack-protector-strong -L/usr/local/l +ib' libpth=/usr/lib /usr/local/lib /usr/lib/clang/11.0.1/lib /usr/lib libs=-lpthread -lgdbm -lm -lcrypt -lutil perllibs=-lpthread -lm -lcrypt -lutil libc= so=so useshrplib=true libperl=libperl.so.5.32.1 gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs dlext=so d_dlsymun=undef ccdlflags=' -Wl,-R/usr/local/lib/perl5/5.32/mach/CORE' cccdlflags='-DPIC -fPIC' lddlflags='-shared -L/usr/local/lib/perl5/5.32/mach/CORE -lperl - +L/usr/local/lib -fstack-protector-strong' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING HAS_TIMES MULTIPLICITY PERLIO_LAYERS PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP PERL_OP_PARENT PERL_PRESERVE_IVUV PERL_TRACK_MEMPOOL USE_64_BIT_ALL USE_64_BIT_INT 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 USE_SITECUSTOMIZE USE_THREAD_SAFE_LOCALE Built under freebsd @INC: /usr/local/lib/perl5/site_perl/mach/5.32 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.32/mach /usr/local/lib/perl5/5.32

Is there a way to have perl built with DEBUGGING and XS modules not fail?

Replies are listed 'Best First'.
Re: perl built with -DDEBUGGING causes "failed to extend arg stack" error with XS modules
by syphilis (Archbishop) on Jul 25, 2021 at 01:16 UTC
    Back to building perl sans -DDEBUGGING ...

    Looking at https://github.com/Perl/perl5/issues/16607, it seems to me that another solution would be to build your XS modules from source (ie cpan -i DateTime), rather than installing the port (which was built for a non-debugging perl) provided by the system vendor.
    And, that's the option I would take, if my understanding of the issue is correct.
    I would not expect any XS module built for a specific configuration of perl to necessarily work on a perl of a different configuration.

    Update:
    Is there a way to have perl built with DEBUGGING and XS modules not fail?

    AFAIK, the XS modules will generally be fine on a -DDEBUGGING perl as long as they are built using that -DDEBUGGING perl.

    Cheers,
    Rob

      Seconded. If you change perl's flags don't expect to be able to use XS modules compiled against a perl with a different set of flags. In general if you keep the same flags within the same major.minor you're probably safe (i.e. you probably can vary patchlevel, but . . .); other than that it's safer to make sure you build with what you're running with.

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.

      I did built DateTime from source ...

      I recently built perl 5.32.1 with -DDEBUGGING & DateTime 1.54 from source ...

      ... Only after then I had posted here. FreeBSD Ports allows one to do that any time (except for the cases where only the binary blobs are available).

        I recently built perl 5.32.1 with -DDEBUGGING

        You built that -DDEBUGGING perl yourself ??
        I took one look at the "config_args" as reported in the "perl -V" output you provided in your original post and decided that this must be a perl provided by FreeBSD Ports.
        When I build perl on FreeBSD 12.0, I specify Configure args of "-des -Duse64bitall -Dprefix=/home/me/perl-5.x.y", and that's all.
        If I wanted a DEBUG perl then I'd just be adding the "-DDEBUGGING" flag to the list I used. (It's a while since I've built a -DDEBUGGING perl, so correct me if there are other flags that need to be added.)

        Try building your perl with a trimmed back list of configure args (like the list that I use) and see if that makes a difference.

        How did you actually build and install DateTime-1.54 from source ? (Seeing the output from that process might be useful.)

        Cheers,
        Rob
Re: perl built with -DDEBUGGING causes "failed to extend arg stack" error with XS modules
by dave_the_m (Monsignor) on Jul 25, 2021 at 18:51 UTC
    If both perl and the XS module are built with the same build options (in this case, -DDEBUGGING), then the error message you see is almost certainly a bug in the XS module. If perl is built with -DDEBUGGING while the XS module is built without it (which is the situation the ticket you linked to refers to) then you'll get spurious errors like these.

    In general perl only works with XS modules built using the same perl and build options. That ticket was basically asking whether we could make a special exception for -DDEBUGGING, but in general it is exceedingly hard to maintain binary compatibility among different build options.

    NB: I added the high-water-mark debugging code to the perl core.

    Dave.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11135360]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-03-28 12:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found