Results 1 to 4 of 4

Thread: Linker Error with SDL2.0

  1. #1

    Question Linker Error with SDL2.0

    Hello folks,

    I was trying to follow the SDL 2.0 tutorial at http://www.freepascal-meets-sdl.net/ . Unfortunately, this tutorial does not provide any information on how to install the sdl libraries on a linux (namely Kubuntu 14.04), so I tried my best to do it myself.

    I installed:
    - fpc 2.6.2
    - SDL 2.0 via "apt-get install libsdl2*"
    - Tim Blume's SDL2 units (downloaded the archive, extracted it to /usr/lib/fpc/2.6.2/units/x86_64-linux/sdl2.0)

    Now when trying to compile the demo program from chapter 4 (http://www.freepascal-meets-sdl.net/...l/kap4_v2.html, nothing special), I keep getting

    Code:
    boonami@boonami-desktop:~/src/sdltest$ sudo fpc ./test.pas
    Free Pascal Compiler version 2.6.2-8 [2014/01/22] for x86_64
    Copyright (c) 1993-2012 by Florian Klaempfl and others
    Target OS: Linux for x86-64
    Compiling ./test.pas
    Linking test
    /usr/bin/ld.bfd: warning: link.res contains output sections; did you forget -T?
    /usr/bin/ld.bfd: cannot find -lSDL_image-2
    test.pas(33,1) Error: Error while linking
    test.pas(33,1) Fatal: There were 1 errors compiling module, stopping
    Fatal: Compilation aborted
    Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not specify a source file to be compiled)
    After about half an hour I am ashamed to confess that my google-fu has failed me as well.
    The solution for most people was to install the corresponding -dev libraries, I already have that one.


    Can somebody help me out?

    PS: I was unsure whether to post this to the SDL section or the fpc one, so I decided by coin toss.

  2. #2
    If you have the -devel packages, everything should work. So either you're still missing a pack (try listing all available *sdl* packages), or the SDL2 units you downloaded have their linking options set up wrong.

  3. #3
    Yes, seems that libsdl2-image-dev is missing.
    Or wait a minute, I think I had to change on Ubuntu the header of sdl2_image.pas.
    If it looks like that
    Code:
     {$IFDEF UNIX}
        {$IFDEF DARWIN}
          IMG_LibName = 'libSDL_image-2.dylib';
        {$ELSE}
          {$IFDEF FPC}
            IMG_LibName = 'libSDL2_image.so';
          {$ELSE}
            IMG_LibName = 'libSDL2_image-2.so.0';
          {$ENDIF}
        {$ENDIF}
      {$ENDIF}
    everything should be allright.
    Best regards,
    Cybermonkey

  4. #4
    Quote Originally Posted by Cybermonkey View Post
    Yes, seems that libsdl2-image-dev is missing.
    Or wait a minute, I think I had to change on Ubuntu the header of sdl2_image.pas.
    If it looks like that
    Code:
     {$IFDEF UNIX}
        {$IFDEF DARWIN}
          IMG_LibName = 'libSDL_image-2.dylib';
        {$ELSE}
          {$IFDEF FPC}
            IMG_LibName = 'libSDL2_image.so';
          {$ELSE}
            IMG_LibName = 'libSDL2_image-2.so.0';
          {$ENDIF}
        {$ENDIF}
      {$ENDIF}
    everything should be allright.
    That was it, thank you! <3

    Seems like they changed the file name, or someone wasn't paying attention.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •