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

Hi I'm new guy in perl and trying to install perl sdl module.

i'm used ubuntu 14.04 lts .

1:I'm try cpan command

$ sudo -s cpan SDL 1>stdout.txt 2>stderr.txt

stdout.txt:

1 Reading '/home/freakcoco/.cpan/Metadata' 2 Database was generated on Fri, 04 Sep 2015 16:29:02 GMT 3 Running install for module 'SDL' 4 Checksum for /home/freakcoco/.cpan/sources/authors/id/F/FR/FROGGS/S +DL-2.546.tar.gz ok 5 ---- Unsatisfied dependencies detected during ---- 6 ---- FROGGS/SDL-2.546.tar.gz ---- 7 Alien::SDL [build_requires] 8 Running install for module 'Alien::SDL' 9 Checksum for /home/freakcoco/.cpan/sources/authors/id/F/FR/FROGGS/A +lien-SDL-1.446.tar.gz ok 10 Configuring F/FR/FROGGS/Alien-SDL-1.446.tar.gz with Build.PL 11 Welcome to Alien::SDL module installation 12 ----------------------------------------- 13 checking operating system... linux 14 checking for cc... yes 15 checking build system type... x86_64-linux-gnu-thread-multi 16 checking platform specific module... using 'My::Builder::Unix' 17 Warning: No success on command[/usr/bin/perl Build.PL --installdirs + site] 18 FROGGS/Alien-SDL-1.446.tar.gz 19 /usr/bin/perl Build.PL --installdirs site -- NOT OK 20 FROGGS/SDL-2.546.tar.gz 21 Has already been unwrapped into directory /home/freakcoco/.cpan/b +uild/SDL-2.546-1przxQ 22 Warning: Prerequisite 'Alien::SDL => 1.446' for 'FROGGS/SDL-2.546.t +ar.gz' failed when processing 'FROGGS/Alien-SDL-1.446.tar.gz' with 'w +ritemakefile => NO '/usr/bin/perl Build.PL --installdirs site' return +ed status 512'. Continuing, but chances to succeed are limited. 23 Configuring F/FR/FROGGS/SDL-2.546.tar.gz with Build.PL 24 Warning: No success on command[/usr/bin/perl Build.PL --installdirs + site] 25 FROGGS/SDL-2.546.tar.gz 26 /usr/bin/perl Build.PL --installdirs site -- NOT OK

stderr.txt:

1 Unknown option: installdirs 2 Too early to specify a build action 'site'. Do 'Build site' instea +d. 3 Can't locate Alien/SDL.pm in @INC (you may need to install the Alie +n::SDL module) (@INC contains: inc /etc/perl /usr/local/lib/perl/5.18 +.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/ +lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at Bui +ld.PL line 12. 4 BEGIN failed--compilation aborted at Build.PL line 12.

2:I'm try to install Alien::SDL (you may need to install the Alien::SDL module)

$ sudo -s cpan SDL 1>stdout2.txt 2>stderr2.txt

stdout2.txt:

1 Reading '/home/freakcoco/.cpan/Metadata' 2 Database was generated on Fri, 04 Sep 2015 16:29:02 GMT 3 Running install for module 'Alien::SDL' 4 Checksum for /home/freakcoco/.cpan/sources/authors/id/F/FR/FROGGS/A +lien-SDL-1.446.tar.gz ok 5 Configuring F/FR/FROGGS/Alien-SDL-1.446.tar.gz with Build.PL 6 Welcome to Alien::SDL module installation 7 ----------------------------------------- 8 checking operating system... linux 9 checking for cc... yes 10 checking build system type... x86_64-linux-gnu-thread-multi 11 checking platform specific module... using 'My::Builder::Unix' 12 Warning: No success on command[/usr/bin/perl Build.PL --installdirs + site] 13 FROGGS/Alien-SDL-1.446.tar.gz 14 /usr/bin/perl Build.PL --installdirs site -- NOT OK

stderr2.txt:

1 Unknown option: installdirs 2 Too early to specify a build action 'site'. Do 'Build site' instea +d.

Replies are listed 'Best First'.
Re: perl sdl module install fail
by hippo (Archbishop) on Sep 05, 2015 at 11:37 UTC
    12 Warning: No success on command[/usr/bin/perl Build.PL --installdirs + site] ... 1 Unknown option: installdirs

    These 2 lines together seem pretty explicit. You have tried to pass the option --installdirs to the build script but this is not an option it recognises. Try running the build script without this option.

Re: perl sdl module install fail
by RichardK (Parson) on Sep 05, 2015 at 12:33 UTC

    It seems that there's a sdl package for ubuntu, libsdl-perl. Have you tried installing that?

    Generally it's much easier to install packages from your distro, if they're available, because they just work ;)

      it work. thank :)

Re: perl sdl module install fail
by skaryzgik (Novice) on Sep 05, 2015 at 23:50 UTC
    It looks like OP has found their answer, but in case anyone else searching finds this, and wants to know why the cpan-style installation is failing, the answer to the crosspost might be useful.

    To summarize that answer, the Build.PL file of Alien::SDL uses Getopt::Long which interferes with Module::Build long options such as --installdirs. Recommendation appears to be to, instead of setting mbuildpl_arg this way, to set mbuild_arg itself in the cpan configuration to installdirs=site. Or possibly to have author of Alien::SDL remove need for Getopt::Long in the Build.PL, but that is probably a lot more work.

Re: perl sdl module install fail
by MidLifeXis (Monsignor) on Sep 08, 2015 at 13:24 UTC

    I will provide my usual free advice (consider the amount you paid for the advice ;-D ) on having your applications rely on the system version of Perl: Don't do it! Instead, if at all possible, include Perl in your application stack (create your own install). At the very least, use the OS's packaging manager to install additional modules if at all possible.

    The OS's perl is for its own environment. If your OS updates its perl installation for its needs, you risk breaking your application. If you update your OS's perl install for your application, you risk breaking your OS. I am not sure which one is worse. Additionally, you no longer have control over your application's environment -- it can change underneath you, causing "it worked yesterday" errors.

    There are very few cases where I target an application against the OS's perl install, and those are usually system utilities built using the OS's default platform.

    --MidLifeXis