Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vim not build with upcoming Perl 5.38 #12543

Closed
jplesnik opened this issue Jun 15, 2023 · 10 comments
Closed

vim not build with upcoming Perl 5.38 #12543

jplesnik opened this issue Jun 15, 2023 · 10 comments

Comments

@jplesnik
Copy link

jplesnik commented Jun 15, 2023

Steps to reproduce

I am preparing update to Perl 5.38 for Fedora 39. During the preparation I tried to rebuild all dependencies with it.
I found that build of vim was failing with new Perl.
For the tests I used the latest devel release Perl 5.37.11

Expected behaviour

Successful build of vim

Version of Vim

9.0 1627

Environment

Fedora 39 (rawhide)
Devel release of Perl 5.37.11

Logs and stack traces

Complete log coulg be found on <https://jplesnik.fedorapeople.org/5.38/vim-build.log>
Examples from log: 

if_perl.xs: In function 'Perl_SvTRUE_common': 
/usr/lib64/perl5/CORE/embed.h:109:49: warning: implicit declaration of function 'Perl_SvPVXtrue'; did you mean 'Perl_sv_true'? [-Wimplicit-function-declaration]
  109 | # define SvPVXtrue(a)                           Perl_SvPVXtrue(aTHX_ a)
      |                                                 ^~~~~~~~~~~~~~
if_perl.xs:724:16: note: in expansion of macro 'SvPVXtrue'
  724 |         return SvPVXtrue(sv);
      |                ^~~~~~~~~
if_perl.xs: In function 'Perl_SvTRUE':
<...>
/usr/bin/ld: /tmp/ccxXLZZi.ltrans63.ltrans.o: in function `ex_perl':
/builddir/build/BUILD/vim90/src/if_perl.xs:745: undefined reference to `Perl_SvGETMAGIC'
/usr/bin/ld: /builddir/build/BUILD/vim90/src/if_perl.xs:1108: undefined reference to `Perl_SvPV_helper'
/usr/bin/ld: /builddir/build/BUILD/vim90/src/if_perl.xs:724: undefined reference to `Perl_SvPVXtrue'
/usr/bin/ld: /tmp/ccxXLZZi.ltrans63.ltrans.o: in function `perl_to_vim.lto_priv.0':
/builddir/build/BUILD/vim90/src/if_perl.xs:1210: undefined reference to `Perl_SvPV_helper'
/usr/bin/ld: /builddir/build/BUILD/vim90/src/if_perl.xs:1323: undefined reference to `Perl_SvPV_helper'
/usr/bin/ld: /builddir/build/BUILD/vim90/src/if_perl.xs:1199: undefined reference to `Perl_SvNV'
/usr/bin/ld: /builddir/build/BUILD/vim90/src/if_perl.xs:1203: undefined reference to `Perl_SvIV'
/usr/bin/ld: /tmp/ccxXLZZi.ltrans64.ltrans.o: in function `XS_VIM_DoCommand':
/builddir/build/BUILD/vim90/src/if_perl.c:1789: undefined reference to `Perl_SvPV_helper'
/usr/bin/ld: /tmp/ccxXLZZi.ltrans64.ltrans.o: in function `ex_perldo':
/builddir/build/BUILD/vim90/src/if_perl.xs:1433: undefined reference to `Perl_SvPV_helper'
@pheiduck
Copy link
Contributor

pheiduck commented Jun 16, 2023

A potential workaround is to configure with --enable-perlinterp=dynamic
Arch Linux is doing this overtime:
https://gitlab.archlinux.org/archlinux/packaging/packages/vim/-/blob/main/PKGBUILD#L61

@zdohnal
Copy link
Contributor

zdohnal commented Jun 20, 2023

A potential workaround is to configure with --enable-perlinterp=dynamic

That's how Vim is built in Fedora. However, once in time the languages define new functions in newer release, which Vim has to fake it to make this dynamic linking working - the same thing happens time to time with Python and Ruby as well.

@zdohnal
Copy link
Contributor

zdohnal commented Jun 20, 2023

How to reproduce:

  • configure+build+install Perl from the link in the first comment:
$ wget -O perl.tar.gz https://cpan.metacpan.org/authors/id/S/SH/SHAY/perl-5.37.11.tar.gz
$ tar -xaf perl.tar.gz && cd perl-5.37.11
$ <install make and gcc>
$ # sets the options interactively
$ sh Configure
$ make && sudo make install
  • compile Vim with new Perl:
$ git clone https://github.com/vim/vim
$ cd vim
$ ./configure --enable-gui=no --with-features=Huge --enable-perlinterp=dynamic
$ make

@pheiduck
Copy link
Contributor

Arch Linux has Perl 5.36.1, seems like it is no longer possible to build vim with perl starting with 5.37.

@pheiduck
Copy link
Contributor

pheiduck commented Jun 20, 2023

I'm not a programer and know much about perl but could this be a patch for that issue?:

 /* perl-5.34 needs Perl_SvTRUE_common; used in SvTRUE_nomg_NN */
 # if (PERL_REVISION == 5) && (PERL_VERSION >= 34)
+# define sv_true(a) Perl_sv_true(aTHX_ a)
 PERL_STATIC_INLINE bool
 Perl_SvTRUE_common(pTHX_ SV * sv, const bool sv_2bool_is_fallback)
 {
@@ -721,7 +722,7 @@ Perl_SvTRUE_common(pTHX_ SV * sv, const bool sv_2bool_is_fallback)
        return FALSE;

     if (SvPOK(sv))
-       return SvPVXtrue(sv);
+       return sv_true(av);

     if (SvIOK(sv))
        return SvIVX(sv) != 0; /* casts to bool */

@pheiduck
Copy link
Contributor

I build it with my patch but there are more bugs so I am not able to fix it, maybe someone else can do it.

@pheiduck
Copy link
Contributor

But here are the Links where I found the code which is missing:
Not all
'Perl_sv_true'
https://github.com/Perl/perl5/blob/blead/embed.h
`Perl_SvPV_helper'
https://github.com/Perl/perl5/blob/blead/sv.h

@pheiduck
Copy link
Contributor

pheiduck commented Jun 21, 2023

another potential "fixup":

diff --git a/src/if_perl.xs b/src/if_perl.xs
index c69ed9ef1..00e296882 100644
--- a/src/if_perl.xs
+++ b/src/if_perl.xs
@@ -10,6 +10,11 @@
  *             Mostly written by Sven Verdoolaege.
  */

+#if (PERL_REVISION == 5) && (PERL_VERSION >= 37)
+#pragma GCC diagnostic ignored "-Wimplicit-function-declaration"
+CFLAGS="-Wl,--unresolved-symbols=ignore-all"
+#endif
+
 #define _memory_h      /* avoid memset redeclaration */
 #define IN_PERL_FILE   /* don't include if_perl.pro from proto.h */

if_perl.c needs fixes as well

@pheiduck
Copy link
Contributor

pheiduck commented Jun 22, 2023

I have good news:
My Last PR fixes the errors mentioned here.
And I learned a lot about Perl today. 😄
Of course I tested it within the same setup like here.
Fedora 39 + Perl 5.37.11 and Perl 5.38.0-RC1
./configure --enable-gui=no --with-features=Huge --enable-perlinterp
also works again.

@jplesnik
Copy link
Author

@pheiduck I tested your changes with Fedora 39 and Perl 5.38.0-RC2 and it works for me.
Thank you

chrisbra pushed a commit to chrisbra/vim that referenced this issue Sep 22, 2023
Problem: Build Failure with Perl 5.38
Solution: Fix Build Failure

closes: vim#12543, closes: vim#12575
dundargoc added a commit to dundargoc/neovim that referenced this issue Dec 16, 2023
Problem: Build Failure with Perl 5.38
Solution: Fix Build Failure

closes: vim/vim#12543, closes: vim/vim#12575

vim/vim@1d7caa5

Co-authored-by: Philip H <47042125+pheiduck@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants