when import the mh,error with "ImportError: DLL load failed"

MakeHuman python API, python plugins, etc

Moderator: joepal

Re: when import the mh,error with "ImportError: DLL load failed"

Postby mflerackers » Sun Feb 07, 2010 1:08 pm

Did you try running compile_module.bat ?
MakeHuman project Developer
mflerackers
 
Posts: 636
Joined: Thu Feb 05, 2009 11:53 am
Location: Kyoto

Re: when import the mh,error with "ImportError: DLL load failed"

Postby gsnake » Sun Feb 07, 2010 1:22 pm

yes ,but it can't solve ,what method you used to build the mh?can you tell me ?thanks.


mflerackers wrote:Did you try running compile_module.bat ?
gsnake
 
Posts: 27
Joined: Sat Feb 06, 2010 6:17 am

Re: when import the mh,error with "ImportError: DLL load failed"

Postby jcapco » Sun Feb 07, 2010 1:34 pm

yes ,but it can't solve ,what method you used to build the mh?can you tell me ?thanks.


I use msvc6 and manuel uses compile_module.bat with mingw32. So something must be wrong with your system or the way you do it. Could you post us the output when you type compile_module.bat?
jcapco
 
Posts: 157
Joined: Wed Jan 13, 2010 6:26 pm

Re: when import the mh,error with "ImportError: DLL load failed"

Postby gsnake » Sun Feb 07, 2010 1:44 pm

F:\pc\mapython_module\mh_how_to_compile_module>python SetUp.py build --compiler=
mingw32
running build
running build_ext
building 'mh' extension
writing build\temp.win32-2.6\Release\src\mh.def
F:\MinGW\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.6\Release\src\cor
e.o build\temp.win32-2.6\Release\src\glmodule.o build\temp.win32-2.6\Release\src
\main.o build\temp.win32-2.6\Release\src\mh.def -LF:\MinGW\lib -LF:\Python26\lib
s -LF:\python26\libs -LF:\python26\PCbuild -lpython26 -lfreeglut -lglu32 -lopeng
l32 -lwinmm -lgdi32 -lpython26 -lmsvcr90 -o build\lib.win32-2.6\mh.pyd
Cannot export initmh: symbol not defined
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1d0): undefined
reference to `SDL_LoadObject'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x214): undefined
reference to `SDL_LoadFunction'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x25c): undefined
reference to `SDL_GetError'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x2d9): undefined
reference to `SDL_FreeSurface'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x3f5): undefined
reference to `SDL_FreeSurface'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x7a5): undefined
reference to `SDL_CreateRGBSurface'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x7c5): undefined
reference to `SDL_LockSurface'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x7d1): undefined
reference to `SDL_FreeSurface'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x7d6): undefined
reference to `SDL_GetError'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x851): undefined
reference to `SDL_UnlockSurface'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x864): undefined
reference to `SDL_RWFromFile'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x878): undefined
reference to `SDL_SaveBMP_RW'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x884): undefined
reference to `SDL_FreeSurface'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x889): undefined
reference to `SDL_GetError'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x8bb): undefined
reference to `SDL_FreeSurface'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x95a): undefined
reference to `SDL_PushEvent'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x991): undefined
reference to `SDL_WM_GrabInput'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0xa04): undefined
reference to `SDL_WM_GrabInput'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x113f): undefined
reference to `SDL_GL_SwapBuffers'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x13be): undefined
reference to `SDL_GL_GetProcAddress'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x13cf): undefined
reference to `SDL_GL_GetProcAddress'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x13e0): undefined
reference to `SDL_GL_GetProcAddress'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x13f1): undefined
reference to `SDL_GL_GetProcAddress'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1402): undefined
reference to `SDL_GL_GetProcAddress'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1413): more unde
fined references to `SDL_GL_GetProcAddress' follow
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x14f2): undefined
reference to `SDL_GetWMInfo'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1b70): undefined
reference to `SDL_PushEvent'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1bf8): undefined
reference to `SDL_SetVideoMode'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1c32): undefined
reference to `SDL_Quit'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1c43): undefined
reference to `SDL_Init'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1c4c): undefined
reference to `SDL_GetError'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1c7c): undefined
reference to `SDL_GL_SetAttribute'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1c90): undefined
reference to `SDL_GL_SetAttribute'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1ca4): undefined
reference to `SDL_GL_SetAttribute'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1cb8): undefined
reference to `SDL_GL_SetAttribute'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1ccc): undefined
reference to `SDL_GL_SetAttribute'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1ce0): more unde
fined references to `SDL_GL_SetAttribute' follow
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1d0d): undefined
reference to `SDL_GetVideoInfo'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1d32): undefined
reference to `SDL_RWFromFile'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1d42): undefined
reference to `SDL_LoadBMP_RW'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1d6b): undefined
reference to `SDL_MapRGB'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1d7f): undefined
reference to `SDL_SetColorKey'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1d8f): undefined
reference to `SDL_WM_SetIcon'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1df7): undefined
reference to `SDL_SetVideoMode'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1e24): undefined
reference to `SDL_GL_SetAttribute'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1e38): undefined
reference to `SDL_GL_SetAttribute'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1e6d): undefined
reference to `SDL_SetVideoMode'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1e96): undefined
reference to `SDL_GL_SetAttribute'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1ecb): undefined
reference to `SDL_SetVideoMode'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1f00): undefined
reference to `SDL_WM_SetCaption'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1f14): undefined
reference to `SDL_EnableKeyRepeat'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1f20): undefined
reference to `SDL_EnableUNICODE'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1f32): undefined
reference to `SDL_InitSubSystem'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1f4f): undefined
reference to `SDL_AddTimer'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1f93): undefined
reference to `SDL_WaitEvent'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x1fc7): undefined
reference to `SDL_WM_GrabInput'
build\temp.win32-2.6\Release\src\glmodule.o:glmodule.c:(.text+0x211b): undefined
reference to `SDL_SetVideoMode'
build\temp.win32-2.6\Release\src\main.o:main.c:(.text+0x34b): undefined referenc
e to `SDL_GetMouseState'
build\temp.win32-2.6\Release\src\main.o:main.c:(.text+0x380): undefined referenc
e to `SDL_GetMouseState'
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
F:\pc\mapython_module\mh_how_to_compile_module>















































jcapco wrote:
yes ,but it can't solve ,what method you used to build the mh?can you tell me ?thanks.


I use msvc6 and manuel uses compile_module.bat with mingw32. So something must be wrong with your system or the way you do it. Could you post us the output when you type compile_module.bat?
gsnake
 
Posts: 27
Joined: Sat Feb 06, 2010 6:17 am

Re: when import the mh,error with "ImportError: DLL load failed"

Postby mflerackers » Sun Feb 07, 2010 1:45 pm

You can try this command

d:\mingw\bin\gcc -Wall -shared -D MAKEHUMAN_AS_MODULE -o mh.pyd ./src/main.c ./src/glmodule.c ./src/core.c ./include/core.h ./include/glmodule.h -ID:\Python25\libs\include -Id:/MinGW/include/SDL -I./include -LD:\Python25\libs\libs -lpython25 -lmingw32 -lSDLmain -lSDL -mconsole -lglu32 -lopengl32 -lgdi32 -lmsvcrt -lwinmm
MakeHuman project Developer
mflerackers
 
Posts: 636
Joined: Thu Feb 05, 2009 11:53 am
Location: Kyoto

Re: when import the mh,error with "ImportError: DLL load failed"

Postby jcapco » Sun Feb 07, 2010 1:52 pm

I just compiled mh.pyd using msvc6 .. but I used python25 :P .. I dont want to compile it with python26 because I work mainly with python25 and I dont want to change my project settings now. Here is a link of my mh.pyd that should work (if you use python 2.5.4 :P) . Or use marcs advise and predefine MAKEHUMAN_AS_MODULE in gcc.

Obviously from the output you posted :
Code: Select all
Cannot export initmh: symbol not defined


MAKEHUMAN_AS_MODULE was not defined in the preprocessor you need to do that in order to create the mh.pyd module.
jcapco
 
Posts: 157
Joined: Wed Jan 13, 2010 6:26 pm

Re: when import the mh,error with "ImportError: DLL load failed"

Postby jcapco » Sun Feb 07, 2010 1:56 pm

mflerackers wrote:You can try this command

d:\mingw\bin\gcc -Wall -shared -D MAKEHUMAN_AS_MODULE -o mh.pyd ./src/main.c ./src/glmodule.c ./src/core.c ./include/core.h ./include/glmodule.h -ID:\Python25\libs\include -Id:/MinGW/include/SDL -I./include -LD:\Python25\libs\libs -lpython25 -lmingw32 -lSDLmain -lSDL -mconsole -lglu32 -lopengl32 -lgdi32 -lmsvcrt -lwinmm


He uses drive "F" :P
jcapco
 
Posts: 157
Joined: Wed Jan 13, 2010 6:26 pm

Re: when import the mh,error with "ImportError: DLL load failed"

Postby gsnake » Sun Feb 07, 2010 3:13 pm

I think I must reinstall my os。。。。。
jcapco wrote:
mflerackers wrote:You can try this command

d:\mingw\bin\gcc -Wall -shared -D MAKEHUMAN_AS_MODULE -o mh.pyd ./src/main.c ./src/glmodule.c ./src/core.c ./include/core.h ./include/glmodule.h -ID:\Python25\libs\include -Id:/MinGW/include/SDL -I./include -LD:\Python25\libs\libs -lpython25 -lmingw32 -lSDLmain -lSDL -mconsole -lglu32 -lopengl32 -lgdi32 -lmsvcrt -lwinmm


He uses drive "F" :P
gsnake
 
Posts: 27
Joined: Sat Feb 06, 2010 6:17 am

Re: when import the mh,error with "ImportError: DLL load failed"

Postby gsnake » Wed Feb 17, 2010 4:44 am

I have compile mh.pyd successfully,But When I import it ,it prompt that "ImportError: dynamic module does not define init function (initmh)",So I add initializtion funtion in the main.c ,then I compile mh.pyd again and import it ,it still prompt that it did't initialize the module,what wrong with it ?

jcapco wrote:
mflerackers wrote:You can try this command

d:\mingw\bin\gcc -Wall -shared -D MAKEHUMAN_AS_MODULE -o mh.pyd ./src/main.c ./src/glmodule.c ./src/core.c ./include/core.h ./include/glmodule.h -ID:\Python25\libs\include -Id:/MinGW/include/SDL -I./include -LD:\Python25\libs\libs -lpython25 -lmingw32 -lSDLmain -lSDL -mconsole -lglu32 -lopengl32 -lgdi32 -lmsvcrt -lwinmm


He uses drive "F" :P
gsnake
 
Posts: 27
Joined: Sat Feb 06, 2010 6:17 am

Re: when import the mh,error with "ImportError: DLL load failed"

Postby mflerackers » Wed Feb 17, 2010 7:21 am

You shouldn't add initmh, it is already there on line 540 of main.c. If it's not found, it means MAKEHUMAN_AS_MODULE was not defined.
MakeHuman project Developer
mflerackers
 
Posts: 636
Joined: Thu Feb 05, 2009 11:53 am
Location: Kyoto

PreviousNext

Return to Python scripts

Who is online

Users browsing this forum: No registered users and 1 guest