bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: texinfo-6.0.91 pretest


From: Gavin Smith
Subject: Re: texinfo-6.0.91 pretest
Date: Fri, 1 Jan 2016 12:31:15 +0000

On 1 January 2016 at 11:08, Eli Zaretskii <address@hidden> wrote:
> The build with Perl XS is less successful.  First, the configure
> script decides that modules cannot be built, due to this problem with
> libtool invocation:
>
>   libtool: warning: undefined symbols not allowed in i686-pc-mingw32 shared 
> libraries; building static only
>
> When linking a shared library on MS-Windows, one needs to pass the
> '-no-undefined' switch to libtool.  I hacked
> tp/Texinfo/Convert/XSParagraph/Makefile.in to add -no-undefined to
> LDFLAGS to solve that.

I see we had this problem before
(https://lists.gnu.org/archive/html/texinfo-devel/2015-07/msg00054.html).

Is this the right fix? -

Index: Makefile.am
===================================================================
--- Makefile.am (revision 6893)
+++ Makefile.am (working copy)
@@ -78,14 +78,14 @@

 XSParagraph_la_CFLAGS += -DVERSION=\"$(VERSION)\"
-DXS_VERSION=\"$(XSPARAGRAPH_INTERFACE_VERSION)\"  "-I$(PERL_INC)"

-XSParagraph_la_LDFLAGS=-avoid-version -module $(PERL_CONF_cccdlflags)
+XSParagraph_la_LDFLAGS=-no-undefined -avoid-version -module
$(PERL_CONF_cccdlflags)


 TestXS_la_CFLAGS = $(PERL_CONF_ccflags)

 TestXS_la_CFLAGS += -DVERSION=\"$(VERSION)\"
-DXS_VERSION=\"$(VERSION)\"  "-I$(PERL_INC)"

-TestXS_la_LDFLAGS=-module $(PERL_CONF_cccdlflags)
+TestXS_la_LDFLAGS=-no-undefined -module $(PERL_CONF_cccdlflags)

 # only used to regenerate a stand-alone perl module
 perl_specific_files = \


>
> The next problem was with linking TestXS as a shared library.  Because
> no undefined references are allowed when linking a shared library on
> MS-Windows, the linker needs to see an import library which tells it
> where to find the Perl functions at run time.  This library is found
> like this:
>
>     perl -V:libperl
>
> The result is a file name, like libperl520.a, with no leading
> directories, so one needs also the suitable linker flags before that,
> which can be obtained with
>
>     perl -V:ldflags
>
> The result (after converting it in fetch_conf) should be added to the
> value of PERL_CONF_cccdlflags.
>
> Finally, libperl520.a should be converted into -lperl520, otherwise
> libtool claims that it is being told to link against a static library,
> and refuses to create a shared library for TestXS again.

When I do perl -V:libperl, I get:

libperl='libperl.so';

which is a dynamic library. I take it that the "import library" should
indeed be a static library? Is the conversion just to stop libtool
from quitting, and libperl520.a is in fact the library file that is
linked to?

> After all this, the configure script succeeds to link TestXS, and
> "make" produces XSParagraph.dll shared library.  However, "make" then


> fails when producing texinfo.info in the doc/ directory, because Perl
> crashes.
>
> I suspect that the reason could be the fact that my Perl was compiled
> with 64-bit int's (USE_64_BIT_INT is shown in the output of "perl -V")
> although this is a 32-bit system and a 32-bit build of Texinfo's C
> programs.  Could it be that the XSParagraph and its subroutines assume
> that the 'int' data type is the same type as the integers used by
> Perl?  If so, can you suggest where in the XSParagraph sources to try
> to convert these into 64-bit types?
>
> Or maybe you have other ideas for possible reasons.  (I don't have a
> debuggable version of Perl, so I cannot run it under a debugger to see
> where and why it fails, exactly.)

> Failing all that, the conclusion should probably be that Texinfo
> cannot currently be compiled with MinGW using XSParagraph extensions.
>
> Thanks.

It's encouraging that the TestXS module was built successfully;
XSParagraph is more complicated, obviously, so has more places to go
wrong.

The Perl API has an "IV" typedef which I expect is 64 bits on your
system. Maybe it needs to be used instead of "int" somewhere. The two
source files XSParagraph.xs and xspara.c use some of the Perl API
functions (hv_fetch, SvIV in xspara.c, more in XSParagraph.xs). I
looked through both of those source files but couldn't see where it
could go wrong. I would expect the Perl header files that those files
include would include prototypes that would check that the right types
were being passed in and/or take care of type conversions. For
example, a line like

       RETVAL = newSVpv (retval, 0);

The second argument 0 is of type 'int' in the code, and there should
be a header saying that the type of the argument is STRLEN (another
Perl typedef), and there should be an automatic conversion (likely
from a 32-bit int to a 64-bit unsigned int).

This won't work for variadic functions, but I don't think there are any.

Did you get any compiler warnings about "implicit function declarations"?

Perhaps try loading the module without using any of its functions
(e.g. put "use Texinfo::Convert::Paragraph" in texi2any.pl to load the
module unconditionally) and then run "./texi2any.pl --version"). If
that works, maybe try running a function like

 my $para = Texinfo::Convert::Paragraph->new();

to see which function it's crashing in.

Also, setting the TEXINFO_XS environment variable to "debug" may be
informative, e.g. I get:

$TEXINFO_XS=debug ./texi2any.pl  ../doc/info-stnd.texi
checking ../tp/Texinfo/Convert/XSParagraph/XSParagraph.la
found ../tp/Texinfo/Convert/XSParagraph/XSParagraph.la
../tp/Texinfo/Convert/XSParagraph/.libs/XSParagraph.so loaded
looking for boot_Texinfo__Convert__XSParagraph__XSParagraph

Maybe try hacking the t/paragraph.t test (run with "perl -w
t/paragraph.t") to see how far you can get, like this:

Index: t/paragraph.t
===================================================================
--- t/paragraph.t       (revision 6893)
+++ t/paragraph.t       (working copy)
@@ -29,7 +29,7 @@
 # We do the paragraph module tests twice, once with the XS module, once with
 # the non-XS module.  A few them are only done once, though.

-my $paragraph_module = "Texinfo::Convert::ParagraphNonXS";
+my $paragraph_module = "Texinfo::Convert::Paragraph";

 my $testing_XSParagraph;
 DOITAGAIN:
@@ -45,11 +45,15 @@
   my $result = '';
   #$conf = {'DEBUG' => 1} if (!defined($conf));
   $conf = {} if (!defined($conf));
+  warn "GOT HERE 1\n";
   my $para = $paragraph_module->new($conf);
+  warn "GOT HERE 2\n";
   foreach my $arg (@$args) {
     $result .= $para->add_text($arg);
   }
+  warn "GOT HERE 3\n";
   $result .= $para->end();
+  warn "GOT HERE 4\n";
   if (defined($reference)) {
     is ($result, $reference, $name);
   } else {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]