在草莓perl 5.28.1上安装FFI-鸭嘴兽

时间:2019-03-20 02:14:25

标签: perl ffi strawberry-perl

当我尝试在Straeberry Perl 5.28.1上安装FFI::Platypus时,出现以下消息。知道有什么问题吗?

xs/windl.o:windl.c:(.text+0x12c): undefined reference to `EnumProcessModules'
xs/windl.o:windl.c:(.text+0x185): undefined reference to `GetModuleFileNameExA'
collect2.exe: error: ld returned 1 exit status
gmake: *** [Makefile:529: blib\arch\auto\FFI\Platypus\Platypus.xs.dll] Error 1
  PLICEASE/FFI-Platypus-0.86.tar.gz
  "C:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\c\bin\gmake.exe" -- NOT OK
Stopping: 'install' failed for 'FFI::Platypus'.
Failed during this command:
 PLICEASE/FFI-Platypus-0.86.tar.gz            : make NO

这也是安装过程中的链接器步骤

gcc -c  -Iinclude -IC:/Dev/OPENSO~1/Perl/STRAWB~1.1-6/c/lib/PKGCON~1/../../include \
-s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2 \
  -DVERSION=\"0.86\" \
-DXS_VERSION=\"0.86\"  "-IC:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\perl\lib\CORE"   lib/FFI/Platypus.c -o lib/FFI/Platypus.o
gcc -c  -Iinclude -IC:/Dev/OPENSO~1/Perl/STRAWB~1.1-6/c/lib/PKGCON~1/../../include -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2   -DVERSION=\"0.86\" -DXS_VERSION=\"0.86\"  "-IC:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\perl\lib\CORE"   xs/closure.c -o xs/closure.o
gcc -c  -Iinclude -IC:/Dev/OPENSO~1/Perl/STRAWB~1.1-6/c/lib/PKGCON~1/../../include -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2   -DVERSION=\"0.86\" -DXS_VERSION=\"0.86\"  "-IC:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\perl\lib\CORE"   xs/complex.c -o xs/complex.o
gcc -c  -Iinclude -IC:/Dev/OPENSO~1/Perl/STRAWB~1.1-6/c/lib/PKGCON~1/../../include -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2   -DVERSION=\"0.86\" -DXS_VERSION=\"0.86\"  "-IC:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\perl\lib\CORE"   xs/custom.c -o xs/custom.o
gcc -c  -Iinclude -IC:/Dev/OPENSO~1/Perl/STRAWB~1.1-6/c/lib/PKGCON~1/../../include -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2   -DVERSION=\"0.86\" -DXS_VERSION=\"0.86\"  "-IC:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\perl\lib\CORE"   xs/havepm.c -o xs/havepm.o
gcc -c  -Iinclude -IC:/Dev/OPENSO~1/Perl/STRAWB~1.1-6/c/lib/PKGCON~1/../../include -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2   -DVERSION=\"0.86\" -DXS_VERSION=\"0.86\"  "-IC:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\perl\lib\CORE"   xs/meta.c -o xs/meta.o
gcc -c  -Iinclude -IC:/Dev/OPENSO~1/Perl/STRAWB~1.1-6/c/lib/PKGCON~1/../../include -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2   -DVERSION=\"0.86\" -DXS_VERSION=\"0.86\"  "-IC:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\perl\lib\CORE"   xs/names.c -o xs/names.o
gcc -c  -Iinclude -IC:/Dev/OPENSO~1/Perl/STRAWB~1.1-6/c/lib/PKGCON~1/../../include -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2   -DVERSION=\"0.86\" -DXS_VERSION=\"0.86\"  "-IC:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\perl\lib\CORE"   xs/perl_math_int64.c -o xs/perl_math_int64.o
gcc -c  -Iinclude -IC:/Dev/OPENSO~1/Perl/STRAWB~1.1-6/c/lib/PKGCON~1/../../include -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2   -DVERSION=\"0.86\" -DXS_VERSION=\"0.86\"  "-IC:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\perl\lib\CORE"   xs/record_opaque.c -o xs/record_opaque.o
gcc -c  -Iinclude -IC:/Dev/OPENSO~1/Perl/STRAWB~1.1-6/c/lib/PKGCON~1/../../include -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2   -DVERSION=\"0.86\" -DXS_VERSION=\"0.86\"  "-IC:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\perl\lib\CORE"   xs/record_simple.c -o xs/record_simple.o
gcc -c  -Iinclude -IC:/Dev/OPENSO~1/Perl/STRAWB~1.1-6/c/lib/PKGCON~1/../../include -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2   -DVERSION=\"0.86\" -DXS_VERSION=\"0.86\"  "-IC:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\perl\lib\CORE"   xs/record_string.c -o xs/record_string.o
gcc -c  -Iinclude -IC:/Dev/OPENSO~1/Perl/STRAWB~1.1-6/c/lib/PKGCON~1/../../include -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -s -O2   -DVERSION=\"0.86\" -DXS_VERSION=\"0.86\"  "-IC:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\perl\lib\CORE"   xs/windl.c -o xs/windl.o
"C:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\perl\bin\perl.exe" -MExtUtils::Mksymlists \
     -e "Mksymlists('NAME'=>\"FFI::Platypus\", 'DLBASE' => 'Platypus', 'DL_FUNCS' => {  }, 'FUNCLIST' => [], 'IMPORTS' => {  }, 'DL_VARS' => [], 'FILE' => q[lib/FFI/Platypus]);"
g++.exe lib/FFI/Platypus.def -o blib\arch\auto\FFI\Platypus\Platypus.xs.dll -LC:/Dev/OPENSO~1/Perl/STRAWB~1.1-6/c/lib/PKGCON~1/../../lib/../lib -mdll -s -L"C:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\perl\lib\CORE" -L"C:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\c\lib" lib/FFI/Platypus.o xs/closure.o xs/complex.o xs/custom.o xs/havepm.o xs/meta.o xs/names.o xs/perl_math_int64.o xs/record_opaque.o xs/record_simple.o xs/record_string.o xs/windl.o   "C:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\perl\lib\CORE\libperl528.a" "C:\Dev\OPENSO~1\Perl\STRAWB~1.1-6\c\lib\PKGCON~1\..\..\lib\..\lib\libffi.a" -Wl,--enable-auto-image-base

1 个答案:

答案 0 :(得分:2)

从链接器错误消息(缺少符号EnumProcessModulesGetModuleFileNameExA,它们是Windows API函数)中很明显,库kernel32已丢失。更新中显示的链接器命令行证明了这一点。

此更新还显示您已在包含空格的路径下安装了Strawberry Perl:

"C:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\...

使用具有特殊含义的字符的路径,例如空格(,哈希(#)等,总是会带来麻烦。在这种特殊情况下,它导致构建找不到任何库:

...
Configuring FFI-Platypus-0.86 ... using system libffia via PkgConfigPP
Checking if your kit is complete...
Looks good
Warning (mostly harmless): No library found for -lpsapi
Warning (mostly harmless): No library found for -lmoldname
Warning (mostly harmless): No library found for -lkernel32
Warning (mostly harmless): No library found for -luser32
Warning (mostly harmless): No library found for -lgdi32
Warning (mostly harmless): No library found for -lwinspool
Warning (mostly harmless): No library found for -lcomdlg32
Warning (mostly harmless): No library found for -ladvapi32
Warning (mostly harmless): No library found for -lshell32
Warning (mostly harmless): No library found for -lole32
Warning (mostly harmless): No library found for -loleaut32
Warning (mostly harmless): No library found for -lnetapi32
Warning (mostly harmless): No library found for -luuid
Warning (mostly harmless): No library found for -lws2_32
Warning (mostly harmless): No library found for -lmpr
Warning (mostly harmless): No library found for -lwinmm
Warning (mostly harmless): No library found for -lversion
Warning (mostly harmless): No library found for -lodbc32
Warning (mostly harmless): No library found for -lodbccp32
Warning (mostly harmless): No library found for -lcomctl32
Generating a gmake-style Makefile
...

不幸的是,该警告并非“无害”,因为它会导致链接器命令行没有例如-lkernel32,从而导致链接器错误。

解决方案:重命名路径中的目录以删除所有空格,例如

C:\Dev\OpenSource_Tools\...

原始答案 FFI::Platypus的github项目显示作者正在运行CI build for Strawberry Perl。因此,要检查的一件事是遵循该CI构建中的构建说明:

cpanm Capture::Tiny ExtUtils::MakeMaker ExtUtils::ParseXS IPC::Cmd
cpanm FFI::Platypus

您可能还想将构建日志与FFI::Platypus CI Builds on AppVeyor之一进行比较,以发现差异。