Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Linking with Linux .so files

  1. #11

    Linking with Linux .so files

    Try to omit linking stage (fpc -s yourfile.pas) and open link.res, so you can check if paths are correct and if the lib is passed to the linker with the exact name
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  2. #12

    Linking with Linux .so files

    [quote="Almindor"]Make sure it's the right name you use. Also -lname must match for ld. Basicly check out what the filename of allegro so file is, if the sym]

    The soname is "liballeg.so.4.2", which is the same I'm using in the "EXTERNAL" declaration. The real name of the library is "liballeg-4.2.1.so" so I should pass to the linker "-lalleg-4.2.1", don't I?

    The files and the symlink are right:
    Code:
    % ls -l /usr/local/lib
    total xxx
    drwxr-xr-x 3 root root    4096 2006-12-15 21:01 allegro
    -rwxr-xr-x 1 root root  165105 2006-12-15 22:01 alpas42.so
    drwxr-xr-x 4 root root    4096 2005-12-07 10:08 fpc
    -rwxr-xr-x 1 root root  898213 2006-12-15 21:01 liballeg-4.2.1.so
    lrwxrwxrwx 1 root root      17 2006-12-15 21:01 liballeg.so.4.2 -> liballeg-4.2.1.so
    -rw-r--r-- 1 root root  176444 2006-12-15 21:01 liballeg_unsharable.a
    [quote="Almindor"]You can test alot with gcc to see what that uses. (btw you have to explicitly tell this to gcc, so if it works with -lallegro in gcc and not via fp {don't forget, both use ld as ]

    In gcc uses an script that returns all options it needs:

    Code:
    % allegro-config --libs
    -L/usr/local/lib -L/usr/X11R6/lib -Wl,--export-dynamic -lalleg-4.2.1 -lalleg_unsharable
    [quote="Legolas"]Try to omit ]

    Done. I used:
    Code:
    fpc -s -Fulib -FEexamples -FUlib -WG+ examples/extruec.dpr -oexamples/extruec.bin
    The paths are correct but the libnames aren't correct. This is the actual content of link.res:
    Code:
    INPUT(
    -lalleg
    -lalpas42
    -lalleg_unsharable
    )
    And this is what (I think) it shoul be:
    Code:
    INPUT(
    -lalleg-4.2.1
    -lalpas42
    -lalleg_unsharable
    )
    [edit] Wait, I've find that there are a "SEARCH_DIR(/usr/lib/)" but there are not a "SEARCH_DIR(/usr/local/lib/)". Is this the problem? How can I fix it?

    [edit] Surelly I'm the most stupid man here: technomage said how to fix it. Anyway it still not linking...

    Code:
    % make examples
    fpc -Fulib -FEexamples -FUlib -Fl/usr/local/lib -WG+ examples/exdata.dpr -oexamples/exdata.bin
    Free Pascal Compiler version 2.0.2 [2005/12/07] for i386
    Copyright (c) 1993-2005 by Florian Klaempfl
    Target OS: Linux for i386
    Compiling examples/exdata.dpr
    Linking examples/exdata.bin
    /usr/bin/ld: no se puede encontrar -lalleg
    exdata.dpr(106,1) Error: Error while linking
    Error: /usr/local/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)
    make: *** [examples/exdata.bin] Error 1
    The link.res file is the same but added a SEARCH_DIR(/usr/local/lib/)" line.
    No signature provided yet.

  3. #13

    Linking with Linux .so files

    How about creating a symbolic link to the library in the /usr/lib/ directory?
    It worked for me when I could not link to the glu library.

    Or maybe it is enough to run ldconfig?

    You could also look at sdl.pas in JEDI_SDL to see how it is done there.

  4. #14

    Linking with Linux .so files

    [quote="?ëu?±o Mart??nez"]
    Quote Originally Posted by Almindor
    Make sure it's the right name you use. Also -lname must match for ld. Basicly check out what the filename of allegro so file is, if the sym]

    The soname is "liballeg.so.4.2", which is the same I'm using in the "EXTERNAL" declaration. The real name of the library is "liballeg-4.2.1.so" so I should pass to the linker "-lalleg-4.2.1", don't I?
    No I think external strips it. As you can seen in the error msg.

    [quote]
    The files and the symlink are right:
    Code:
    % ls -l /usr/local/lib
    total xxx
    drwxr-xr-x 3 root root    4096 2006-12-15 21:01 allegro
    -rwxr-xr-x 1 root root  165105 2006-12-15 22:01 alpas42.so
    drwxr-xr-x 4 root root    4096 2005-12-07 10:08 fpc
    -rwxr-xr-x 1 root root  898213 2006-12-15 21:01 liballeg-4.2.1.so
    lrwxrwxrwx 1 root root      17 2006-12-15 21:01 liballeg.so.4.2 -> liballeg-4.2.1.so
    -rw-r--r-- 1 root root  176444 2006-12-15 21:01 liballeg_unsharable.a
    create liballeg.so > liballeg-4.2.1.so and you'll see it links.

    If you have 2.0.4+, and are not the faint of heart kind, you might want to experiment with the undocumented -XL switches. See paragraph 5.2 in

    http://www.stack.nl/~marcov/buildfaq.pdf

  5. #15

    Linking with Linux .so files

    Hello. Sorry but I was out of business for a long time. And I'll be there for some weeks more...

    I can't to use my computer now but I want to make few comments.
    [quote="grudzio"]How about creating a symbolic ]
    It should be enough to run ldconfig. By the way, all my old Allegro C games compiled and runs without problems, so I think this isn't the problem.

    I've seen how JEDI-SDL does it and I think it's too similar than I did. Thanks anyway.
    [quote="marcov"]
    Quote Originally Posted by ?ëu?±o Mart??nez
    Quote Originally Posted by Almindor
    Make sure it's the right name you use. Also -lname must match for ld. Basicly check out what the filename of allegro so file is, if the sym]

    The soname is "liballeg.so.4.2", which is the same I'm using in the "EXTERNAL" declaration. The real name of the library is "liballeg-4.2.1.so" so I should pass to the linker "-lalleg-4.2.1", don't I?
    No I think external strips it. As you can seen in the error msg.
    I see, but why?

    [quote="marcov"]create liballeg.so > liballeg-4.2.1.so and you'll see it ]
    Did you test it? I you did it and it worked then all my problems with Allegro.pas are gone!

    Quote Originally Posted by marcov
    If you have 2.0.4+, and are not the faint of heart kind, you might want to experiment with the undocumented -XL switches. See paragraph 5.2 in

    http://www.stack.nl/~marcov/buildfaq.pdf
    I'm not sure what "are not the faint of heart kind" means :?

    By the way, I've read the PDF and I'll test it as soon as I can (hopefully May 1st, but no before that).

    A last report: I released the latest version of Allegro.pas in February 1st. If you did test the previous version (December 17th) please download the project package again.

    Thanks.
    No signature provided yet.

Page 2 of 2 FirstFirst 12

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
  •