ZoneMinder under 64-bit

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
arbrandes
Posts: 1
Joined: Thu Jun 26, 2008 6:23 pm

ZoneMinder under 64-bit

Post by arbrandes »

Hi folks,

I believe I have discovered a 64-bit porting problem. But first, a bit of background:

I've been jumping through hoops trying to get ZM 1.23.3 working across browsers and platforms, accessible from behind a proxy (i.e., no Cambozola) with remote Axis cameras on 1xRTT/EVDO connections (major headache, lots of DIVIDE-BY-ZERO segfaults almost everywhere an FPS is dynamically calculated). After most layout and streaming problems were solved under Firefox and IE (the basic solution was to use Flash/swf), I was still left with a major gripe: the DVR streaming would simply not work.

Long story short, my ZM is running on SliceHost, and SliceHost apparently only provides 64-bit OS's. After much debugging, I noticed that the DVR controls would (mostly) work on my 32-bit development machine, but not on the production site. The following change improved things greatly:

Code: Select all

Index: zm_stream.h
===================================================================
--- zm_stream.h (revision 249)
+++ zm_stream.h (working copy)
@@ -47,12 +47,12 @@
 
 protected:
     typedef struct {
-        long msg_type;
+        int msg_type;
         char msg_data[16];
     } CmdMsg;
 
     typedef struct {
-        long msg_type;
+        int msg_type;
         char msg_data[256];
     } DataMsg;
This is because on 64-bit systems, a "long" is 64 bits wide, while on a 32-bit one it is only 32 bits wide, and the recvfrom() that reads the socket message is reading sizeof() bytes, which varies from architecture to architecture. Hence, the mess. On the other hand, "int" works fine because it is 32 bits long on both architectures.

It's not all fine and dandy yet, will post more as my issues are resolved.

Adolfo R. Brandes
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Thanks for this. I have now belately modified it in 1.24.0. The problem is an incompatibility between the c++ concept of size and that of php. The pack and unpack functions on php consider 'long' to be 32 bit on any architecture.
Phil
Post Reply