Linking problems in Linux

This is a discussion on Linking problems in Linux within the Tech Board forums, part of the Community Boards category; I was over at a friend's house, trying to compile the latest development version of Wesnoth (v1.18), and on an ...

  1. #1
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    498

    Linking problems in Linux

    I was over at a friend's house, trying to compile the latest development version of Wesnoth (v1.18), and on an old version of Ubuntu. There were all sorts of dependancy issues, and I managed to work through most of them. However, when I was trying to configure SDL_image, I ran into a problem.

    It needed the following libraries: libpng, libjpeg, and libtiff. I got to work downloading and installing them, and when I was done, I tried running the configure script again. It didn't complain about libpng and libtiff now, but it still couldn't find libjpeg.

    I tried copying libjpeg.so to every lib directory I could think of, and yet it still refused to find it. I tried echoing LD_LIBRARY_PATH; there was nothing in it, so I added /usr/local/lib to it. Still not working. I looked for ld.so.config; it didn't exist. I created it, added /usr/local/lib, and ran configure again. Still no luck.

    I also tried a number of configure options, but I couldn't get it to work. I've googled, and although this problem is common, I still can't point the configure script to the right directory.

    One thing to note is that ./configure does create a makefile, but it gives a warning that "JPEG support is disabled", and then make gives a link error.

  2. #2
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,070
    I've had trouble linking with libjpeg aswell. Sadly, I never fixed it, so I can't help.
    Memorial University of Newfoundland
    Computer Science

    Mac and OpenGL evangelist.

  3. #3
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    498
    Well, did you get it compiled? At least libjpeg compiled, so the only problem is that I can't get configure to locate libjpeg.so.

    EDIT: Do you think I could edit the makefile for SDL_image? I'm not really familiar with editing makefiles manually, but if someone could tell me which line, that would be great.
    Last edited by joeprogrammer; 08-08-2006 at 07:57 PM.

  4. #4
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,070
    Well, the weird thing with my problem was that my distro came with libjpeg.so already installed (so I didn't need to compile it), but I still had linker problems.

    I looked for ld.so.config
    I thought the file was lib.so.conf, or was the "ig" a typo?
    EDIT: actually, now that I think about it, maybe it is ".config". I can't remember, and i'm too lazy to boot into Linux to find out.

    Are you running ldconfig after adding the directory to lib.so.conf?

    Try adding /usr/lib to your config paths, or are you absolutly sure it's in /usr/local/lib?
    Last edited by psychopath; 08-08-2006 at 09:45 PM.
    Memorial University of Newfoundland
    Computer Science

    Mac and OpenGL evangelist.

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Doesn't the configure file have a --with-jpeg option that you can supply with the full path to libjpeg.so?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #6
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    498
    I thought the file was lib.so.conf, or was the "ig" a typo?
    Yes, that was a typo.
    Are you running ldconfig after adding the directory to lib.so.conf?
    I already tried that, no luck.
    Doesn't the configure file have a --with-jpeg option that you can supply with the full path to libjpeg.so?
    Maybe, I don't know, as I'm not at my friend's computer right now. I'll try that. I just thought of running apt-get install SDL_image; that might be easier.

  7. #7
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    498
    Dunno if this helps; I grabbed a section from the configure script (even though I can't really read shell scripting)
    Code:
      have_libjpeg=yes
    fi
        
        if test x$have_libjpeg = xyes; then
            if test x$enable_jpg = xyes; then
                cat >>confdefs.h <<\_ACEOF
    #define LOAD_JPG 1
    _ACEOF
    
            fi
            LIBS="-ljpeg $LIBS"
                case "$host" in
                *-*-darwin*) # FIXME when Mac OS X ships with libjpeg
                    jpg_lib=''
                    ;;
                *-*-cygwin* | *-*-mingw32*)
                    jpg_lib='jpeg.dll'
                    ;;
                *)
                    for path in /usr/lib /usr/local/lib; do
                        if test x$jpg_lib = x; then
                            jpg_lib=`ls -- $path/libjpeg.so.[0-9][0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`
                        fi
                    done
                    ;;
            esac
    Always prints the message below....
        elif test x$enable_jpg = xyes; then
            { echo "$as_me:$LINENO: WARNING: *** Unable to find JPEG library (http://www.ijg.org/)" >&5
    echo "$as_me: WARNING: *** Unable to find JPEG library (http://www.ijg.org/)" >&2;}
            { echo "$as_me:$LINENO: WARNING: JPG image loading disabled" >&5
    echo "$as_me: WARNING: JPG image loading disabled" >&2;}
    I have the file "libjpeg.so" in /usr/lib and /usr/local/lib (a few others, but these are the main ones).

  8. #8
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    usually the <file>.so is just a symlink to some versioned file <file>.so.05. try ls -l to see if the symlink is dead, if you just copied the file to that dir you might not have the proper library file.

  9. #9
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    498
    usually the <file>.so is just a symlink to some versioned file <file>.so.05. try ls -l to see if the symlink is dead, if you just copied the file to that dir you might not have the proper library file.
    Nope, I checked. It's the actual file, and it's not pointing anywhere.

  10. #10
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    >jpg_lib=`ls -- $path/libjpeg.so.[0-9][0-9]

    It looks like that is explicitly looking for one

  11. #11
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    498
    It looks like that is explicitly looking for one
    Yeah, the only problem is that I don't know shell scripting. Do you think I could just modify it to point to the existing path?

  12. #12
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    worth a shot. Or just create a symlink with libjpeg.so.5.5 -> libjpeg.so so the regex matches something. I'm not sure if thats even the problem though, just something that popped out at me.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. .cpp linking problems
    By ExDHaos in forum C++ Programming
    Replies: 4
    Last Post: 05-15-2009, 04:38 AM
  2. C++ OpenGL linking problems
    By KoshiB in forum C++ Programming
    Replies: 1
    Last Post: 03-20-2006, 04:25 PM
  3. Linking problems, class problems
    By Kheila in forum C++ Programming
    Replies: 12
    Last Post: 11-22-2005, 12:47 AM
  4. Linux Linux why Linux??
    By afreedboy in forum Tech Board
    Replies: 146
    Last Post: 01-21-2004, 05:27 PM
  5. Linux: WINE Problems
    By Linux Newbie in forum Tech Board
    Replies: 1
    Last Post: 05-09-2003, 06:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21