在 Strawberry perl 5.28.1 上安装 FFI-Platypus

Installing FFI-Platypus on Strawberry perl 5.28.1

当我尝试在 strabeberry 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

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

更新还显示您已经在包含 spaces:

的路径下安装了 Strawberry Perl
"C:\Dev\OpenSource Tools\Perl\strawberry-perl-5.28.1.1-64bit-portable\...

使用带有特殊含义的字符的路径,如space(</code>),哈希(<code>#)等,总是自找麻烦.在这种特殊情况下,它会导致无法找到任何库的构建:

...
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
...

不幸的是,警告不是 "mostly harmless",因为它会导致链接器命令行没有例如-lkernel32 因此链接器错误。

解决方案:重命名路径中的目录以删除任何spaces,例如

C:\Dev\OpenSource_Tools\...

原始答案 FFI::Platypus shows that the author is running a CI build for Strawberry Perl 的 github 项目。因此,要检查的一件事是遵循 CI build:

中的构建说明
cpanm Capture::Tiny ExtUtils::MakeMaker ExtUtils::ParseXS IPC::Cmd
cpanm FFI::Platypus

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