nayakgi / perl-compiler

Automatically exported from code.google.com/p/perl-compiler
Other
0 stars 0 forks source link

--staticxs breaks runtime load of List::Util fails if Scalar::Util is loaded at BEGIN time #312

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
$ perlcc --staticxs -e 'require Scalar::Util; eval "require List::Util"; print 
"OK\n"'; ./a.out
Goto undefined subroutine &DynaLoader::bootstrap_inherit at 
/usr/local/cpanel/3rdparty/perl/514/lib/perl5/cpanel_lib/i386-linux-64int/XSLoad
er.pm line 100.
Compilation failed in require at 
/usr/local/cpanel/3rdparty/perl/514/lib/perl5/cpanel_lib/i386-linux-64int/Scalar
/Util.pm line 11.
Compilation failed in require at -e line 1.

What perl version are you using? 5.14.4 Threaded? Nope. -DDEBUGGING? Off. What 
operating system? C6-32 Linux 2.6.32-431.11.2.el6.i686 

Original issue reported on code.google.com by chro...@gmail.com on 1 May 2014 at 7:55

GoogleCodeExporter commented 9 years ago
$ perlcc --staticxs -e 'require IO; eval "require List::Util"; print "OK\n"'; 
./a.out
Goto undefined subroutine &DynaLoader::bootstrap_inherit at 
/usr/local/cpanel/3rdparty/perl/514/lib/perl5/cpanel_lib/i386-linux-64int/XSLoad
er.pm line 100.
Compilation failed in require at -e line 1.

If we change the first require, outside the eval, at BEGIN time, this starts 
working:
$ perlcc --staticxs -e 'use IO; eval "require List::Util"; print "OK\n"'; 
./a.out
OK

Original comment by chro...@gmail.com on 1 May 2014 at 8:02

GoogleCodeExporter commented 9 years ago
While adding parens to the end of a use is syntactically the same as require, 
it works in this form:

$ perlcc --staticxs -e 'use IO(); eval "require List::Util"; print "OK\n"'; 
./a.out
OK

Original comment by chro...@gmail.com on 1 May 2014 at 8:04

GoogleCodeExporter commented 9 years ago
Also broken on master branch - 9a31913090728

Original comment by todd.e.rinaldo on 1 May 2014 at 8:07

GoogleCodeExporter commented 9 years ago

Original comment by todd.e.rinaldo on 1 May 2014 at 8:21

GoogleCodeExporter commented 9 years ago
The problem is that --staticxs explicitly sets -DNO_DYNAMIC_LOADING which 
prevents DynaLoader being booted.

And then uses NO_DYNAMIC_LOADING to decide if to dynaload or boot the staticxs 
modules. 

We need to keep the first part, always boot DynaLoader (if usedl is available), 
and change the 2nd part.

Original comment by reini.urban on 1 May 2014 at 9:02

GoogleCodeExporter commented 9 years ago
Fixed with commit 064503093e0105afef22045e4d5793decd6ad394
Author: Reini Urban <rurban@cpanel.net>
Date:   Thu May 1 15:51:40 2014 -0500

    C: fix #312 -DNO_DYNAMIC_LOADING with --staticxs disables DynaLoader

    --staticxs explicitly sets -DNO_DYNAMIC_LOADING which prevents DynaLoader being booted.
    And then uses NO_DYNAMIC_LOADING to decide if to dynaload or boot the staticxs modules.

    We need to keep the first part, always boot DynaLoader (if usedl is available),
    renamed NO_DYNAMIC_LOADING to STATICXS to avoid further confusion
    changed in C and perlcc.

Original comment by reini.urban on 1 May 2014 at 9:06

GoogleCodeExporter commented 9 years ago
I needed 2nd fix also: 
commit 586a772fde9d52f9ba0defa7bf192ae77a1f4ff8
Author: Reini Urban <rurban@cpanel.net>
Date:   Fri May 2 10:33:07 2014 -0500

    perlcc: oops, fix prev. -DNO_DYNAMIC_LOADING with STATICXS on non-MSVC compilers

Original comment by reini.urban on 2 May 2014 at 3:40