64 bit compiles, but 32 bit gives the following error

Forum for questions and support relating to the 1.24.x releases only.
Locked
gregh-cctvsuppliers
Posts: 17
Joined: Tue Sep 29, 2009 11:19 pm

64 bit compiles, but 32 bit gives the following error

Post by gregh-cctvsuppliers »

On 64 bit, it compiles fine, but 32 bit gives the error below. As to the output of the pkg_info command is http://pastebin.com/m68c4bca1. The contents of config.log is http://pastebin.com/m58bf3f5c

The 64 bit pkg_info ouput is http://pastebin.com/m22a988e3
The 64 bit contents of config.log file is http://pastebin.com/m55c84b4
My modified version of Makefile is http://pastebin.com/m7e48c846
My modified version of distinfo is http://pastebin.com/m7e2445d5
I was hoping someone could shed light on this one.

In file included from zm_zone.h:27,
from zm_monitor.h:26,
from zmc.cpp:28:
zm_event.h:231: error: 'bool EventStream::loadInitialEventData(int, time_t)' cannot be overloaded
zm_event.h:230: error: with 'bool EventStream::loadInitialEventData(int, int)'
zm_event.h:254: error: 'void EventStream::setStreamStart(int, time_t)' cannot be overloaded
zm_event.h:249: error: with 'void EventStream::setStreamStart(int, int)'
*** Error code 1

Stop in /usr/ports/multimedia/zoneminder/work/ZoneMinder-1.24.2/src.
*** Error code 1

Stop in /usr/ports/multimedia/zoneminder/work/ZoneMinder-1.24.2.
*** Error code 1

Stop in /usr/ports/multimedia/zoneminder/work/ZoneMinder-1.24.2.
*** Error code 1

Stop in /usr/ports/multimedia/zoneminder.

Advance Thanks
Greg
timcraig
Posts: 195
Joined: Mon Dec 10, 2007 5:53 pm
Location: San Jose, CA

Post by timcraig »

I see from other posts you're working on a FreeBSD port of Zoneminder.

It looks like time_t is defined differently on the 32-bit and 64-bit systems you are working on and the 32-bit typedef is not type compatible with int. I would look up the time_t typedef.
gregh-cctvsuppliers
Posts: 17
Joined: Tue Sep 29, 2009 11:19 pm

Post by gregh-cctvsuppliers »

Both of them have this line in /usr/include/time.h
typedef __time_t time_t;

In /usr/include/machine/_types.h
64 bit:
#if defined(lint)
/* LONGLONG */
typedef long long __int64_t;
/* LONGLONG */
typedef __int64_t __time_t;

32 bit:
typedef int __int32_t;
typedef __int32_t __time_t;

So I changed
typedef int __int32_t;
to
typedef long __int32_t;

and it compiled! So instead of changing the /usr/include/machine/_types.h, any way of changing zoneminder code to comply? Then of'course, I'll create the necessary patches of automate the modifications using diff.
timcraig
Posts: 195
Joined: Mon Dec 10, 2007 5:53 pm
Location: San Jose, CA

Post by timcraig »

Opps I was thinking inheritance overriding instead of function overloading. It appears the case is that 32-bit time_t is identical to int. The compiler doesn't like it because it can't distinguish the (int, int) and the (int, time_t) functions.

There might be an elegant solution to this problem like a compiler flag option or something.

If an elegant solution can't be found I can think of two dirty ways off the top of my head:

1) Change time_t to long in the function headers of the functions causing errors. Then, in the body of the functions, cast that long value back into a time_t value. In all the calls to the (int, time_h) functions you'll need to cast time_t, to long.

I assume time_t is interpreted as an unsigned number so the type converstion from time_t to long and vice-versa should work without problems.

-OR-


2) Add another parameter to each one of the functions in each causing the error. (For example, make the (int, time_h) function a (int, time_h, int)). Then add a dummy value for that 3rd parameter in all calls to that function in the Zoneminder code.
timcraig
Posts: 195
Joined: Mon Dec 10, 2007 5:53 pm
Location: San Jose, CA

Post by timcraig »

Oh! It just donned on me. I don't think the time_t value gets modified at all in the functions. If this is a case, you can probably get by changing the time_t to "const time_t". The compiler might be okay with overloading function names with (int,int) and (int, const time_t)
gregh-cctvsuppliers
Posts: 17
Joined: Tue Sep 29, 2009 11:19 pm

Post by gregh-cctvsuppliers »

That did it.

You wouldn't happen to know how to write an if statement to check the output of the `uname -p` command and if the output is `i386` do this else do whatever? (unless a variable that already got the output of that command already exists)

Nevermind, set them both to long
timcraig
Posts: 195
Joined: Mon Dec 10, 2007 5:53 pm
Location: San Jose, CA

Post by timcraig »

I think it will be

#ifdef __x86__

or

#ifdef __i386__



Testing for 64bit would be

#ifdef __x86_64__
Locked