Summary:ASTERISK-04843: [patch] astmm fails to compile
Reporter:Roy Sigurd Karlsbakk (rkarlsba)Labels:
Date Opened:2005-08-16 03:24:49Date Closed:2008-01-15 15:47:33.000-0600
Versions:Frequency of
Environment:Attachments:( 0) astlog.txt
( 1) astmm-20050816.patch
Description:enabling MALLOC_DEBUG with
MALLOC_DEBUG = -include $(PWD)/include/asterisk/astmm.h
in the makefile should enable memory allocation debug, but this fails to compile. First, there's a simple fix attached, removing an error and a warning, then there seems to be some change done, as the compile fails on an #error:

gcc -pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g  -Iinclude -I../include -D_REENTRANT -D_GNU_SOURCE  -O6 -march=i686  -DZAPTEL_OPTIMIZATIONS    -include /usr/src/asterisk+spandsp+sipjb/include/asterisk/astmm.h      -fomit-frame-pointer  -pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g  -Iinclude -I../include -D_REENTRANT -D_GNU_SOURCE  -O6 -O6 -march=i686  -DZAPTEL_OPTIMIZATIONS    -include /usr/src/asterisk+spandsp+sipjb/include/asterisk/astmm.h      -fomit-frame-pointer    -c -o ast_expr.o ast_expr.c
In file included from <command line>:11:
/usr/src/asterisk+spandsp+sipjb/include/asterisk/astmm.h:68:2: #error "NEVER INCLUDE astmm.h DIRECTLY!!"

Comments:By: Roy Sigurd Karlsbakk (rkarlsba) 2005-08-23 04:38:30

note that the patch does not fix the whole problem
astmm still fails to compile

By: Michael Jerris (mikej) 2005-08-23 07:04:57

that message is not from unpatched asterisk.  Does this happen on a totally unpatched asterisk?

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-08-23 08:37:30

an unpatched asterisk (without the above patch) where ASTMM is enabled in the Makefile, does not compile with astmm because of a missing semicolon around line 360 (snprintf...). after fixing that, i get this message

/usr/src/cvs/asterisk/head/asterisk/include/asterisk/astmm.h:68:2: #error "NEVER INCLUDE astmm.h DIRECTLY!!"


By: Kevin P. Fleming (kpfleming) 2005-08-23 11:07:09

Committed to CVS HEAD with additional changes to fix the other issue. Thanks!

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-08-28 09:59:14

compiling with astmm fails the same way as before if doing a 'make valgrind'


By: Michael Jerris (mikej) 2005-08-28 10:01:14

are the compile messages the same on failure? if not, please upload those.

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-08-28 10:19:16

same as before:

In file included from <command line>:11:
/usr/src/asterisk+spandsp+sipjb/include/asterisk/astmm.h:68:2: #error "NEVER INCLUDE astmm.h DIRECTLY!!"

By: Kevin P. Fleming (kpfleming) 2005-08-30 23:23:02

I still cannot reproduce this on my system; please capture a _complete_ log of your failing build and upload it as an attachment to this bug.

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-08-31 06:10:40

prior to creating the attached log file, i did a cvs up -PdA to make sure everything was latest and then 'make clean' and 'make valgrind'. the log starts off with a 'cvs diff -u' to show what's changed (only the one line in Makefile)

By: Kevin P. Fleming (kpfleming) 2005-08-31 12:20:47

For some reason 'make' on your system is doubling up CFLAGS when it gets into the stdtime directory, but it does not do that on my test systems.

What distro/version/etc. are you running on, and what version of make are you using?

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-08-31 18:05:24

it's a suse 9.1 system

pstngw1:/usr/src/cvs/asterisk/head/asterisk # make --version
GNU Make 3.80
Copyright (C) 2002  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

By: Kevin P. Fleming (kpfleming) 2005-09-02 15:38:10

This does not fail on a SUSE 9.3 system, nor on a Debian sarge system, nor on a Debian testing system. I'd say the failure is in the 'make' tool on your system, and suggest that you upgrade it.

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-03 11:21:00

according to ftp://ftp.gnu.org/gnu/make/, this the is latest version of gnu make, from 2002.

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-03 11:24:13

for reference, i just tried again on an updated sarge box
are you sure you've
(1) enabled astmm in the root Makefile?
(2) done a make valgrind?


By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-03 11:36:47

that is
make clean valgrind


By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-03 12:28:21

the following section is not in CVS even if it is in the patch from the asterisk-cvs ml

# if doing a recursive make, don't double-up CFLAGS
ifeq ($(MAKECMDGOALS),ast_expr.a)

still, this does not help when doing a 'make clean valgrind'


By: Michael Jerris (mikej) 2005-09-03 14:17:56

what version of gcc are you using?

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-03 15:39:23

$ gcc --version
gcc (GCC) 3.4.4 20050314 (prerelease) (Debian 3.4.3-13)
Copyright (C) 2004 Free Software Foundation, Inc.

By: inspired (inspired) 2005-09-04 08:42:39

In file included from <command line>:11:
/usr/src/asteriskcvs/asterisk/include/asterisk/astmm.h:77:2: #error "NEVER INCLUDE astmm.h DIRECTLY!!"

---- REPRODUCEABLE on Debian Sarge.

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-04 08:43:45

reproduced on mac os x tiger 10.4.2
can someone please take a look into this?

By: Olle Johansson (oej) 2005-09-05 13:11:07

On FreeBSD:
In file included from localtime.c:1:
/usr/local/src/asterisk/asterisk/include/asterisk/astmm.h:49: syntax error before `va_list'
/usr/local/src/asterisk/asterisk/include/asterisk/astmm.h:49: warning: function declaration isn't a prototype
gmake[1]: *** [localtime.o] Error 1
gmake[1]: Leaving directory `/usr/local/src/asterisk/asterisk/stdtime'
gmake: *** [stdtime/libtime.a] Error 2

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-05 13:22:32

with OS X 10.4.2, the following error occurs if only running 'make', not 'make valgrind'

gcc -pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g  -Iinclude -I../include -D_REENTRANT -D_GNU_SOURCE  -O6    -include /Users/roy/src/cvs/asterisk/head/asterisk/include/asterisk/astmm.h      -fomit-frame-pointer  -D__Darwin__   -c -o sched.o sched.c
In file included from include/asterisk/utils.h:37,
                from include/asterisk/channel.h:55,
                from sched.c:32:
include/asterisk/strings.h:236: error: parse error before string constant
include/asterisk/strings.h:236: warning: function declaration isn't a prototype
make: *** [sched.o] Error 1

By: Kevin P. Fleming (kpfleming) 2005-09-07 20:34:18

OK, this problem is now fixed in CVS HEAD as well.

By: Digium Subversion (svnbot) 2008-01-15 15:45:07.000-0600

Repository: asterisk
Revision: 6379

U   trunk/Makefile
U   trunk/astmm.c

r6379 | kpfleming | 2008-01-15 15:45:06 -0600 (Tue, 15 Jan 2008) | 2 lines

make MALLOC_DEBUG build work properly (issue ASTERISK-4843 with additional changes)



By: Digium Subversion (svnbot) 2008-01-15 15:47:33.000-0600

Repository: asterisk
Revision: 6546

U   trunk/Makefile

r6546 | kpfleming | 2008-01-15 15:47:33 -0600 (Tue, 15 Jan 2008) | 2 lines

ensure that MALLOC_DEBUG and 'make dont-optimize' don't conflict (issue ASTERISK-4843)