Building Panda3D with OpenGL ES using Cygwin and MSVC9. Log


#7

No problem! I don’t mind going through this process.

I get some new errors, which I can understand a little better. I’ll go through these later today.

c:\panda3d-1.7.0\panda\src\gles2gsg\gles2gsg.h(69) : warning C4005: 'APIENTRY' : macro redefinition
        C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\windef.h(126) : see previous definition of 'APIENTRY'
c:\panda3d-1.7.0\panda\src\glstuff\glShaderContext_src.cxx(971) : error C2039: '_glProgramParameteri' : is not a member of 'GLES2GraphicsStateGuardian'
        c:\panda3d-1.7.0\panda\src\glstuff\glGraphicsStateGuardian_src.h(164) : see declaration of 'GLES2GraphicsStateGuardian'
c:\panda3d-1.7.0\panda\src\glstuff\glShaderContext_src.cxx(974) : error C2039: '_glProgramParameteri' : is not a member of 'GLES2GraphicsStateGuardian'
        c:\panda3d-1.7.0\panda\src\glstuff\glGraphicsStateGuardian_src.h(164) : see declaration of 'GLES2GraphicsStateGuardian'
c:\panda3d-1.7.0\panda\src\glstuff\glGraphicsBuffer_src.cxx(190) : error C2065: 'GL_FRAMEBUFFER_INCOMPLETE_FORMATS' : undeclared identifier
c:\panda3d-1.7.0\panda\src\glstuff\glGraphicsBuffer_src.cxx(190) : error C2051: case expression not constant
c:\panda3d-1.7.0\panda\src\glstuff\glGraphicsStateGuardian_src.cxx(958) : error C2440: '=' : cannot convert from 'void (__stdcall *)(GLuint,GLuint)' to 'PFNGLATTACHSHADERPROC'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
c:\panda3d-1.7.0\panda\src\glstuff\glGraphicsStateGuardian_src.cxx(959) : error C2440: '=' : cannot convert from 'void (__stdcall *)(GLuint,GLuint,const char *)' to 'PFNGLBINDATTRIBLOCATIONPROC'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
c:\panda3d-1.7.0\panda\src\glstuff\glGraphicsStateGuardian_src.cxx(960) : error C2440: '=' : cannot convert from 'void (__stdcall *)(GLuint)' to 'PFNGLCOMPILESHADERPROC'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
c:\panda3d-1.7.0\panda\src\glstuff\glGraphicsStateGuardian_src.cxx(961) : error C2440: '=' : cannot convert from 'GLuint (__stdcall *)(void)' to 'PFNGLCREATEPROGRAMPROC'

(there are more of the same nature)

So what does the previous error, inconsistent DLL linkage typically mean? I haven’t come across this before.


#8

I advise getting the latest CVS version of Panda3D. I think that it has many of these problems resolved (including the previous one, I’ve just checked in a fix to that).

As for what “Inconsistent DLL linkage” means - I don’t know the exact details, but it’s got something to do with __declspec(dllexport) and __declspec(dllimport) being used incorrectly. When compiling the headers, the classes are exported using dllexport, but when including the headers, dllimport is used.
We have this in panda/src/pandabase/pandasymbols.h:

#ifdef BUILDING_PANDAGLES2
  #define EXPCL_PANDAGLES2 __declspec(dllexport)
  #define EXPTP_PANDAGLES2
#else
  #define EXPCL_PANDAGLES2 __declspec(dllimport)
  #define EXPTP_PANDAGLES2 extern
#endif

So when BUILDING_PANDAGLES2 is not correctly defined when building this code, it gets compiled using the wrong keyword.

In the case of non-Windows, these symbols are not necessary and defined to nothing, that’s why I’ve never spotted the mistake before.


#9

Interesting. Thanks for the explanation. I’ll pull the latest from CVS and recompile and post the results.


#10

Hey.

I got the source from CVS and fixed errors as I went. These were mostly just casting of types. I got to the point where I’m compiling the code under panda/egldisplay. Unfortunately it all seems to be X11 dependent. Should this directory be included in the build process?

Colin


#11

Feel free to send me a patch and I’ll apply it to CVS.

As for egldisplay - eh, it’s really made for X11. What we should really do is remove the X11-specific stuff, and make the classes inherit from classes in x11display or from windisplay based on ifdefs - as opposed to directly inheriting from classes in display.

(egldisplay is basically a fork of glxdisplay, but later we’ve moved the X11-specific stuff from glxdisplay to x11display).


#12

In that case, would it make sense to start over with glxdisplay and build in the egl specific stuff from egldisplay?


#13

Hmm, maybe that’s easier indeed. If you really want to complicate making it easy, find the date in CVS in which egldisplay was created, and diff it to glxdisplay at that point, duplicate the current version of glxdisplay and use the diff to replace the GLX stuff with EGL stuff.
Of course, that’s only step one - step two would be to let it inherit from the windisplay code in the case of Windows.

I could help and separate out the code to make it easier for you, but I’m kind of swamped this weekend, so that would have to wait a few days.


#14

Hello.

Could you help me out with the following linker errors?


link /nologo /DLL  /DEBUG  /MAP /MAPINFO:EXPORTS /fixed:no /incremental:no /stack:4194304 /NODEFAULTLIB:LIBCI.LIB /NOD:MFC80.LIB /NOD:libcmtd /NOD:libc /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF /NODEFAULTLIB:LIBCMT.LIB  /OUT:"Opt3-Cygwin\libframework.dll" Opt3-Cygwin/framework_framework_composite1.obj  /LIBPATH:"..\..\metalibs\panda\Opt3-Cygwin" /LIBPATH:"..\..\metalibs\pandaexpress\Opt3-Cygwin" /LIBPATH:"C:\panda3d-1.7.0\lib" /LIBPATH:"C:\Python26\libs" /LIBPATH:"C:\Python26\libs" libpanda.lib libpandaexpress.lib libdtoolconfig.lib libdtool.lib ws2_32.lib wsock32.lib
   Creating library Opt3-Cygwin\libframework.lib and object Opt3-Cygwin\libframework.exp
framework_framework_composite1.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class DisplayRegion * __thiscall GraphicsOutput::make_mono_display_region(class LVecBase4f const &)" (__imp_?make_mono_display_region@GraphicsOutput@@QAEPAVDisplayRegion@@ABVLVecBase4f@@@Z) referenced in function "public: class NodePath __thiscall WindowFramework::get_render_2d(void)" (?get_render_2d@WindowFramework@@QAE?AVNodePath@@XZ)
framework_framework_composite1.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall Texture::do_unlock_and_reload_ram_image(bool)" (?do_unlock_and_reload_ram_image@Texture@@MAEX_N@Z)
framework_framework_composite1.obj : error LNK2001: unresolved external symbol "protected: virtual bool __thiscall Texture::do_can_reload(void)" (?do_can_reload@Texture@@MAE_NXZ)
framework_framework_composite1.obj : error LNK2001: unresolved external symbol "public: virtual class PointerTo<class TextFont> __thiscall StaticTextFont::make_copy(void)const " (?make_copy@StaticTextFont@@UBE?AV?$PointerTo@VTextFont@@@@XZ)
framework_framework_composite1.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class DisplayRegion * __thiscall GraphicsOutput::make_display_region(class LVecBase4f const &)" (__imp_?make_display_region@GraphicsOutput@@QAEPAVDisplayRegion@@ABVLVecBase4f@@@Z) referenced in function "protected: class GraphicsOutput * __thiscall WindowFramework::open_window(class WindowProperties const &,int,class GraphicsEngine *,class GraphicsPipe *,class GraphicsStateGuardian *)" (?open_window@WindowFramework@@IAEPAVGraphicsOutput@@ABVWindowProperties@@HPAVGraphicsEngine@@PAVGraphicsPipe@@PAVGraphicsStateGuardian@@@Z)
Opt3-Cygwin\libframework.dll : fatal error LNK1120: 5 unresolved externals
make[1]: *** [Opt3-Cygwin/libframework.dll] Error 96
make[1]: Leaving directory `/cygdrive/c/panda3d-1.7.0/panda/src/framework'
make: *** [framework] Error 2

colinn@colinn-PC /cygdrive/c/panda3d-1.7.0/panda
$ nm metalibs/panda/Opt3-Cygwin/libpanda.lib | grep do_unlock_and_reload_ram_image
00000000 T ?do_unlock_and_reload_ram_image@Texture@@IAEX_N@Z
00000000 I __imp_?do_unlock_and_reload_ram_image@Texture@@IAEX_N@Z

libpanda.lib is in the library list, and (in example) do_unlock_and_reload_ram_image@Texture is a symbol in that lib. So I’m guessing this is some abstract function? Any tips before I start going through the code more thoroughly?


#15

This isn’t an issue with abstract functions or anything like this. I think it might be related to the DLL symbols again: Microsoft’s nutty DLL-import scheme requires symbols that are imported from another DLL to be prefixed with _imp, and symbols that are local to this DLL are not meant to be prefixed.

This is why you see the _imp prefix on do_unlock_and_reload_ram_image@Texture in the output of nm. (You should get used to using dumpbin /exports instead of nm; I think it’s more reliable on Windows.)

It’s suspicious that the _imp prefix is absent when the error message is reported by link. Almost as if BUILDING_PANDA had been defined when compiling some parts of the framework directory. Make sure that BUILDING_xxx is only defined when compiling the code that is going to go into library xxx.

David


#16

Hey.

I finally got my new lib ‘wegldisplay’ compiling and linking properly. I used ‘egldisplay’ and ‘wgldisplay’ as bases for this. I have a pandagles2.lib file but no wegl[2]display.lib.

My Sources.pp for wegldisplay looks like this

#define BUILD_DIRECTORY $[HAVE_WEGL]

#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
                   dtoolutil:c dtoolbase:c dtool:m

#begin lib_target
  #define TARGET wegldisplay
  #define EXTRA_CDEFS OPENGLES_1
  #define LOCAL_LIBS \
    glesgsg display putil windisplay
	
  #define COMPONENT_LIBS \
    windisplay
	
	
  #define SOURCES \
    config_wegldisplay.cxx config_wegldisplay.h \
    weglGraphicsBuffer.h weglGraphicsBuffer.cxx \
    weglGraphicsPipe.I weglGraphicsPipe.cxx weglGraphicsPipe.h \
    weglGraphicsPixmap.h weglGraphicsPixmap.cxx \
    weglGraphicsWindow.h weglGraphicsWindow.cxx \
    weglGraphicsStateGuardian.h weglGraphicsStateGuardian.cxx

  #define INSTALL_HEADERS \
    weglGraphicsBuffer.h weglGraphicsPixmap.h \
    weglGraphicsPipe.I weglGraphicsPipe.h \
    weglGraphicsWindow.I weglGraphicsWindow.h
	
	#define WIN_SYS_LIBS \
		EGL GLESv2 $[WIN_SYS_LIBS]

#end lib_target

#begin lib_target
  #define TARGET wegldisplay
  #define EXTRA_CDEFS OPENGLES_2
  #define LOCAL_LIBS \
    gles2gsg display putil windisplay

  #define SOURCES \
    config_wegldisplay.cxx config_wegldisplay.h \
    weglGraphicsBuffer.h weglGraphicsBuffer.cxx \
    weglGraphicsPipe.I weglGraphicsPipe.cxx weglGraphicsPipe.h \
    weglGraphicsPixmap.h weglGraphicsPixmap.cxx \
    weglGraphicsWindow.h weglGraphicsWindow.cxx \
    weglGraphicsStateGuardian.h weglGraphicsStateGuardian.cxx

  #define INSTALL_HEADERS \
    weglGraphicsBuffer.h weglGraphicsPixmap.h \
    weglGraphicsPipe.I weglGraphicsPipe.h \
    weglGraphicsWindow.I weglGraphicsWindow.h
	
	#define WIN_SYS_LIBS \
		EGL GLESv2 $[WIN_SYS_LIBS]

#end lib_target

My Config.prc (in the etc folder) looks like this:

load-display pandagles
load-display pandagles2

I think I need help with the Config.pp files in general. I had the following error:

Cycle detected in inter-directory dependencies!
wegldisplay depends on pandagles2
pandagles2 depends on wegldisplay

When I had the second #define TARGET in wegldisplay/Sources.pp set as wegl2display. I understand what the error means, just not how to resolve it. I seem to have the same thing that egldisplay has (more or less)

Any help would be greatly appreciated. Thanks!


#17

Hmm, that’s weird. I assume you’ve added the right code to panda/metalibs/pandagles2 and panda/metalibs/pandagles already?

Maybe you’re accidentally including pandagles2.h in your code, or so?

If not, you could try calling “make cleanall” within the wegldisplay and pandagles2 directories, and invoking “ppremake” and “make install” in wegldisplay and pandagles2, respectively.


#18

I don’t include pangles directly. Would you mind taking a quick look at my changes? They are fairly small. I would appreciate a hand since I’m not clear on the build system.

I uploaded my work here if you are interested:

bitbucket.org/colinn/panda3d_wegldisplay


#19

ppremake determines directory dependency order based on the LOCAL_LIBS lines in each Sources.pp. You can also use ppremake -d dirname or ppremake -r dirname to output the forward and reverse dependencies of a particular directory, if it helps you track this down. But in general, the error message is telling you that wegldisplay is directly or indirectly linking with a library built by pandagles2, and vice-versa.

David


#20

Cool, thanks David. I’ve found the error and fixed it.

Should my wegldisplay be generating a lib? It creates object files and installs a header.


#21

Should we really have a separate wegldisplay? I was thinking of having egldisplay use the Windows interfaces in the case of Windows, and X11 in the case of Unix.


#22

It doesn’t matter to me. Once wegldisplay is working it should be easy to merge egl and wegl.

Note: eglDisplay should compile in windows (or at least it did). I found it easier to distance myself from that though to limit breakage points.


#23

Another update. I merge the wegl code into egldisplay. It should still compile and link properly in Linux. If not there are probably a few small chagnes that need making.

Unfortunately pview still can’t find a graphics pipe. Not sure what I am doing wrong.

UPDATE: I don’t have many libs, like libp3framework.


#24

Awesome, great job! I’d be happy to incorporate your changes and make sure it still works on Linux.

Do you have “load-display pandagles2” in Config.prc? Is there any warning saying that it couldn’t be loaded?


#25

Here is my prc file

load-display pandagles
load-display pandagles2
load-display egldisplay
load-display pandagl
notify-level-panagles3 spam

Here is the console output of pview

colinn@colinn-PC /cygdrive/c/panda3d-1.7.0
$ pview
Known pipe types:
(all display modules loaded.)
No graphics pipe is available!
Your Config.prc file must name at least one valid panda display
library via load-display or aux-display.

colinn@colinn-PC /cygdrive/c/panda3d-1.7.0
$ which pview
/cygdrive/c/panda3d-1.7.0/bin/pview

I can’t create a hello world app since I don’t have libp3framework. So I must be missing something.


#26

Hmm… two things could be wrong.

Firstly, try adding a “plugin-path” line to Config.prc pointing to the location of the directory that contains the pandagles dll.

Secondly, make sure the Config.prc file is loaded at all, by setting the PRC_DIR environment variable to the directory containing it.

PS. I also notice there’s “panagles3” in your Config.prc file. Shouldn’t that be “pandagles2”?