Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Installing SDL

by Chuma (Acolyte)
on Apr 17, 2010 at 13:55 UTC ( #835253=perlquestion: print w/ replies, xml ) Need Help??
Chuma has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks, please offer some help to a confused novice.

I'm coding on a Mac, and I need to make some simple 3D visualisations. So I came across this nice looking tutorial (http://www.perl.com/pub/a/2004/12/01/3d_engine.html) which uses SDL. Now, I'm not used to all that messy techie stuff, so I don't know how to get that to work. I've found a download of SDL.pm (http://search.cpan.org/dist/SDL_Perl/lib/SDL.pm), and it had a bunch of files that I don't know what to do with. I also tried using MacPorts ("sudo port install p5-sdl_perl") and it prints a long list of dependencies which failed to build.

What to do? And, by the way, should I rather be making my 3Ds some other way instead?

Comment on Installing SDL
Re: Installing SDL
by biohisham (Priest) on Apr 17, 2010 at 17:05 UTC
    Checking the Tutorial section of the Monastery with regard to Installing Modules can be a good start-up point, SDL seems to get quite a number of libraries and tutorials from CPAN as well, so it might be worth the efforts..

    Dependency issues can be resolved if your version of Perl allows installation via the Perl package Manager Utility, however, learning different approaches to packages installation if effective..



    Excellence is an Endeavor of Persistence. Chance Favors a Prepared Mind.
Re: Installing SDL
by Khen1950fx (Canon) on Apr 18, 2010 at 03:35 UTC
    There's a lot of ground to cover.

    First, I tried to install SDL, but it wouldn't make. I put this bundle together to see if it would help with the dependencies.

    #!/usr/bin/perl use strict; use warnings; use CPAN; CPAN::Shell->force('install', "PadWalker", "Data::Dumper::Names", "Filter::Util::Call", "ExtUtils::MakeMaker", "ExtUtils::CBuilder", "File::Spec", "Scalar::Util", "Test::Harness", "Pod::Man", "Pod::Simple", "Pod::Escapes", "Pod::Usage", "HTML::Entities", "Net::SMTP", "Net::SMTP_auth", "Test::Pod", "Test::Pod::Coverage", "Text::Trac", "Getopt::Long", "Text::Wrap", "Test", "YAML", "ExtUtils::CBuilder", "Test::Simple", "IO::CaptureOutput", "Test::Most", "Pod::ToDemo", "File::Temp", "File::ShareDir", "File::Path", "File::Fetch", "Digest::SHA", "Archive::Extract", "Archive::Tar", "Archive::Zip", "Module::Build", "Alien::SDL");
    Second, I had to modify the Build.PL. Here's the Build.PL that I used:
    #! perl -w # # Copyright (C) 2003 chromatic # Copyright (C) 2004 David J. Goehrig # Copyright (C) 2010 Kartik Thakore use strict; use warnings; use Carp; use lib 'inc'; use Alien::SDL; print STDERR <<BROKENMSG; *************************** !!!WARNING!!! **************************** +**** This Release breaks back compatibility support with versions 2.2 and b +elow ********************************************************************** +**** BROKENMSG ### we need the platform-specific module my %platforms =( MSWin32 => 'Windows', MacOS => 'MacOS', darwin => 'Darwin', cygwin => 'Unix', freebsd => 'Unix', gnukfreebsd => 'Unix', linux => 'Unix', netbsd => 'Unix', openbsd => 'Unix', solaris => 'Unix', ); my $package = 'My::Builder::' . ($platforms{$^O} || 'Unix'); print "Gonna use '$package' class ...\n"; eval "require $package" or croak "Require '$package' failed: $@\n"; ### subsystems to build # <subsystem> # <file> = hash of the following 2 values: # <from> = location of source file # <to> = location of build file to get name right # <libraries> = list reqiured libraries, names the same as keys + to hash %libraries my %subsystems = ( SDL => { file => { from => 'src/SDL.xs', to => 'lib/SDL_perl.xs', }, libraries => [qw( SDL )], }, Time => { file => { from => 'src/Core/Time.xs', to => 'lib/SDL/Time.xs', }, libraries => [qw( SDL )], }, Events => { file => { from => 'src/Core/Events.xs', to => 'lib/SDL/Events.xs', }, libraries => [qw( SDL )], }, Event => { file => { from => 'src/Core/objects/Event.xs', to => 'lib/SDL/Event.xs', }, libraries => [qw( SDL )], }, GFX => { file => { from => 'src/GFX/GFX.xs', to => 'lib/SDL/GFX.xs', }, libraries => [qw( SDL SDL_gfx_primitives )], }, BlitFunc => { file => { from => 'src/GFX/BlitFunc.xs', to => 'lib/SDL/GFX/BlitFunc.xs', }, libraries => [qw( SDL SDL_gfx_blitfunc )], }, Framerate => { file => { from => 'src/GFX/Framerate.xs', to => 'lib/SDL/GFX/Framerate.xs', }, libraries => [qw( SDL SDL_gfx_framerate )], }, FPSManager => { file => { from => 'src/GFX/FPSManager.xs', to => 'lib/SDL/GFX/FPSManager.xs', }, libraries => [qw( SDL SDL_gfx_framerate )], }, ImageFilter => { file => { from => 'src/GFX/ImageFilter.xs', to => 'lib/SDL/GFX/ImageFilter.xs', }, libraries => [qw( SDL SDL_gfx_imagefilter )], }, Primitives => { file => { from => 'src/GFX/Primitives.xs', to => 'lib/SDL/GFX/Primitives.xs', }, libraries => [qw( SDL SDL_gfx_primitives )], }, Rotozoom => { file => { from => 'src/GFX/Rotozoom.xs', to => 'lib/SDL/GFX/Rotozoom.xs', }, libraries => [qw( SDL SDL_gfx_rotozoom )], }, MultiThread => { file => { from => 'src/Core/MultiThread.xs', to => 'lib/SDL/MultiThread.xs', }, libraries => [qw( SDL )], }, Video => { file => { from => 'src/Core/Video.xs', to => 'lib/SDL/Video.xs', }, libraries => [qw( SDL )], }, Audio => { file => { from => 'src/Core/Audio.xs', to => 'lib/SDL/Audio.xs', }, libraries => [qw( SDL )], }, Rect => { file => { from => 'src/Core/objects/Rect.xs', to => 'lib/SDL/Rect.xs', }, libraries => [qw( SDL )], }, Color => { file => { from => 'src/Core/objects/Color.xs', to => 'lib/SDL/Color.xs', }, libraries => [qw( SDL )], }, Surface => { file => { from => 'src/Core/objects/Surface.xs', to => 'lib/SDL/Surface.xs', }, libraries => [qw( SDL )], }, Overlay => { file => { from => 'src/Core/objects/Overlay.xs', to => 'lib/SDL/Overlay.xs', }, libraries => [qw( SDL )], }, RWOps => { file => { from => 'src/Core/objects/RWOps.xs', to => 'lib/SDL/RWOps.xs', }, libraries => [qw( SDL )], }, PixelFormat => { file => { from => 'src/Core/objects/PixelFormat.xs', to => 'lib/SDL/PixelFormat.xs', }, libraries => [qw( SDL )], }, AudioSpec => { file => { from => 'src/Core/objects/AudioSpec.xs', to => 'lib/SDL/AudioSpec.xs', }, libraries => [qw( SDL )], }, AudioCVT => { file => { from => 'src/Core/objects/AudioCVT.xs', to => 'lib/SDL/AudioCVT.xs', }, libraries => [qw( SDL )], }, Mixer => { file => { from => 'src/Mixer/Mixer.xs', to => 'lib/SDL/Mixer.xs', }, libraries => [qw( SDL SDL_mixer )], }, MixerSamples => { file => { from => 'src/Mixer/Samples.xs', to => 'lib/SDL/Mixer/Samples.xs', }, libraries => [qw( SDL SDL_mixer )], }, MixerChannels => { file => { from => 'src/Mixer/Channels.xs', to => 'lib/SDL/Mixer/Channels.xs', }, libraries => [qw( SDL SDL_mixer )], }, MixerGroups => { file => { from => 'src/Mixer/Groups.xs', to => 'lib/SDL/Mixer/Groups.xs', }, libraries => [qw( SDL SDL_mixer )], }, MixerMusic => { file => { from => 'src/Mixer/Music.xs', to => 'lib/SDL/Mixer/Music.xs', }, libraries => [qw( SDL SDL_mixer )], }, MixerEffects => { file => { from => 'src/Mixer/Effects.xs', to => 'lib/SDL/Mixer/Effects.xs', }, libraries => [qw( SDL SDL_mixer )], }, MixChunk => { file => { from => 'src/Mixer/objects/MixChunk.xs', to => 'lib/SDL/Mixer/MixChunk.xs', }, libraries => [qw( SDL SDL_mixer )], }, MixMusic => { file => { from => 'src/Mixer/objects/MixMusic.xs', to => 'lib/SDL/Mixer/MixMusic.xs', }, libraries => [qw( SDL SDL_mixer )], }, Palette => { file => { from => 'src/Core/objects/Palette.xs', to => 'lib/SDL/Palette.xs', }, libraries => [qw( SDL )], }, VideoInfo => { file => { from => 'src/Core/objects/VideoInfo.xs', to => 'lib/SDL/VideoInfo.xs', }, libraries => [qw( SDL )], }, Mouse => { file => { from => 'src/Core/Mouse.xs', to => 'lib/SDL/Mouse.xs', }, libraries => [qw( SDL )], }, Cursor => { file => { from => 'src/Core/objects/Cursor.xs', to => 'lib/SDL/Cursor.xs', }, libraries => [qw( SDL )], }, Joystick => { file => { from => 'src/Core/Joystick.xs', to => 'lib/SDL/Joystick.xs', }, libraries => [qw( SDL )], }, CDROM => { file => { from => 'src/Core/CDROM.xs', to => 'lib/SDL/CDROM.xs', }, libraries => [qw( SDL )], }, CDTrack => { file => { from => 'src/Core/objects/CDTrack.xs', to => 'lib/SDL/CDTrack.xs', }, libraries => [qw( SDL )], }, CD => { file => { from => 'src/Core/objects/CD.xs', to => 'lib/SDL/CD.xs', }, libraries => [qw( SDL )], }, TTF => { file => { from => 'src/TTF/TTF.xs', to => 'lib/SDL/TTF.xs', }, libraries => [qw( SDL SDL_ttf )], }, TTF_Font => { file => { from => 'src/TTF/objects/Font.xs', to => 'lib/SDL/TTF/Font.xs', }, libraries => [qw( SDL SDL_ttf )], }, Version => { file => { from => 'src/Core/objects/Version.xs', to => 'lib/SDL/Version.xs', }, libraries => [qw( SDL )], }, OpenGL => { file => { from => 'src/OpenGL.xs', to => 'lib/SDL/OpenGL.xs', }, libraries => [qw( SDL GL GLU )], }, Image => { file => { from => 'src/Image.xs', to => 'lib/SDL/Image.xs', }, libraries => [qw( SDL SDL_image jpeg png tiff)], }, # Net => { # file => { # from => 'src/Net/Net.xs', # to => 'lib/SDL/Net.xs', # }, # libraries => [qw( SDL SDL_net )], # }, # TCP => { # file => { # from => 'src/Net/TCP.xs', # to => 'lib/SDL/Net/TCP.xs', # }, # libraries => [qw( SDL SDL_net )], # }, # UDP => { # file => { # from => 'src/Net/UDP.xs', # to => 'lib/SDL/Net/UDP.xs', # }, # libraries => [qw( SDL SDL_net )], # }, # IPaddress => { # file => { # from => 'src/Net/objects/IPaddress.xs', # to => 'lib/SDL/Net/IPaddress.xs', # }, # libraries => [qw( SDL SDL_net )], # }, ); ### external libraries # <library name> = symbolic library name # <define> = value that will be used as -D<value> option when c +ompiling XS code # <header> = header related to the library that will be used fo +r avalability detection, # could be a sigle value or an array of values + # <lib> = value that will be used as -l<value> option when l +inking XS code my %libraries = ( SDL => { define => 'HAVE_SDL', header => 'SDL.h', lib => 'SDL', }, SDL_image => { define => 'HAVE_SDL_IMAGE', header => 'SDL_image.h', lib => 'SDL_image', }, SDL_mixer => { define => 'HAVE_SDL_MIXER', header => 'SDL_mixer.h', lib => 'SDL_mixer', }, # SDL_net => { # define => 'HAVE_SDL_NET', # header => 'SDL_net.h', # lib => 'SDL_net', # }, SDL_ttf => { define => 'HAVE_SDL_TTF', header => 'SDL_ttf.h', lib => 'SDL_ttf', }, SDL_gfx => { define => 'HAVE_SDL_GFX', header => 'SDL_gfxPrimitives.h', lib => 'SDL_gfx', }, SDL_gfx_blitfunc => { define => 'HAVE_SDL_GFX_BLITFUNC', header => 'SDL_gfxBlitFunc.h', lib => 'SDL_gfx', }, SDL_gfx_framerate => { define => 'HAVE_SDL_GFX_FRAMERATE', header => 'SDL_framerate.h', lib => 'SDL_gfx', }, SDL_gfx_imagefilter => { define => 'HAVE_SDL_GFX_IMAGEFILTER', header => 'SDL_imageFilter.h', lib => 'SDL_gfx', }, SDL_gfx_primitives => { define => 'HAVE_SDL_GFX_PRIMITIVES', header => 'SDL_gfxPrimitives.h', lib => 'SDL_gfx', }, SDL_gfx_rotozoom => { define => 'HAVE_SDL_GFX_ROTOZOOM', header => 'SDL_rotozoom.h', lib => 'SDL_gfx', }, SDL_Pango => { define => 'HAVE_SDL_PANGO', header => 'SDL_Pango.h', lib => 'SDL_Pango', }, png => { define => 'HAVE_PNG', header => 'png.h', lib => 'png', }, jpeg => { define => 'HAVE_JPEG', header => 'jpeglib.h', lib => 'jpeg', }, tiff => { define => 'HAVE_TIFF', header => 'tiff.h', lib => 'tiff', }, smpeg => { define => 'HAVE_SMPEG', header => 'smpeg/smpeg.h', lib => 'smpeg', }, GL => { define => 'HAVE_GL', header => [ 'GL/gl.h', 'GL/glext.h' ], lib => ($^O =~ /^(MSWin32|cygwin)$/) ? 'opengl32' : 'GL', # + xxx not nice }, GLU => { define => 'HAVE_GLU', header => 'GL/glu.h', lib => ($^O =~ /^(MSWin32|cygwin)$/) ? 'glu32' : 'GLU', # x +xx not nice }, ); ### mangle the compilable files into a format Module::Build can unders +tand my %xs = map { $subsystems{$_}{file}{from} => $subsystems{$_}{file}{to +} } keys %subsystems; ### stadard Module::Build stuff my $build = $package->new( module_name => 'SDL', dist_name => 'SDL', license => 'lgpl', dist_version_from => 'lib/SDL.pm', configure_requires => { 'YAML' => '0.68', 'ExtUtils::CBuilder' => '0.260301', 'Alien::SDL' => '1.2', 'File::Find' => '0' }, build_requires => { 'Test::Simple' => '0.88', 'IO::CaptureOutput' => '0', 'Test::Most' => '0.21', 'Alien::SDL' => '1.2', }, build_recommends => { 'Pod::ToDemo' => '0.20' }, c_source => 'src', xs_files => \%xs, meta_add => { }, #create_readme => 1, ### make sense only if there is some POD doc +in the file specified by dist_version_from meta_merge => { resources => { bugtracker => 'http://sdlperl.ath.cx/projects/SDLPerl', repository => 'http://github.com/kthakore/SDL_perl' } }, dist_abstract => 'SDL bindings to Perl', dist_author => 'Kartik Thakore <KTHAKORE@cpan.org>', ); ### Alien::SDL quick check warn "###WARNING### Alien::SDL seems to be broken" unless Alien::SDL-> +config('prefix'); ### see which subsystems can be built -- do we have headers for them? print "Gonna autodetect available libraries ...\n"; my $build_systems = $build->find_subsystems(\%subsystems, \%libraries) +; my $lib_translate = $build->translate_table(\%subsystems, \%libraries) +; ### save info about available subsystems for future SDL::ConfigData print "Gonna write config_data ...\n"; $build->config_data('SDL_cfg', $build_systems); $build->config_data('SDL_lib_translate', $lib_translate); $build->config_data('subsystems', \%subsystems); $build->config_data('libraries', \%libraries); ### something that was originally special to MacOS/Darwin # somebody MacOS/Darwin friendly should review whether it is still nec +essary $build->special_build_settings(); ### get some info into M::B notes print "Gonna save some info to 'notes' ...\n"; $build->notes('subsystems', \%subsystems); $build->notes('libraries', \%libraries); $build->notes('build_systems', $build_systems); $build->notes('sdl_cflags', Alien::SDL->config('cflags')); $build->notes('sdl_libs', Alien::SDL->config('libs')); $build->set_file_flags(); # creates notes('file_flags') # now we're ready to go! $build->create_build_script();
Re: Installing SDL
by Chuma (Acolyte) on Apr 19, 2010 at 16:49 UTC

    Thanks for your help.

    Biohisham: That's probably a good idea. I might need modules again some day...

    Khen: Okay, I don't understand much about that, but I tried running those programs. The first one seems to have installed a great many things, and spat out plenty of error messages, most of them about 'YAML' not being installed or 'make' failing in various ways. The last lines are

    KTHAKORE/Alien-SDL-1.2.tar.gz [depend] -- NOT OK Prepending /Users/Chuma/.cpan/build/Test-Harness-3.21-HIJuax/blib/arch + /Users/Chuma/.cpan/build/Test-Harness-3.21-HIJuax/blib/lib to PERL5L +IB for 'test' Running Build test Make had some problems, won't test Running Build install Make had some problems, won't install
    I tried running the second one anyway, but it Can't locate Alien/SDL.pm in @INC.
    Any more ideas?

    EDIT: I tried (after reading the aforementioned tutorial) installing SDL::App with CPAN, and I get some more YAML-related errors. I tried 'make' on the YAML directory, and got No rule to make target `/System/Library/Perl/5.10.0/darwin-thread-multi-2level/CORE/config.h', needed by `Makefile'.  Stop. So I tried using CPAN again, "install YAML". Oddly enough, it also complains about YAML not being installed, and then comes to the same conclusion about config.h.

      Hi Chuma,

      Alien::SDL 1.2 has been updated to 1.403. Also please try the new SDL 2.405. Regards. You can ignore the YAML problem we have since switched to YAML::Any on our git repo .

      If you have more problems you can get use at SDL-devel@perl.org or #sdl irc.perl.org.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://835253]
Approved by zwon
Front-paged by biohisham
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2014-09-17 02:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (56 votes), past polls