[Home]

Summary:ASTERISK-13263: [patch] FreeBSD, OpenBSD and OS/X asterisk compilation fail..
Reporter:Yuri (ys)Labels:
Date Opened:2008-12-23 06:25:39.000-0600Date Closed:2009-01-19 14:14:16.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/BuildSystem
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 2009011600_physmem64.diff.txt
( 1) asterisk.c.diff
Description:Hello.

When I complie current asterisk trunk (r166566), i got an error:

gmake[1]: Entering directory `/usr/home/asterisk/src/asterisk/main'
gcc -o asterisk.i -E asterisk.c -D_THREAD_SAFE -pthread -I/usr/home/asterisk/src/asterisk/include  -I/usr/local/include/libxml2 -I/usr/local/include -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g3 -Werror -Wunused -Wdeclaration-after-statement -D_FORTIFY_SOURCE=2 -Wundef  -Wmissing-format-attribute -Wformat=2 -I/usr/local/include -march=i386   -MD -MT asterisk.i -MF .asterisk.i.d -MP
asterisk.c:84:22: sys/swap.h: No such file or directory
gmake[1]: *** [asterisk.i] Error 1
gmake[1]: Leaving directory `/usr/home/asterisk/src/asterisk/main'
gmake: *** [main] Error 2


If, i remove include "sys/swap.h", i got this error:

asterisk.c: In function `handle_show_sysinfo':
asterisk.c:568: error: storage size of 'vmtotal' isn't known
asterisk.c:584: error: `HW_PHYSMEM64' undeclared (first use in this function)
asterisk.c:584: error: (Each undeclared identifier is reported only once
asterisk.c:584: error: for each function it appears in.)
asterisk.c:600: error: `VM_METER' undeclared (first use in this function)
asterisk.c:609: error: `KERN_NPROCS' undeclared (first use in this function)
asterisk.c:568: warning: unused variable `vmtotal'
Comments:By: Yuri (ys) 2008-12-23 07:19:12.000-0600

I upload the patch where I correct mib[] for FreeBSD.
Also corrected swapmode() plug.

By: Tilghman Lesher (tilghman) 2008-12-23 08:43:50.000-0600

While I appreciate the patch, we're now doing those types of detections in autoconf.  I'll invite you to take a look at configure.ac, or, if you prefer, we can make the applicable changes.

By: Olle Johansson (oej) 2009-01-12 08:08:31.000-0600

This doesn't work with latest trunk on OS/X either

  [CC] asterisk.c -> asterisk.o
asterisk.c:84:22: error: sys/swap.h: No such file or directory
asterisk.c: In function 'handle_show_sysinfo':
asterisk.c:566: error: storage size of 'vmtotal' isn't known
asterisk.c:582: error: 'HW_PHYSMEM64' undeclared (first use in this function)
asterisk.c:582: error: (Each undeclared identifier is reported only once
asterisk.c:582: error: for each function it appears in.)
asterisk.c:607: error: 'KERN_NPROCS' undeclared (first use in this function)
asterisk.c:566: warning: unused variable 'vmtotal'
asterisk.c: In function 'read_credentials':
asterisk.c:1152: warning: pointer targets in passing argument 2 of 'getpeereid' differ in signedness
asterisk.c:1152: warning: pointer targets in passing argument 3 of 'getpeereid' differ in signedness
make[1]: *** [asterisk.o] Error 1

I guess the configure script needs an update

By: Michiel van Baak (mvanbaak) 2009-01-13 16:50:11.000-0600

ok, got a freebsd vm setup wih latest 7.1 setup

  [CC] asterisk.c -> asterisk.o
asterisk.c: In function 'handle_show_sysinfo':
asterisk.c:568: error: storage size of 'vmtotal' isn't known
asterisk.c:584: error: 'HW_PHYSMEM64' undeclared (first use in this function)
asterisk.c:584: error: (Each undeclared identifier is reported only once
asterisk.c:584: error: for each function it appears in.)
asterisk.c:600: error: 'VM_METER' undeclared (first use in this function)
asterisk.c:609: error: 'KERN_NPROCS' undeclared (first use in this function)
cc1: warnings being treated as errors
asterisk.c:568: warning: unused variable 'vmtotal'
asterisk.c: In function 'read_credentials':
asterisk.c:1154: warning: pointer targets in passing argument 2 of 'getpeereid' differ in signedness
asterisk.c:1154: warning: pointer targets in passing argument 3 of 'getpeereid' differ in signedness
gmake[1]: *** [asterisk.o] Error 1
gmake: *** [main] Error 2

I'm going to look into this.

By: Michiel van Baak (mvanbaak) 2009-01-14 10:33:22.000-0600

ys: KERN_NPROCS gives you the count of running processes, while HW_NCPU gives you the number of CPU's in a system. Not really the same ...
Cant find a sysctl mib in the freebsd manpage that does the same as openbsd's KERN_NPROCS :(

By: John Todd (jtodd) 2009-01-14 12:26:42.000-0600

Broken on OpenBSD 4.2 as well with SVN 168600.  

...
  [CC] ast_expr2f.c -> ast_expr2f.o
  [CC] asterisk.c -> asterisk.o
asterisk.c: In function `handle_show_sysinfo':
asterisk.c:582: error: `HW_PHYSMEM64' undeclared (first use in this function)
asterisk.c:582: error: (Each undeclared identifier is reported only once
asterisk.c:582: error: for each function it appears in.)
gmake[1]: *** [asterisk.o] Error 1
gmake: *** [main] Error 2
bash-3.2# date
Wed Jan 14 18:07:42 GMT 2009
bash-3.2# uname -a
OpenBSD core1.pdx1.network.fox-den.com 4.2 GENERICASTERISK-372 i386
bash-3.2#

By: Olle Johansson (oej) 2009-01-14 12:32:41.000-0600

Maybe things like this should be checked before commit. Hint hint ;-)

By: John Todd (jtodd) 2009-01-14 12:53:40.000-0600

Perhaps take the suggestion to -dev along with some suggestions for finding resources to ensure compatibility. I can see it generating some discussion there.

By: Digium Subversion (svnbot) 2009-01-14 13:36:58.000-0600

Repository: asterisk
Revision: 168609

U   trunk/main/asterisk.c

------------------------------------------------------------------------
r168609 | mvanbaak | 2009-01-14 13:36:58 -0600 (Wed, 14 Jan 2009) | 13 lines

Fix compilation on FreeBSD and OSX

This started as work to fix the 'core show sysinfo'
CLI command but while working on it oej
pointed out that read_credentials did not compile neither.
So while being there, fix that as well.

Thanks for all the testing oej!

(closes issue ASTERISK-13263)
Reported by: ys
Tested by: oej, mvanbaak

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=168609

By: John Todd (jtodd) 2009-01-14 15:57:18.000-0600

Nope, still doesn't work on OpenBSD 4.2.  Jumped the gun a bit with closing this bug. I updated to  168610 and tried - no luck.  Results below.

...
  [CC] asterisk.c -> asterisk.o
asterisk.c: In function `handle_show_sysinfo':
asterisk.c:591: error: `HW_PHYSMEM64' undeclared (first use in this function)
asterisk.c:591: error: (Each undeclared identifier is reported only once
asterisk.c:591: error: for each function it appears in.)
gmake[1]: *** [asterisk.o] Error 1
gmake: *** [main] Error 2
bash-3.2# uname -a
OpenBSD core1.pdx1.network.fox-den.com 4.2 GENERICASTERISK-372 i386
bash-3.2#

By: Michiel van Baak (mvanbaak) 2009-01-14 16:25:17.000-0600

4.2 is like 2 versions behind current stable version ;)
Sorry, couldn't resist.

After discussing this on irc I think it should be fixed.
Just give me some time to find out how to detect this and I'll fix it.

It's not that urgent, because this thing is only in trunk and not in any releas or to-be-next-release branch but still ...
Some ppl run non-up-to-date versions for a reason

By: Michiel van Baak (mvanbaak) 2009-01-16 11:33:46.000-0600

jtodd: can you test this patch please ?

By: John Todd (jtodd) 2009-01-16 12:01:25.000-0600

The patch works with SVN version 168761 for OpenBSD 4.2 on i386.  Thanks!



By: Digium Subversion (svnbot) 2009-01-19 12:36:12.000-0600

Repository: asterisk
Revision: 169327

U   trunk/main/asterisk.c

------------------------------------------------------------------------
r169327 | mvanbaak | 2009-01-19 12:36:12 -0600 (Mon, 19 Jan 2009) | 11 lines

Make asterisk compile on non-amd64 versions of OpenBSD.

The HW_PHYSMEM64 is only available in latest OpenBSD and/or amd64 versions of OpenBSD.
Use HW_PHYSMEM when HW_PHYSMEM64 is not available.

(closes issue ASTERISK-13263)
Reported by: ys
Patches:
     2009011600_physmem64.diff.txt uploaded by mvanbaak (license 7)
Tested by: mvanbaak, jtodd

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=169327

By: Yuri (ys) 2009-01-19 13:32:34.000-0600

please assign tweak changes to swapmode plug:
used = total = 0;
MUST be:
*used = *total = 0;



By: Digium Subversion (svnbot) 2009-01-19 14:14:15.000-0600

Repository: asterisk
Revision: 169369

U   trunk/main/asterisk.c

------------------------------------------------------------------------
r169369 | mvanbaak | 2009-01-19 14:14:15 -0600 (Mon, 19 Jan 2009) | 7 lines

fix assignment in swapmode plug.
Spotted and fix provided by ys

(closes issue ASTERISK-13263)
Reported by: ys
Tested by: ys

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=169369