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

Hi,

We have build Perl 5.26.1 from source and used the same Perl to create a perlmodule.c file from an XS file perlmodule.xs. But when we try to execute this C code, we get the following error.
../perlmodule.c: loadable library and perl binaries are mismatched (got handshake key 0xe280080, needed 0xde00080)

Previously we were using Perl 5.16 and there were no issues. Could you please let us know whether we need to rewrite the XS module for Perl 5.26. Currently we are using the same XS module which is used in Perl 5.16. I am not sure if that is creating the issue here.

We are generating the .c files with following command.
perl ExtUtils/xsubpp -typemap typemap -typemap ExtUtils/typemap perlmodule.xs > perlmodule.cpp

Following is the configuration details.

Summary of my perl5 (revision 5 version 26 subversion 1) configuration +: Platform: osname=linux osvers=2.6.16.21-0.8-default archname=x86_64-linux-thread-multi uname='linux 2.6.16.21-0.8-default #1 mon jul 3 18:25:39 utc 2006 +x86_64 x86_64 x86_64 gnulinux ' config_args='-d -s -e -U uselargefiles -U use64bitint -U usemorebi +ts -D usemultiplicity -D usethreads -D prefix=/opt/perl/a -D installu +srbinperl=no -D useshrplib -D ccflags= -D libperl=libperl.so -D man1d +ir= -D perladmin=none -D pager=/usr/bin/less -D otherlibdirs=/opt/pe +rl/a/lib/site_perl' 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 ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -f +stack-protector -I/usr/local/include -D_FORTIFY_SOURCE=2' optimize='-O2' cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -f +stack-protector -I/usr/local/include' ccversion='' gccversion='4.1.0 (SUSE Linux)' 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 =' -fstack-protector -L/usr/local/lib' libpth=/usr/local/lib /usr/lib64/gcc/x86_64-suse-linux/4.1.0/../.. +/../../x86_64-suse-linux/lib /usr/lib /lib/../lib64 /usr/lib/../lib64 + /lib /lib64 /usr/lib64 /usr/local/lib64 libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdb +m_compat perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc libc=libc-2.4.so so=so useshrplib=true libperl=libperl.so gnulibc_version='2.4' Dynamic Linking: dlsrc=dl_dlopen.xs dlext=so d_dlsymun=undef ccdlflags='-Wl,-E -Wl,-rpath,/opt/perl/a/lib/5.26.1/x86_64-linux-t +hread-multi/CORE' cccdlflags='-fPIC' lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector' Characteristics of this binary (from libperl): Compile-time options: 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 USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API Built under linux

Thanks and Regards,
Jobin Joseph
  • Comment on Using Perl XS in 5.26 fails with error loadable library and perl binaries are mismatched
  • Download Code

Replies are listed 'Best First'.
Re: Using Perl XS in 5.26 fails with error loadable library and perl binaries are mismatched
by haukex (Archbishop) on Jul 17, 2018 at 13:10 UTC
    loadable library and perl binaries are mismatched (got handshake key 0xe280080, needed 0xde00080)

    AFAIK this happens when you try to load an XS module that was compiled for a different version of perl. Is Perl v5.16 still installed on that system? Are you sure you've gotten rid of all references to it during the build process of the module as well as when you try to use it later, that is, it's not lurking in PATH, PERL5LIB, etc.?

Re: Using Perl XS in 5.26 fails with error loadable library and perl binaries are mismatched
by ikegami (Patriarch) on Jul 17, 2018 at 16:13 UTC

    You cut out the only part of perl -V that was interesting

Re: Using Perl XS in 5.26 fails with error loadable library and perl binaries are mismatched
by Anonymous Monk on Jul 18, 2018 at 00:07 UTC
    Its simple, you're mixing perls, like ikegami said, you've omitted the part that talks about perl paths (@INC from perl -V and EVERYTHING path/compile related to mystery module you're trying to build)