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

Boost C++ Discussion :

Boost.Python, problème de linkage


Sujet :

Boost C++

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre habitué
    Inscrit en
    Mai 2007
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Mai 2007
    Messages : 10
    Par défaut Boost.Python, problème de linkage
    Salut,

    J'ai compilé boost.python (1.55) après avoir installé python (3.4) et j'ai un problème de linkage : "undefined reference to `__imp_Py_Initialize'"
    J'ai ajouté libboost_python3-mgw49-mt-s-1_55.a à mon projet donc je comprend pas trop cette erreur. J'ai peut être mal compilé, voila la commande que j'ai utilisé :
    ./b2 --toolset=gcc --with-python --buildtype=complete --link=static

    Voila, merci de votre aide

  2. #2
    Expert éminent

    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2007
    Messages
    5 202
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Juin 2007
    Messages : 5 202
    Par défaut
    Le .a doit être linké statiquement lors de la compilation. A priori, ce n'est pas le cas.

  3. #3
    Membre habitué
    Inscrit en
    Mai 2007
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Mai 2007
    Messages : 10
    Par défaut
    Salut,

    Je compile bien mon projet en static.
    Je viens de remarquer, quand je compile boost.python j'ai ce message :
    ld.exe skipping incompatible C:\Python\libs/libpython34.a when searching for -lpython34
    ld.exe cannot find -lpython34

    Donc boost.python s'est compilé sans la lib de python en fait mais je vois pas comment compiler correctement boost.python.
    Le fichier C:\Python34\libs\libpython34.a existe bien mais dans le message d'erreur il y a un "/" au lieu d'un "\" ça vient peut être de la.

    Tu as une idée de comment configurer la compilation pour résoudre cette erreur ?

  4. #4
    Membre habitué
    Inscrit en
    Mai 2007
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Mai 2007
    Messages : 10
    Par défaut
    J'ai regardé en détail les messages de la compilation de boost.python, il y a de nombreuses erreurs,

    Voila la commande que j'ai lancé
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    b2 --with-python --userconfig=c:\Users\ads\user-config.jam toolset=gcc --build-type=complete address-model=64 stage
    et quelques extraits des erreurs :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.9.0\debug\address-model-64\threading-multi\libboost_python-mgw49-mt-d-1_55.dll.a
    bin.v2\libs\python\build\gcc-mingw-4.9.0\debug\address-model-64\threading-multi\numeric.o: In function `throw_load_failure':
    C:\lib\boost_1_55_0/libs/python/src/numeric.cpp:31: undefined reference to `__imp_PyExc_ImportError'
     
    C:\lib\boost_1_55_0/libs/python/src/object/function.cpp:604: undefined reference to `__imp__Py_NoneStruct'
    C:\lib\boost_1_55_0/libs/python/src/errors.cpp:38: undefined reference to `__imp_PyExc_OverflowError'
    C:\lib\boost_1_55_0/libs/python/src/errors.cpp:42: undefined reference to `__imp_PyExc_IndexError'
    L'erreur du linker :
    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
     
    gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\libboost_python-mgw49-mt-1_55.dll.a
    bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\numeric.o:numeric.cpp:(.text+0x23f3): undefined reference to `__imp_PyExc_ImportError'
    bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\numeric.o:numeric.cpp:(.text+0x3754): undefined reference to `__imp_PyExc_ImportError'
    bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\numeric.o:numeric.cpp:(.text+0x39fa): undefined reference to `__imp_PyExc_ImportError'
    bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\numeric.o:numeric.cpp:(.text+0x3d0f): undefined reference to `__imp_PyExc_ImportError'
    bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\numeric.o:numeric.cpp:(.text+0x4034): undefined reference to `__imp_PyExc_ImportError'
    bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\numeric.o:numeric.cpp:(.text+0x4364): more undefined references to `__imp_PyExc_ImportError' follow
    C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.0/../../../../x86_64-w64-mingw32/bin/ld.exe: bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\numeric.o: bad reloc address 0x38 in section `.xdata'
    collect2.exe: error: ld returned 1 exit status
     
        "g++" -L"c:\Python34\libs" -Wl,-R -Wl,"c:\Python34" -Wl,-R -Wl,"c:\Python34\libs" "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\libboost_python-mgw49-mt-1_55.dll.a" -o "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\libboost_python-mgw49-mt-1_55.dll"  -shared -Wl,--start-group "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\numeric.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\list.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\long.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\dict.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\tuple.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\str.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\slice.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\converter\from_python.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\converter\registry.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\converter\type_id.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\object\enum.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\object\class.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\object\function.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\object\inheritance.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\object\life_support.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\object\pickle_support.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\errors.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\module.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\converter\builtin_converters.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\converter\arg_to_python_base.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\object\iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\object\stl_iterator.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\object_protocol.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\object_operators.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\wrapper.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\import.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\exec.o" "bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\object\function_doc_signature.o"  -Wl,-Bstatic  -Wl,-Bdynamic -lpython34 -Wl,--end-group -mthreads -m64 
     
    ...failed gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\libboost_python-mgw49-mt-1_55.dll.a bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\libboost_python-mgw49-mt-1_55.dll...
    ...removing bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\libboost_python-mgw49-mt-1_55.dll.a
    ...skipped <pstage\lib>libboost_python-mgw49-mt-1_55.dll.a for lack of <pbin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi>libboost_python-mgw49-mt-1_55.dll.a...
    ...skipped <pstage\lib>libboost_python-mgw49-mt-1_55.dll for lack of <pbin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi>libboost_python-mgw49-mt-1_55.dll...
    gcc.link.dll bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\libboost_python3-mgw49-mt-1_55.dll.a
    bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\numeric.o:numeric.cpp:(.text+0x23f3): undefined reference to `__imp_PyExc_ImportError'
    bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\numeric.o:numeric.cpp:(.text+0x3754): undefined reference to `__imp_PyExc_ImportError'
    bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\numeric.o:numeric.cpp:(.text+0x39fa): undefined reference to `__imp_PyExc_ImportError'
    bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\numeric.o:numeric.cpp:(.text+0x3d0f): undefined reference to `__imp_PyExc_ImportError'
    bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\numeric.o:numeric.cpp:(.text+0x4034): undefined reference to `__imp_PyExc_ImportError'
    bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\numeric.o:numeric.cpp:(.text+0x4364): more undefined references to `__imp_PyExc_ImportError' follow
    C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.0/../../../../x86_64-w64-mingw32/bin/ld.exe: bin.v2\libs\python\build\gcc-mingw-4.9.0\release\address-model-64\threading-multi\numeric.o: bad reloc address 0x38 in section `.xdata'
    collect2.exe: error: ld returned 1 exit status
    Voila, je pense que les libs que j'obtiens ne peuvent pas fonctionner à cause de ça mais je ne sais pas comment résoudre ces erreurs.

    J'ai boost 1.55, gcc 4.9.0, python3.4.2 64bits

  5. #5
    Rédacteur/Modérateur


    Homme Profil pro
    Network game programmer
    Inscrit en
    Juin 2010
    Messages
    7 153
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : Canada

    Informations professionnelles :
    Activité : Network game programmer

    Informations forums :
    Inscription : Juin 2010
    Messages : 7 153
    Billets dans le blog
    4
    Par défaut
    les erreurs sont liées à Python, pas à Boost
    Voila, je pense que les libs que j'obtiens ne peuvent pas fonctionner à cause de ça mais je ne sais pas comment résoudre ces erreurs.
    je pense surtout que t'obtiens rien, puisque ça link pas

    tu as correctement modifié le .jam pour indiquer quelle version de python tu utilises et où il se trouve ?
    python32 ou 64 bits ? de mémoire, vaut mieux éviter le 64
    Pensez à consulter la FAQ ou les cours et tutoriels de la section C++.
    Un peu de programmation réseau ?
    Aucune aide via MP ne sera dispensée. Merci d'utiliser les forums prévus à cet effet.

  6. #6
    Membre habitué
    Inscrit en
    Mai 2007
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Mai 2007
    Messages : 10
    Par défaut
    Salut,

    Voici mon fichier user-config.jam :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    using python
         : 3.4 # version
         : c:\\Python34\\python.exe # cmd-or-prefix
         : c:\\Python34\\include # includes
         : c:\\Python34\\libs # libraries
    	 : <toolset>gcc # condition
    	 : <address-model>64
         ;
    J'ai essayé avec Python34 64 bits et Python27 64 bits
    Il se trouve dans c:\Users\ads\user-config.jam, j'ai précisé le chemin dans la commande b2 ...

    Tu dis qu'il faut éviter la version 64 mais si mon projet C++ est en 64 ça ne vas pas poser de problème si j'utilise les versions 32 bits ?

    Merci de ton aide

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Boost.Python] Problème d'installation
    Par Masadow dans le forum Boost
    Réponses: 0
    Dernier message: 01/01/2012, 21h30
  2. Plusieurs fichiers => Problème de Linkage
    Par loic911 dans le forum C++
    Réponses: 6
    Dernier message: 01/03/2006, 00h11
  3. [BOOST]Comment utiliser la lib boost.python
    Par Invité dans le forum Bibliothèques
    Réponses: 6
    Dernier message: 30/01/2006, 11h35
  4. Problème de linkage avec la librairie DevIl
    Par Drannor dans le forum DevIL
    Réponses: 1
    Dernier message: 18/01/2006, 23h05
  5. Problème de linkage
    Par lvdnono dans le forum Windows
    Réponses: 4
    Dernier message: 15/06/2004, 12h32

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