Build 1.9 x86 on Windows 7.1 SDK [SOLVED]

I’ve trying to build 1.9 from git on Windows 7.1 SDK as describe in readme, but get the following error:

[ 18%] Building C++ object built/tmp/p3pgraphnodes_composite2.obj
p3pgraphnodes_composite2.cxx
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\vector(870) : error C27
19: '_Val': formal parameter with __declspec(align('16')) won't be aligned
        g:\panda3d-master\built\include\pvector.h(39) : see reference to class t
emplate instantiation 'std::vector<_Ty,_Ax>' being compiled
        with
        [
            _Ty=TextureAttrib::StageNode,
            _Ax=pallocator_array<TextureAttrib::StageNode>
        ]
        g:\panda3d-master\built\include\ordered_vector.h(125) : see reference to
 class template instantiation 'pvector<Type>' being compiled
        with
        [
            Type=TextureAttrib::StageNode
        ]
        g:\panda3d-master\built\include\ordered_vector.h(277) : see reference to
 class template instantiation 'ordered_vector<Key,Compare>' being compiled
        with
        [
            Key=TextureAttrib::StageNode,
            Compare=TextureAttrib::CompareTextureStagePointer
        ]
        G:\panda3d-master\built\include\textureAttrib.h(137) : see reference to
class template instantiation 'ov_set<Key,Compare>' being compiled
        with
        [
            Key=TextureAttrib::StageNode,
            Compare=TextureAttrib::CompareTextureStagePointer
        ]
g:\panda3d-master\built\include\shader.I(685) : warning C4018: '<' : signed/unsi
gned mismatch
g:\panda3d-master\built\include\shader.I(691) : warning C4018: '<' : signed/unsi
gned mismatch
g:\panda3d-master\built\include\shader.I(696) : warning C4018: '<' : signed/unsi
gned mismatch
g:\panda3d-master\built\include\shader.I(714) : warning C4018: '<' : signed/unsi
gned mismatch
g:\panda3d-master\built\include\shader.I(722) : warning C4018: '<' : signed/unsi
gned mismatch
g:\panda3d-master\built\include\shader.I(730) : warning C4018: '<' : signed/unsi
gned mismatch
Storing dependency cache.
Elapsed Time: 35 min 25 sec
The following command returned a non-zero value: cl /wd4996 /wd4275 /wd4267 /wd4
101 /wd4273 /DWINVER=0x601 /Fobuilt/tmp/p3pgraphnodes_composite2.obj /nologo /c
/arch:SSE2 /Ipanda/src/pgraphnodes /Ibuilt/tmp /Ibuilt/include /Ithirdparty/win-
python/include /Ithirdparty/win-libs-vc10/eigen\include /Ithirdparty/win-libs-vc
10/extras/include /MD /Zi /O2 /Ob2 /Oi /Ot /fp:fast /DFORCE_INLINING /Fdbuilt/tm
p/p3pgraphnodes_composite2.pdb /DBUILDING_PANDA /bigobj /Zm300 /DWIN32_VC /DWIN3
2 -D_HAS_EXCEPTIONS=0 /W3 panda/src/pgraphnodes/p3pgraphnodes_composite2.cxx
Build terminated.

p.s. on Win7 x64 with the same instrumentary P3D 1.9 builds successfully

That’s odd. I haven’t encountered that before. Oh, wait, I see. It’s because you are building with Eigen on 32-bit, and the alignment restrictions are a bit tighter in that configuration.

Try moving the SamplerState object under StageNode to the top of the class in panda/src/pgraph/textureAttrib.h, ie. above the PT(TextureStage). Maybe that’d be enough to satisfy the alignment requirements.

Like this:

  class StageNode {
  public:
    INLINE StageNode(const TextureStage *stage,
                     unsigned int implicit_sort = 0,
                     int override = 0);

    SamplerState _sampler;
    PT(TextureStage) _stage;
    PT(Texture) _texture;
    bool _has_sampler;
    int _ff_tc_index;
    unsigned int _implicit_sort;
    int _override;
  };

No, it not solve the problem (
After quick search I’ve found this:
eigen.tuxfamily.org/bz/show_bug.cgi?id=83
stackoverflow.com/questions/1281 … nt-be-alig

Hmm. It would seem that there’s a bug it the MSVC vector implementation that it doesn’t support aligned data types. Normally, the way we fix this is by replacing a regular vector with an epvector, which is Eigen’s reimplementation of vector that isn’t broken. But in this case, the code is using ov_set, which uses vector indirectly.

I don’t have a solution ready. I’ll think about it. In the meantime, you could build with --no-eigen (you may get a slight decrease in vector performance).

Thanks, with --no-eigen build finished succesfully. I also tried to apply suggestion from the first link: replace “void resize(size_type _Newsize, _Ty _Val)” with “void resize(size_type _Newsize, _Ty& _Val)” in vector header and it also allowed to finish building, however I’am not sure that this solution is safe.

OK, I pushed a fix.