OVH Cloud OVH Cloud

Compiler un module pour windows

2 réponses
Avatar
ReM
Bonjour,

Je coince un peu pour créer un module sous windows.
Sous Linux pas de pb, tout marche, par contre, j'obtiens le message
suivant sous WXP :
gcc -shared -L C:\Python24\libs -llibpython24.a -Wall py_fg.o selecteu.o
transcod.o controle.o erreurs.o fg9.o -lm -o py_fg.pyd

J'obtiens :
C:\MinGWStudio\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe:



cannot find -llibpython24.a
collect2: ld returned 1 exit status

Et si je lance
gcc -shared -L C:\Python24\libs -Wall py_fg.o selecteu.o transcod.o
controle.o erreurs.o fg9.o -lm -o py_fg.pyd

py_fg.o: In function `groupage':
E:/Projets/Eclipse/py_fg/src/py_fg.c:35: undefined reference to
`_imp__PyArg_ParseTuple'
E:/Projets/Eclipse/py_fg/src/py_fg.c:42: undefined reference to
`_imp__Py_BuildValue'
py_fg.o: In function `initpy_fg':
E:/Projets/Eclipse/py_fg/src/py_fg.c:53: undefined reference to
`_imp__Py_InitModule4'
collect2: ld returned 1 exit status


J'utilise MinGW et python2.4 comme vous avez pu le remarquer.

Une idée de la solution ?

Merci

2 réponses

Avatar
Do Re Mi chel La Si Do
Bonjour !


Je n'ai jamais compilé de modules en C/C++ pour Python, mais :
- sous Windows, Python est construit avec le compilateur C de Microsoft
(VC 7 je crois). Il faut utiliser le même compilateur.
- pour MingW, voir là :
http://jove.prohosting.com/iwave/ipython/pyMinGW.html


@-salutations

Michel Claveau
Avatar
ReM
Merci pour ta réponse.

Je suis parvenu à créer mon module via distutils :

E:ProjetsEclipsepy_fgsrc>setup.py build --compiler=mingw32
running build
running build_ext

et je retrouve bien mon py_fg.pyd

par contre si je fait ensuite :
E:ProjetsEclipsepy_fgsrc>setup.py install
running install
running build
running build_ext
error: The .NET Framework SDK needs to be installed before building
extensions for Python.

C'est un peu nul de refait un build .....
Et je n'ai pas trouvé l'option pour passer un compilo pour la commande
install !

Je suis donc obligé de faire setup.py install --skip-build
et la c'est tout bon !