Cwd.c:可加载库和 perl 二进制文件不匹配(得到握手密钥 0xdb00080,需要 0xde00080)

Pra*_*gar 8 ubuntu perl cpan upgrade perl-module

将 Ubuntu 16.04 LTS 升级到 18.04 LTS 后,所有 Perl 模块和“cpan”都停止工作。每次我运行我的脚本时都会导致错误

threads.c: loadable library and Perl binaries are mismatched (got handshake key 0xdb00080, needed 0xde00080)
Run Code Online (Sandbox Code Playgroud)

当我尝试打开 cpan 它显示

Cwd.c: loadable library and Perl binaries are mismatched (got handshake key 0xdb00080, needed 0xde00080)
Run Code Online (Sandbox Code Playgroud)

我在 ubuntu 16.04 中安装了“Cwd”、“threads”模块,其中 Perl 版本为 5.22.1,而在 ubuntu 18.04 中,Perl 版本为 5.26.1。

我试图删除旧版本的模块但失败了。我删除了 ~/.cpan 文件夹中的内容。

PS:在root用户下一切正常。如果我跑

sudo su
cpan
Run Code Online (Sandbox Code Playgroud)

完美地工作。但是作为普通用户,我无法运行任何 perl 模块/脚本/cpan。

如何更正问题?如何重新安装 cpan 或 cpan 模块?

我尝试重新安装 Perl,但没有帮助

sudo apt-get --reinstall install perl
sudo apt-get --reinstall install libcwd-guard-perl
Run Code Online (Sandbox Code Playgroud)

我安装了 cpan minus 和 cpan plus,它给出了同样的错误。

Som*_*ome 9

为了解决问题,可以使用下一个链接:

https://dev.to/foursixnine/about-perl-and-mismatched-binaries-346l https://metacpan.org/pod/release/DBOOK/App-MigrateModules-0.002/script/perl-migrate-modules

或者在命令中:(替换为你的 perl5 文件夹,在我的例子中是 ~/perl5)

 mv <perl5> perl5_old
 cpan
 cpan App::MigrateModules
 perl-migrate-modules --from perl5_old /usr/bin/perl
Run Code Online (Sandbox Code Playgroud)

其中perl5是你的perl文件夹,通常在路径中存在于ENV变量PERL5LIB中。


Pra*_*bah 4

我通过以下方式解决了这个问题https://github.com/Perl/perl5/issues/15861

我运行了命令perl -MCPAN -e 'recompile()'

重新编译了所有模块,终于成功了。