Open vadimkantorov opened 3 years ago
After letting it error out, doing linking manually and resuming, I get:
cc -Ibtparse/src -I/home/vadimkantorov/buildbiber/build/native/perl/../prefix/lib/5.30.0/x86_64-linux/CORE -c -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -O -o xscode/BibTeX.o xscode/BibTeX.c
ld -o blib/arch/auto/Text/BibTeX/BibTeX.none xscode/BibTeX.o xscode/btxs_support.o -Lbtparse/src -lbtparse
# ld: error in btparse/src/libbtparse.so(.eh_frame); no .eh_frame_hdr table will be created.
# ld: warning: cannot find entry symbol _start; defaulting to 0000000000400f00
# xscode/BibTeX.o: In function `XS_Text__BibTeX_macro_text':
# BibTeX.c:(.text+0xb): undefined reference to `PL_markstack_ptr'
# BibTeX.c:(.text+0x16): undefined reference to `PL_markstack_ptr'
# BibTeX.c:(.text+0x24): undefined reference to `PL_stack_base'
# BibTeX.c:(.text+0x2f): undefined reference to `PL_stack_sp'
# BibTeX.c:(.text+0x49): undefined reference to `PL_op'
# BibTeX.c:(.text+0x5e): undefined reference to `PL_curpad'
# BibTeX.c:(.text+0x74): undefined reference to `PL_stack_base'
# BibTeX.c:(.text+0x8c): undefined reference to `PL_stack_base'
# BibTeX.c:(.text+0xbb): undefined reference to `PL_na'
# BibTeX.c:(.text+0xd8): undefined reference to `PL_stack_base'
# BibTeX.c:(.text+0xf1): undefined reference to `PL_stack_base'
...
I guess I need to link -lperl
manually? How could I do that?
I tried specifying libperl.a
and I then get:
ld -o blib/arch/auto/Text/BibTeX/BibTeX.none xscode/BibTeX.o xscode/btxs_support.o -Lbtparse/src -lbtparse -lperl ~/buildbiber/build/native/perl/libperl.a
# ld: /home/vadimkantorov/buildbiber/build/native/perl/libperl.a(toke.o): undefined reference to symbol 'pow@@GLIBC_2.2.5'
# //lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
ld -o blib/arch/auto/Text/BibTeX/BibTeX.none xscode/BibTeX.o xscode/btxs_support.o -Lbtparse/src -lbtparse -lperl ~/buildbiber/build/native/perl/libperl.a -lm -lpthread -lc
# ld: error in btparse/src/libbtparse.so(.eh_frame); no .eh_frame_hdr table will be created.
# ld: warning: cannot find entry symbol _start; defaulting to 0000000000417ce0
Although I would like to help, you are dealing with details I am not aware of.
I should be able to prepare a repro later in the week
A more simplified version of this question would be - is it possible to compile Perl with Text::BibTeX in -Dstatic_ext=Text/BibTeX
at configure string or with static_ext="Text/BibTeX"
in the hintfile.
Otherwise, do you have a manual building script (without relying on Build.PL / ExtUtils and stuff)? For me that would work and it would be easier than fighting ExtUtils linker options
See if this helps: https://www.cpan.org/modules/by-authors/id/A/AM/AMBS/btparse/
I guess I'm stuck at trying to get Text::BibTeX working because it's what biber uses. The only non-trivial piece of Text::BibTeX is the XS module. If there's a simple command to build the XS module by calling perl manually, that would work too.
Currently Text::BibTeX bundles a standard C library (btparse) and a Perl module, that has its own library for dynamic loading from Perl. The soname option you refer is being used to link the btparse library. Thus, if you can compile it properly from the link above, then it should be just a matter of understanding how to tweak Text::BibTeX not to compile itself the library.
Well, by manual compiling and resuming it seems to compile and link. I'm not sure about the scary warnings though.
So compiling btparse itself is not complicated. Then Build.PL still makes a build string with nasty linker flags unsuitable for static builds. If you have an idea how to compile the Perl module without Build.PL in a simpler way, that would work. Or if you managed to build it with make_ext.pl
from Perl distribution, that would work as well.
I'm building Text::BibTeX manually with an almost-static build of Perl in order to eventually port biber to WebAssembly. Getting build errors from Text::BibTeX. Could you advise how to hack around the build script?