IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

DevIL Discussion :

Problème de linkage avec la librairie DevIl


Sujet :

DevIL

  1. #1
    Membre habitué
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    168
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2004
    Messages : 168
    Points : 140
    Points
    140
    Par défaut Problème de linkage avec la librairie DevIl
    Bonsoir,

    Suit à un poste sur la recherche de comment trouver la résolution d'une image, on m'a conseillé la librairie Devil, qui je dois dire comblemais attentes mais voilà, au moment de linker le tout dans mon makefile et d'utiliser le make
    j'ai comme erreur :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
    [root@localhost Labyrinte]# make
    gcc -o Labyrinthe.out main.o sprite.o graphique.o game.o plateau.o menu.o -Wl,--rpath  -Wl,LIBDIR  -LLIBDIR `sdl-config --cflags` `sdl-config -libs` -lSDL_image
    Usage: sdl-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]
    sprite.o(.text+0x1d): In function `CreateSprite':
    /home/Zeft/Desktop/Labyrinte/sprite.c:34: undefined reference to `ilInit'
    sprite.o(.text+0x1c7):/home/Zeft/Desktop/Labyrinte/sprite.c:73: undefined reference to `ilLoadImage'
    sprite.o(.text+0x1fd):/home/Zeft/Desktop/Labyrinte/sprite.c:77: undefined reference to `iluGetImageInfo'
    collect2: ld a retourné 1 code d'état d'exécution
    make: *** [Labyrinthe.out] Erreur 1

    Ce qui veut dire, si je ne me trompe pas, qu'au moment de linker il ne trouve pas la librairie.

    Pour mon makefile, celà donne :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
     
    OBJ = main.o sprite.o graphique.o game.o plateau.o menu.o
    OPTS = -Wall -Werror -g
    MAIN = main.c main.h graphique.h sprite.h menu.h
    GRAPHIQUE = graphique.c graphique.h main.h sprite.h 
    SPRITE = sprite.c sprite.h main.h graphique.h 
    PLATEAU = plateau.c plateau.h sprite.h main.h graphique.h
    GAME = game.c game.h plateau.h sprite.h main.h graphique.h
    MENU = menu.c game.h plateau.h sprite.h main.h graphique.h menu.h
     
     
    Labyrinthe.out : $(OBJ)
    	gcc -o Labyrinthe.out $(OBJ)  -Wl,--rpath  -Wl,LIBDIR  -LLIBDIR `sdl-config --cflags` `sdl-config -libs` -lSDL_image 
     
    main.o : $(MAIN)
    	gcc -c main.c $(OPTS)
     
    sprite.o : $(SPRITE)
    	gcc -c sprite.c $(OPTS)
     
    graphique.o : $(GRAPHIQUE)
    	gcc -c graphique.c $(OPTS)
     
    game.o : $(GAME)
    	gcc -c game.c $(OPTS)
     
    plateau.o : $(PLATEAU)
    	gcc -c plateau.c $(OPTS)
     
    menu.o : $(MENU)
    	gcc -c menu.c $(OPTS)
     
    clean :
    	rm -f *.out *~ *o
    Donc j'ai bien rajouter la ligne qu'il demande lors de l'installation :
    ----------------------------------------------------------------------
    Libraries have been installed in:
    /usr/local/lib

    If you ever happen to want to link against installed libraries
    in a given directory, LIBDIR, you must either use libtool, and
    specify the full pathname of the library, or use the `-LLIBDIR'
    flag during linking and do at least one of the following:
    - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
    during execution
    - add LIBDIR to the `LD_RUN_PATH' environment variable
    during linking
    - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
    - have your system administrator add LIBDIR to `/etc/ld.so.conf'

    See any operating system documentation about shared libraries for
    more information, such as the ld(1) and ld.so(8) manual pages.
    J'en arrive à me demander si ce n'est pas un problème de path mais je suis vraiment nul pour celà sous linux :s

    Autre chose lors de l'installation à la fin je tombe sur :

    make[3]: Rien à faire pour « install-data-am ».
    make[3]: Leaving directory `/root/Desktop/Devil/DevIL-1.6.7/src-ILUT/src'
    make[2]: Leaving directory `/root/Desktop/Devil/DevIL-1.6.7/src-ILUT/src'
    make[2]: Entering directory `/root/Desktop/Devil/DevIL-1.6.7/src-ILUT'
    make[3]: Entering directory `/root/Desktop/Devil/DevIL-1.6.7/src-ILUT'
    make[3]: Rien à faire pour « install-exec-am ».
    make[3]: Rien à faire pour « install-data-am ».
    make[3]: Leaving directory `/root/Desktop/Devil/DevIL-1.6.7/src-ILUT'
    make[2]: Leaving directory `/root/Desktop/Devil/DevIL-1.6.7/src-ILUT'
    make[1]: Leaving directory `/root/Desktop/Devil/DevIL-1.6.7/src-ILUT'
    Making install in include
    make[1]: Entering directory `/root/Desktop/Devil/DevIL-1.6.7/include'
    Making install in IL
    make[2]: Entering directory `/root/Desktop/Devil/DevIL-1.6.7/include/IL'
    make[3]: Entering directory `/root/Desktop/Devil/DevIL-1.6.7/include/IL'
    make[3]: Rien à faire pour « install-exec-am ».
    test -z "/usr/local/include/IL" || mkdir -p -- . "/usr/local/include/IL"
    /usr/bin/install -c -m 644 'il.h' '/usr/local/include/IL/il.h'
    /usr/bin/install -c -m 644 'ilu.h' '/usr/local/include/IL/ilu.h'
    /usr/bin/install -c -m 644 'ilut.h' '/usr/local/include/IL/ilut.h'
    /usr/bin/install -c -m 644 'il_wrap.h' '/usr/local/include/IL/il_wrap.h'
    /usr/bin/install -c -m 644 'config.h' '/usr/local/include/IL/config.h'
    /usr/bin/install -c -m 644 'devil_internal_exports.h' '/usr/local/include/IL/devil_internal_exports.h'
    /usr/bin/install -c -m 644 'ilu_region.h' '/usr/local/include/IL/ilu_region.h'
    make[3]: Leaving directory `/root/Desktop/Devil/DevIL-1.6.7/include/IL'
    make[2]: Leaving directory `/root/Desktop/Devil/DevIL-1.6.7/include/IL'
    make[2]: Entering directory `/root/Desktop/Devil/DevIL-1.6.7/include'
    make[3]: Entering directory `/root/Desktop/Devil/DevIL-1.6.7/include'
    make[3]: Rien à faire pour « install-exec-am ».
    make[3]: Rien à faire pour « install-data-am ».
    make[3]: Leaving directory `/root/Desktop/Devil/DevIL-1.6.7/include'
    make[2]: Leaving directory `/root/Desktop/Devil/DevIL-1.6.7/include'
    make[1]: Leaving directory `/root/Desktop/Devil/DevIL-1.6.7/include'
    make[1]: Entering directory `/root/Desktop/Devil/DevIL-1.6.7'
    make[2]: Entering directory `/root/Desktop/Devil/DevIL-1.6.7'
    make[2]: Rien à faire pour « install-exec-am ».
    make[2]: Rien à faire pour « install-data-am ».
    make[2]: Leaving directory `/root/Desktop/Devil/DevIL-1.6.7'
    make[1]: Leaving directory `/root/Desktop/Devil/DevIL-1.6.7'
    Est ce une erreur d'installation ?
    Si oui comment la résoudre ce problème ?
    Et pourquoi me dit il que la librairie est bien installé (ps : je suis allé dans le dossier et il y a effectivement les fichier.so).


    Merci d'avance.

  2. #2
    Membre habitué
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    168
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2004
    Messages : 168
    Points : 140
    Points
    140
    Par défaut
    Après recherche dans les exemples j'ai vu qu'il fallait rajouter à la ligne de compilation :
    -lIL -lILU

    Ce qui donne au total :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
     
    OBJ = main.o sprite.o graphique.o game.o plateau.o menu.o
    OPTS = -Wall -Werror -g
    MAIN = main.c main.h graphique.h sprite.h menu.h
    GRAPHIQUE = graphique.c graphique.h main.h sprite.h 
    SPRITE = sprite.c sprite.h main.h graphique.h 
    PLATEAU = plateau.c plateau.h sprite.h main.h graphique.h
    GAME = game.c game.h plateau.h sprite.h main.h graphique.h
    MENU = menu.c game.h plateau.h sprite.h main.h graphique.h menu.h
     
     
    Labyrinthe.out : $(OBJ)
    	gcc -o Labyrinthe.out $(OBJ) -Wl,--rpath -Wl,LIBDIR  -lIL -lILU -LLIBDIR `sdl-config --cflags` `sdl-config -libs` -lSDL_image 
     
    main.o : $(MAIN)
    	gcc -c main.c $(OPTS)
     
    sprite.o : $(SPRITE)
    	gcc -c sprite.c $(OPTS)
     
    graphique.o : $(GRAPHIQUE)
    	gcc -c graphique.c $(OPTS)
     
    game.o : $(GAME)
    	gcc -c game.c $(OPTS)
     
    plateau.o : $(PLATEAU)
    	gcc -c plateau.c $(OPTS)
     
    menu.o : $(MENU)
    	gcc -c menu.c $(OPTS)
     
    clean :
    	rm -f *.out *~ *o
    Pour le makefile.

    Mais malgrès celà, j'ai toujours un problème de linkage car lors de l'execution :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    root@localhost Labyrinte]# ./Labyrinthe.out
    ./Labyrinthe.out: error while loading shared libraries: libIL.so.1: cannot open shared object file: No such file or directory
    Et là, je sais plus quoi faire :s

Discussions similaires

  1. Problème de linkage avec template
    Par Invité dans le forum Langage
    Réponses: 4
    Dernier message: 05/01/2008, 16h34
  2. problème de débutant avec la librairie glut sous dev C++
    Par mozillo3625 dans le forum Windows
    Réponses: 0
    Dernier message: 30/11/2007, 22h56
  3. Réponses: 1
    Dernier message: 09/10/2007, 06h44
  4. Problème de linkage avec g++
    Par GarulfoLinux dans le forum Autres éditeurs
    Réponses: 2
    Dernier message: 08/08/2007, 19h57
  5. Problème au linkage avec mfc42d
    Par GLDavid dans le forum VC++ .NET
    Réponses: 6
    Dernier message: 04/01/2007, 11h32

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo