buidling pyro on windows error

I am trying to compile my pyro library in windows but i get very odd error some thing with panda threads - i have no clue what it is please help:

C:\Documents and Settings\Administrator\Desktop\2aw\aff2aw\pyro>scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated BuildDir targets: build
cl /nologo /TP /IC:\Panda3D-1.4.2\include /c build\pyro.cxx /Fobuild\pyro.obj
pyro.cxx
C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xlocale(342) : warning C
4530: C++ exception handler used, but unwind semantics are not enabled. Specify
/EHsc
c:\panda3d-1.4.2\include\threadDummyImpl.I(129) : error C2079: 'rqtp' uses undef
ined struct 'ThreadDummyImpl::sleep::timespec'
c:\panda3d-1.4.2\include\threadDummyImpl.I(130) : error C2228: left of '.tv_sec'
 must have class/struct/union
        type is 'int'
c:\panda3d-1.4.2\include\threadDummyImpl.I(131) : error C2228: left of '.tv_nsec
' must have class/struct/union
        type is 'int'
c:\panda3d-1.4.2\include\threadDummyImpl.I(131) : error C2228: left of '.tv_sec'
 must have class/struct/union
        type is 'int'
c:\panda3d-1.4.2\include\threadDummyImpl.I(132) : error C3861: 'nanosleep': iden
tifier not found
c:\panda3d-1.4.2\include\thread.I(42) : warning C4355: 'this' : used in base mem
ber initializer list
c:\panda3d-1.4.2\include\thread.I(60) : warning C4355: 'this' : used in base mem
ber initializer list
c:\panda3d-1.4.2\include\socket_portable.h(360) : error C2146: syntax error : mi
ssing ';' before identifier 'Host'
c:\panda3d-1.4.2\include\socket_portable.h(360) : error C4430: missing type spec
ifier - int assumed. Note: C++ does not support default-int
c:\panda3d-1.4.2\include\socket_portable.h(360) : error C2146: syntax error : mi
ssing ';' before identifier 'Type'
c:\panda3d-1.4.2\include\socket_portable.h(360) : error C4430: missing type spec
ifier - int assumed. Note: C++ does not support default-int
c:\panda3d-1.4.2\include\socket_portable.h(360) : error C2146: syntax error : mi
ssing ';' before identifier 'defined'
c:\panda3d-1.4.2\include\socket_portable.h(360) : error C4430: missing type spec
ifier - int assumed. Note: C++ does not support default-int
c:\panda3d-1.4.2\include\socket_portable.h(360) : error C2143: syntax error : mi
ssing ';' before '!'
c:\panda3d-1.4.2\include\socket_portable.h(360) : error C4430: missing type spec
ifier - int assumed. Note: C++ does not support default-int
c:\panda3d-1.4.2\include\socket_portable.h(360) : error C2059: syntax error : '!
'
c:\panda3d-1.4.2\include\socket_portable.h(361) : fatal error C1189: #error :
Fatal
scons: *** [build\pyro.obj] Error 2
scons: building terminated because of errors.

I dunno if this might help, but I kinda had a similar problem.
Look here: discourse.panda3d.org/viewtopic.php?t=3845

but i am not using threads - i think its some thing to do with incorrect includes or some crap like that.

EDIT: looking at it some more its not like that at all

INLINE void ThreadDummyImpl::
sleep(double seconds) {
#ifdef WIN32
  Sleep((int)(seconds * 1000));
#else
  struct timespec rqtp;
  rqtp.tv_sec = time_t(seconds);
  rqtp.tv_nsec = long((seconds - (double)rqtp.tv_sec) * 1000000000.0);
  nanosleep(&rqtp, NULL);
#endif  // WIN32
}

i think i need to define WIN32 but how do i do it in cross platform manner?

You have to pass a bunch of command-line options to the compiler. Watch what makepanda does, and you’ll see the relevant options.

I solved the problem by defining WIN32 in the cxx files … wtf?! … this is definitely not the way to solve.
Now i cant link:

link /nologo /dll /out:libpyro.dll /implib:libpyro.lib /LIBPATH:C:\Panda3D-1.4.2
\lib /LIBPATH:C:\Panda3D-1.4.2\python\libs "/LIBPATH:C:\Program Files\Microsoft
Platform SDK\Lib" libp3pystub.lib libp3framework.lib libpandaexpress.lib libp3dt
ool.lib libp3dtoolconfig.lib libpanda.lib libpandafx.lib build\pyro_module.obj b
uild\pyro.obj build\pyro_igate.obj
   Creating library libpyro.lib and object libpyro.exp
pyro.obj : error LNK2019: unresolved external symbol "class MemoryHook * memory_
hook" (?memory_hook@@3PAVMemoryHook@@A) referenced in function "public: static v
oid * __cdecl MemoryBase::operator new(unsigned int)" (??2MemoryBase@@SAPAXI@Z)
pyro_igate.obj : error LNK2001: unresolved external symbol "class MemoryHook * m
emory_hook" (?memory_hook@@3PAVMemoryHook@@A)
pyro.obj : error LNK2019: unresolved external symbol "private: static class Thre
ad * Thread::_main_thread" (?_main_thread@Thread@@0PAV1@A) referenced in functio
n "public: static class Thread * __cdecl Thread::get_main_thread(void)" (?get_ma
in_thread@Thread@@SAPAV1@XZ)
pyro_igate.obj : error LNK2001: unresolved external symbol "private: static clas
s Thread * Thread::_main_thread" (?_main_thread@Thread@@0PAV1@A)
pyro.obj : error LNK2019: unresolved external symbol "private: static class Geom
VertexFormat::Registry * GeomVertexFormat::_registry" (?_registry@GeomVertexForm
at@@0PAVRegistry@1@A) referenced in function "private: static class GeomVertexFo
rmat::Registry * __cdecl GeomVertexFormat::get_registry(void)" (?get_registry@Ge
omVertexFormat@@CAPAVRegistry@1@XZ)
pyro.obj : error LNK2019: unresolved external symbol "private: static class Poin
terTo<class InternalName> InternalName::_root" (?_root@InternalName@@0V?$Pointer
To@VInternalName@@@@A) referenced in function "public: static class PointerTo<cl
ass InternalName> __cdecl InternalName::get_root(void)" (?get_root@InternalName@
@SA?AV?$PointerTo@VInternalName@@@@XZ)
pyro.obj : error LNK2019: unresolved external symbol "class TypeHandle pvector_t
ype_handle" (?pvector_type_handle@@3VTypeHandle@@A) referenced in function "publ
ic: __thiscall GeomVertexDataPipelineWriter::GeomVertexDataPipelineWriter(class
GeomVertexData *,bool,class Thread *)" (??0GeomVertexDataPipelineWriter@@QAE@PAV
GeomVertexData@@_NPAVThread@@@Z)
pyro.obj : error LNK2019: unresolved external symbol "private: static class Type
Handle GeomVertexData::_type_handle" (?_type_handle@GeomVertexData@@0VTypeHandle
@@A) referenced in function "public: static class TypeHandle __cdecl GeomVertexD
ata::get_class_type(void)" (?get_class_type@GeomVertexData@@SA?AVTypeHandle@@XZ)

pyro.obj : error LNK2019: unresolved external symbol "private: static class Type
Handle GeomPrimitive::_type_handle" (?_type_handle@GeomPrimitive@@0VTypeHandle@@
A) referenced in function "public: static class TypeHandle __cdecl GeomPrimitive
::get_class_type(void)" (?get_class_type@GeomPrimitive@@SA?AVTypeHandle@@XZ)
pyro.obj : error LNK2019: unresolved external symbol "private: static class Type
Handle Geom::_type_handle" (?_type_handle@Geom@@0VTypeHandle@@A) referenced in f
unction "public: static class TypeHandle __cdecl Geom::get_class_type(void)" (?g
et_class_type@Geom@@SA?AVTypeHandle@@XZ)
pyro.obj : error LNK2019: unresolved external symbol "private: static class Neve
rFreeMemory * NeverFreeMemory::_global_ptr" (?_global_ptr@NeverFreeMemory@@0PAV1
@A) referenced in function "private: static class NeverFreeMemory * __cdecl Neve
rFreeMemory::get_global_ptr(void)" (?get_global_ptr@NeverFreeMemory@@CAPAV1@XZ)
pyro.obj : error LNK2019: unresolved external symbol "private: static void * Obj
ectDeletor::_global_ptr" (?_global_ptr@ObjectDeletor@@0PAXA) referenced in funct
ion "public: static class ObjectDeletor * __cdecl ObjectDeletor::get_global_ptr(
void)" (?get_global_ptr@ObjectDeletor@@SAPAV1@XZ)
pyro_igate.obj : error LNK2001: unresolved external symbol "private: static void
 * ObjectDeletor::_global_ptr" (?_global_ptr@ObjectDeletor@@0PAXA)
pyro.obj : error LNK2019: unresolved external symbol "public: static class Delet
edChain<class GeomVertexArrayDataHandle> GeomVertexArrayDataHandle::_deleted_cha
in" (?_deleted_chain@GeomVertexArrayDataHandle@@2V?$DeletedChain@VGeomVertexArra
yDataHandle@@@@A) referenced in function "public: static void __cdecl GeomVertex
ArrayDataHandle::operator delete(void *)" (??3GeomVertexArrayDataHandle@@SAXPAX@
Z)
pyro.obj : error LNK2019: unresolved external symbol "private: static class Type
Handle GeomVertexArrayDataHandle::_type_handle" (?_type_handle@GeomVertexArrayDa
taHandle@@0VTypeHandle@@A) referenced in function "public: static class TypeHand
le __cdecl GeomVertexArrayDataHandle::get_class_type(void)" (?get_class_type@Geo
mVertexArrayDataHandle@@SA?AVTypeHandle@@XZ)
pyro.obj : error LNK2019: unresolved external symbol "private: static class Type
Handle NodePathComponent::_type_handle" (?_type_handle@NodePathComponent@@0VType
Handle@@A) referenced in function "public: static class TypeHandle __cdecl NodeP
athComponent::get_class_type(void)" (?get_class_type@NodePathComponent@@SA?AVTyp
eHandle@@XZ)
pyro_igate.obj : error LNK2001: unresolved external symbol "private: static clas
s TypeHandle NodePathComponent::_type_handle" (?_type_handle@NodePathComponent@@
0VTypeHandle@@A)
pyro_igate.obj : error LNK2019: unresolved external symbol "struct PyMemberDef *
 standard_type_members" (?standard_type_members@@3PAUPyMemberDef@@A) referenced
in function "void __cdecl `dynamic initializer for 'Dtool_Pyro''(void)" (??__EDt
ool_Pyro@@YAXXZ)
libpyro.dll : fatal error LNK1120: 14 unresolved externals

Do you know what extra libs i should grab in order to link it up?

Josh Yelon, makepanda.py itself is pretty harry is there an easy way to rip stuff out of it and make for my own make file?

maybe the problem is that i am tyring to link VC++ 2008 lib to it looks like VC++ 2005 lib files?

I wasn’t suggesting you use makepanda - I was just suggesting you watch what it does (and what compiler options it uses) and use the same compiler options.

However, in the latest panda, makepanda has been split into makepandacore and makepanda. Makepandacore is just a library of useful routines for python-based builds, particularly panda-related ones. But the separation is not entirely complete.

I’d love to see what makepanda says but its the 2005 - 2008 problem again.

C:\Documents and Settings\Administrator\Desktop\panda3d-1.4.2>makepanda\makepand
a --everything
Checking for MAYA6
Checking for MAYA65
Checking for MAYA7
Checking for MAYA8
Checking for MAYA85
VCDIR= 0
Elapsed Time: 0 sec
Cannot locate Microsoft Visual Studio 2005 or Visual Studio Express 2005

I don’t think you can use MSVC 2008 to compile panda, or panda libraries.

well ok it cant compile panda - odd - when pro-rsoft hellped me to get it compiled but crashes when i use it so … still no luck.

Put it this way: panda itself was compiled with MSVC 2005. Now I know the runtime systems of MSVC 2003 and MSVC 2005 are not compatible with each other - you can’t mix and match. I assume that the same is true for MSVC 2005 and MSVC 2008.

Yes Josh Yelon you are absolutely right. … no not another 3 hours download and 2 hour install - i it would be cool if i got some thing good but vc++ is crap. Arrrrr! Could we use your super distributed build environment?

I don’t have a “super-distributed build environment.” However, makepanda can do a multithreaded build if you have a multi-core PC. I have a quad-core Q6600, and building panda on this takes about 15 minutes from scratch.

by distributed I mean build for all platforms. I guess i would have to reinstall vc++. Is there a reason it does not work with vc++9?

It took a couple of weeks to port panda from VC7 to VC8. The whole “side by side assembly” nonsense was a giant monkey wrench in the works. Then, there was the fact that I had to recompile several of the thirdparty libraries for VC8 - not easy to do, considering that those are packages I don’t have much experience with.

Why not just download VC8 and use that?

i did it!
it works now yey. To bad 1.5 will break it but hopefully it will fix other issues.