FreeBSD-i386, perl

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
bsam
Posts: 22
Joined: Tue Oct 07, 2008 10:25 am

FreeBSD-i386, perl

Post by bsam »

I've got an error at FreeBSD-i386:
-----
zmwatch[2097].ERR [Shared data size conflict in shared_data for monitor Monitor-1, expected 328, got 316]
-----

It is caused by the code at scripts/ZoneMinder/lib/ZoneMinder/Memory.pm.in (line 130):[code]our $arch = int(3.2*length(~0));[/code]
Here is what we have at FreeBSD:
-----
% perl -e 'print int(3.2*length(~0)),"\n"'
64
% perl -V
Summary of my perl5 (revision 5 version 8 subversion 9) configuration:
Platform:
osname=freebsd, osvers=9.0-current, archname=i386-freebsd-thread-multi-64int
uname='freebsd h30.sp.ipt.ru 9.0-current freebsd 9.0-current #7 r219381: mon mar 7 22:58:50 msk 2011 bsam@h30.sp.ipt.ru:usrobjusrsrcsysbb i386 '
config_args='-sde -Dprefix=/usr/local -Darchlib=/usr/local/lib/perl5/5.8.9/mach -Dprivlib=/usr/local/lib/perl5/5.8.9 -Dman3dir=/usr/local/lib/perl5/5.8.9/perl/man/man3 -Dman1dir=/usr/local/man/man1 -Dsitearch=/usr/local/lib/perl5/site_perl/5.8.9/mach -Dsitelib=/usr/local/lib/perl5/site_perl/5.8.9 -Dscriptdir=/usr/local/bin -Dsiteman3dir=/usr/local/lib/perl5/5.8.9/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Ui_malloc -Ui_iconv -Uinstallusrbinperl -Dcc=cc -Duseshrplib -Dinc_version_list=none -Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.9/BSDPAN" -Doptimize=-g -DDEBUGGING -Ud_dosuid -Ui_gdbm -Dusethreads=y -Dusemymalloc=n -Duse64bitint'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=define use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.9/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include',
optimize='-g',
cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.9/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include'
ccversion='', gccversion='4.2.1 20070719 [FreeBSD]', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags ='-pthread -Wl,-E -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib
libs=-lgdbm -lm -lcrypt -lutil
perllibs=-lm -lcrypt -lutil
libc=, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -Wl,-R/usr/local/lib/perl5/5.8.9/mach/CORE'
cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING MULTIPLICITY PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP USE_64_BIT_INT USE_FAST_STDIO
USE_ITHREADS USE_LARGE_FILES USE_PERLIO
USE_REENTRANT_API
Locally applied patches:
defined-or
Built under freebsd
Compiled at Mar 11 2011 23:20:15
@INC:
/usr/local/lib/perl5/5.8.9/BSDPAN
/usr/local/lib/perl5/site_perl/5.8.9/mach
/usr/local/lib/perl5/site_perl/5.8.9
/usr/local/lib/perl5/5.8.9/mach
/usr/local/lib/perl5/5.8.9
.
-----

One can see that perl is compiled with USE_64_BIT_INT option (it's a gefault option). That's why the first test is 64.
I patch the FreeBSD-i386 port to use the value of 32, but that's a hack imo. I'm sure how to do the right thing. Should we use intsize or ptrsize to calculate $arch and/or $native?

--
WBR, bsam
mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

Re: FreeBSD-i386, perl

Post by mastertheknife »

The best thing is to use a uniform shared memory size and layout. This way the offsets and the size will be identical for every platform and will allow 32bit and 64bit to co-exist. e.g. 32bit perl and 64bit ZoneMinder. I did this in the patch in my thread, feel free to copy\use.

mastertheknife.
Kfir Itzhak.
bsam
Posts: 22
Joined: Tue Oct 07, 2008 10:25 am

Re: FreeBSD-i386, perl

Post by bsam »

Thanks for your patch and suggestion!
However I'm not sure if I can cherry pick needed parts from your patch.
Let's hope your changes will find their way to the next release.
Post Reply