为什么我不能在Windows上的任何便携式perl安装上安装SDL?

时间:2018-05-28 08:30:34

标签: windows perl sdl cpan strawberry-perl

在学校,我们被告知要用我们选择的语言做一个私人项目。我选择了perl,而对于图形(强制组件)选择了SDL。

早些时候我已经安装了portable-git,并且perit附带了git-bash。万岁!有效!让我们安装sdl!

cpan SDL

输出:

Can't locate CPAN/Author.pm in @INC (you may need to install the CPAN::Author module)

这使我感到困惑,特别是当我收到cpan CPAN::Author的相同消息时。 所以我安装了一个草莓perl的便携版本(学校计算机安全设置禁止非管理员安装软件),我得到一个不同的错误信息(加载一堆东西后):

Welcome to Alien::SDL module installation                                                                               
-----------------------------------------                                                                                 
checking operating system... MSWin32                                                                                    
checking for gcc... yes                                                                                                 
checking build system type... MSWin32-x64-multi-thread                                                                  
checking platform specific module... using 'My::Builder::Windows'                                                       
checking SDL_INST_DIR env var... no                                                                                     
checking for config script... no                                                                                        
checking for prebuilt binaries... no                                                                                                                                                                                                            
You have the following options:                                                                                         
[1] Quit installation                                                                                                                                                                                                                           
What way do you wanna go? [1 ]1                                                                                         
No 'Build' created  FROGGS/Alien-SDL-1.446.tar.gz                                                                         
C:\Users\gardner.mark.INFOLAB\Downloads\strawberry-perl\perl\bin\perl.exe 
Build.PL -- NOT OK                          Stopping: 'install' failed for 
'Alien::SDL'. 

我已尝试cpan Alien::SDL,并在两个命令上使用-f标志,但我仍然收到相同的消息。我需要安装别的东西,或者问题是什么?

编辑:正如@xxfelixxx建议的那样,我成功安装了cpanm。但是,这会给出以下输出,并带有错误(粗体):

--> Working on SDL                                                                                                      
Fetching http://www.cpan.org/authors/id/F/FR/FROGGS/SDL-2.548.tar.gz ... OK                                             
==> Found dependencies: Alien::SDL, Tie::Simple                                                                         
--> Working on Alien::SDL                                                                                               
Fetching http://www.cpan.org/authors/id/F/FR/FROGGS/Alien-SDL-1.446.tar.gz... OK
Configuring Alien-SDL-1.446 ... N/A                                                                                     
! Configure failed for Alien-SDL-1.446. See [...]\STRAWB~1\data\.cpanm\work\1527577290.7232\build.log for details.                                                                                                     
--> Working on Tie::Simple                                                                                             
Fetching http://www.cpan.org/authors/id/H/HA/HANENKAMP/Tie-Simple-1.04.tar.gz ... OK                                    
Configuring Tie-Simple-1.04 ... OK                                                                                      
Building and testing Tie-Simple-1.04 ... OK                                                                             
Successfully installed Tie-Simple-1.04                                                                                  
! Installing the dependencies failed: Module 'Alien::SDL' is not installed                                              
! Bailing out the installation for SDL-2.548.                                                                           
1 distribution installed 

因此,如前所述,Alien :: SDL无法自行配置。

1 个答案:

答案 0 :(得分:1)

对topicstarter的简短回答:

SDL 1.x库和Alien:SDL perl模块似乎都没有维护,每个人都去了SDL2和Alien :: SDL2

您也应该。

我安装了Strawberry 5.30 Win64,然后解决了文件/文件夹访问权限的明显问题,因为我不想以管理员用户身份运行Perl或Perl游戏。

  • d:\ Strawberry \ cpan \
  • d:\ Strawberry \ perl \

然后我刚刚发出了Windows Shell命令cpan install Alien:SDL2-它安装得像个超级按钮。

或者,似乎可以安装Alien:SDL version 1,但这将需要Win32 / x86版本的Strawberry Perl,而不是Win64 / x64版本。但为什么?根据{{​​3}},SDL v.1自2013年3月起已失效。


只需添加更多详细信息即可。
也被这个击中了...
我的愿望只是在Win10 x64盒子上运行《冰雪奇缘》游戏。
我有一些编程经验,但是没有Perl的经验,也没有Perl IDE或其他东西。
我不需要任何Perl编程麻烦,我只是想让游戏运行。

我从Google那里收到了同样的错误消息,因此这可能也会对其他人有所帮助,Google可能也会在此转发给其他人。


就像我说的那样,SDL 1.x库和Alien:SDL perl模块是不需要维护的。

然而,FrozenBubble游戏已不再维护,仅适用于SDL 1.x


CPAN测试在Windows上有Alien :: SDL的以下记录: http://yapgh.blogspot.com

值得注意的事情:

  • 它使用草莓5.28.2而不是5.30,
  • 它使用x86 / Win32而不是x64 / Win63
  • 它引用gccversion ='7.1.0'(Straberry 5.30 win64似乎有8.3)

因此似乎可以质疑,GCC 7.1和8.3的Win64的ABI是否相同。


该文件似乎触发了错误:

  • d:\ Strawberry \ cpan \ build \ Alien-SDL-1.446-0 \ inc \ My \ Utility.pm

它的$prebuilt_binaries数组列出了一些内容-哇,您觉得呢? -预先构建的SDL 1.x库。对于Win32预建SDL1.x,它具有3个选项,对于Win64,它具有两个选项:

  • BEWARE: binaries are using old ABI选项just for old strawberryperl 5.12.x/64bit和GCC 4.4.3
  • RECOMMENDED代表GCC gccversion_re => qr/^4\.(4\.[5-9]|[5-9]\.[0-9])$/
  • 注意:Win32库二进制文件缺少GCC版本元素(不选中)!

该文件还具有一个sub check_prebuilt_binaries,它会遍历数组并尝试将找到的Perl环境与这些条件匹配。

sub的第二行已注释掉要检查的环境的debug printf(GCC除外)。我对其进行了注释,然后向上移动并扩展到包含GCC。

sub check_prebuilt_binaries
{
  print "(os=$^O cc=$cc archname=$Config{archname} gccVer=$Config{gccversion})\r\n";
  print "checking for prebuilt binaries... ";
  my @good = ();
  foreach my $b (@{$prebuilt_binaries}) {
    if ( ($^O =~ $b->{os_re}) &&
         ($Config{archname} =~ $b->{arch_re}) &&
         ($cc =~ $b->{cc_re}) &&
         (!defined $b->{gccversion_re} || $Config{gccversion} =~ $b->{gccversion_re})
        ) {
      $b->{buildtype} = 'use_prebuilt_binaries';
      push @good, $b;
    }
  }
  scalar(@good)
    ? print "yes, " . scalar(@good) . " option(s)\n"
    : print "no\n";
  #returning ARRAY of HASHREFs (sometimes more than one value)
  return \@good;
}

然后我运行Perl Build,这是我得到的:

d:\Strawberry\cpan\build\Alien-SDL-1.446-0>perl ./Build.PL
Welcome to Alien::SDL module installation
-----------------------------------------
checking operating system... MSWin32
checking for gcc... yes
checking build system type... MSWin32-x64-multi-thread
checking platform specific module... using 'My::Builder::Windows'
checking SDL_INST_DIR env var... no
checking for config script... no
(os=MSWin32 cc=gcc archname=MSWin32-x64-multi-thread gccVer=8.3.0)
checking for prebuilt binaries... no

You have the following options:
[1] Quit installation

What way do you wanna go? [1 ]1

我不是很好的regexper,但是我可以看到GCC Win64版本固定为4.4.5+或4.5.x-不允许使用5.0+版本。上次提交Alien:SDL时,它们可能不存在。


GCC发行说明提到了ABI的更改, x86-64较为常见,例如:

我不知道哪个特定的Win64 GCC ABI更改对LibSDL至关重要。但是从CPAN测试看来,至少WinCC ABI在GCC 4.5和7.1之间的变化还不错。无论如何,从源头上用现代GCC编译SDL 1.x绝对超出我的能力。所以,接受它还是离开它……


希望一切顺利,我刚刚删除了(推荐)Win64 SDL1预制二进制文件的GCC版本测试。

d:\Strawberry\cpan\build\Alien-SDL-1.446-0>perl ./Build.PL test
Welcome to Alien::SDL module installation
-----------------------------------------
checking operating system... MSWin32
checking for gcc... yes
checking build system type... MSWin32-x64-multi-thread
checking platform specific module... using 'My::Builder::Windows'
Too early to specify a build action 'test'.  Do 'Build test' instead.

d:\Strawberry\cpan\build\Alien-SDL-1.446-0>perl ./Build test
Fetching 'http://strawberryperl.com/package/kmx/sdl/Win64_SDL-1.2.14-extended-bin_20111205.zip'...
Checking checksum for 'download\Win64_SDL-1.2.14-extended-bin_20111205.zip'...
Extracting download\Win64_SDL-1.2.14-extended-bin_20111205.zip...
t\001_load.t ................ 1/1 # Testing Alien::SDL 1.446, Perl 5.030000, D:\Strawberry\perl\bin\perl.exe
# Build type: use_prebuilt_binaries
# Detected sdl-config script: n.a.
# Build option used:
#       Binaries Win/64bit SDL-1.2.14 (extended, 20111205) RECOMMENDED
#       (gfx, image, mixer, net, smpeg, ttf, sound, svg, rtf, Pango)
# URL:
#       http://strawberryperl.com/package/kmx/sdl/Win64_SDL-1.2.14-extended-bin_20111205.zip
#       http://froggs.de/libsdl/Win64_SDL-1.2.14-extended-bin_20111205.zip
# SHA1: 35f3b496ca443a9d14eff77e9e26acfa813afafd
t\001_load.t ................ ok
t\002_config.t .............. 1/6 # Prefix='D:\Strawberry\cpan\build\Alien-SDL-1.446-0\blib\lib\auto\share\dist\Alien-SDL\1.446_6ae293a9\bin\..\'
t\002_config.t .............. ok
t\003_check_header.t ........ # Testing basic headers SDL.h + SDL_version.h
[Alien::SDL] Testing header(s): SDL.h
t\003_check_header.t ........ 1/2 L.h, SDL_version.h
t\003_check_header.t ........ ok
t\004_get_header_version.t .. 1/1 # Core version: 1.2.14
t\004_get_header_version.t .. ok
t\release-pod-coverage.t .... skipped: these tests are for release candidate testing
t\release-pod-syntax.t ...... skipped: these tests are for release candidate testing
All tests successful.
Files=6, Tests=10,  8 wallclock secs ( 0.06 usr +  0.05 sys =  0.11 CPU)
Result: PASS

Yahoo!作品!!!大概。。。


现在我终于可以使用CPAN来安装lib和游戏了吗?

...不幸的是,

CPAN可能检测到我修改了源代码(校验和失败),将香草库重新提取到新的d:\Strawberry\cpan\build\Alien-SDL-1.446-1\文件夹中,并且构建失败,并出现与上述相同的错误。不好。

至少perl ./Build.PL install可以工作,但是尽管该库是在本地安装的,却几乎没有在本地CPAN注册表中注册,因为它是在CPAN框架之外安装的?。

CPAN专家可能会设法固定伪造CPAN校验和的本地版本,或者只是将更新的SDL模块上传到CPAN,但是...我不是。

cpan> install  Games::FrozenBubble
Running install for module 'Games::FrozenBubble'
Checksum for D:\Strawberry\cpan\sources\authors\id\K\KT\KTHAKORE\Games-FrozenBubble-2.212.tar.gz ok

……

Running make test for DRTECH/Locale-Maketext-Lexicon-1.00.tar.gz
"D:\Strawberry\perl\bin\perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib\lib', 'blib\arch')" t/*.t
t/1-basic.t ...................... 1/33 "msgunfmt" не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.
t/1-basic.t ...................... ok
…… 
t/55-runextract.t ................ ok
t/6-gettext.t .................... 1/30 "msgunfmt" не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.
t/6-gettext.t .................... ok
…...
t/preload.t ...................... ok
t/release-eol.t .................. skipped: these tests are for release candidate testing
t/release-pod-syntax.t ........... skipped: these tests are for release candidate testing
All tests successful.
Files=17, Tests=361, 11 wallclock secs ( 0.22 usr +  0.17 sys =  0.39 CPU)
Result: PASS

通过???真的吗?


还有几个补丁-尽管可以运行。怀旧... https://www.gnu.org/software/gcc/gcc-4.5/changes.html

相关问题