[Home]

Summary:ASTERISK-06859: Asterisk does not build on Fedora Core 5 due to defining of malloc to rpl_malloc (and rpl_realloc)
Reporter:Bradley Watkins (marquis)Labels:
Date Opened:2006-04-27 10:40:16Date Closed:2006-04-29 18:43:48
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 7043.patch
Description:Autoconf script is doing a #define malloc rpl_malloc and #define realloc rpl_realloc, causing builds to fail on FC5.  This does not happen on FC4.
Comments:By: Jared Smith (jsmith) 2006-04-27 11:14:36

Strange, I've got it working just fine on FC5.  Have you applied all the updates to FC5?  Just curious...

By: Andrey S Pankov (casper) 2006-04-27 11:34:32

Macro: AC_FUNC_MALLOC
   If the malloc function is compatible with the GNU C library malloc (i.e., `malloc (0)' returns a valid pointer), define HAVE_MALLOC to 1. Otherwise define HAVE_MALLOC to 0, ask for an AC_LIBOBJ replacement for `malloc', and define malloc to rpl_malloc so that the native malloc is not used in the main project.

   Typically, the replacement file `malloc.c' should look like (note the `#undef malloc'):

   @verbatim #if HAVE_CONFIG_H # include <config.h> #endif #undef malloc

   #include <sys/types.h>

   void *malloc ();

   /* Allocate an N-byte block of memory from the heap. If N is zero, allocate a 1-byte block. */

   void * rpl_malloc (size_t n) { if (n == 0) n = 1; return malloc (n); }

By: Bradley Watkins (marquis) 2006-04-27 13:04:18

The strange thing is, it worked with an SVN version from yesterday (sorry, i don't know the exact version).  I'll try and checkout out a specific version from yesterday and see if that compiles properly.  If it does, I'll just keep incrementing until it breaks.

By: Bradley Watkins (marquis) 2006-04-27 13:46:58

It appears that the acinclude.m4 checkin from yesterday (revision 22703) is where it breaks for me.



By: Russell Bryant (russell) 2006-04-28 12:05:31

The thing that bothers me is that if you're on FC5, then you're obviously building with GNU C.  I also have no idea how my change could have broken this for you.  I am baffled.

I'm tempted to just remove the malloc check, since we're not using the result right now.  However, I think that may be hiding a bigger problem.

By: Russell Bryant (russell) 2006-04-28 12:10:27

Is there any way you might be able to find me on IRC and let me log into your system to play with this?

"russellb", in #asterisk-dev on irc.freenode.net

By: Bradley Watkins (marquis) 2006-04-28 12:12:42

I agree that it may be hiding a bigger problem, so I wouldn't necessarily advocate just disabling malloc/realloc checking.

For what it's worth, if I run autoconf -v it specifically shows AC_FUNC_MALLOC and AC_FUNC_REALLOC returning 1.  I also get the appropriate results if I manually create a .c file containing the test that .configure uses to attempt to determine whether or not malloc(0) returns a valid pointer.

Very odd...

By: Bradley Watkins (marquis) 2006-04-28 12:15:35

Unfortunately, this box is not accessible externally at the moment (I also can't readily get IRC going here).  If there is something specific you would like me to try, and can do it.  Or if there was a bunch of stuff you wanted to hack at, I could see about getting a DMZ up that would allow you access to the box.  Our firewall guys are paranoid... ;)

By: Jeffrey C. Ollie (jcollie) 2006-04-28 14:20:37

I've set Russell up with access to a FC5 box, so hopefully he'll be able to work on the issue inbetween final exams.

By: Andrey S Pankov (casper) 2006-04-28 15:15:32

ia64?

By: Jeffrey C. Ollie (jcollie) 2006-04-28 15:24:02

No, it's not an ia64 box.  Just a plain 'ol Pentium 4.

By: Bradley Watkins (marquis) 2006-04-28 15:51:36

And if the question was directed at me, mine isn't IA64 either.  It's a DP P4 Xeon (Dell 2850 to be exact).

By: Andrey S Pankov (casper) 2006-04-28 16:15:57

Anyway that should be handled in astmm and utils. It we check (re|m)alloc argument
not to be zero then everything should be ok.

Does anybody know other differencies in how they perform?

By: Jared Smith (jsmith) 2006-04-28 16:31:45

I've got a 64-bit (x86_64) Fedora Core 5 system, if Russell (or one of the other developers) wants access to it to help debug this problem.  Just let me know...

By: Russell Bryant (russell) 2006-04-28 19:04:45

I think I found the problem.  Please try the attached patched to verify this was it.

By: Russell Bryant (russell) 2006-04-29 08:33:37

I went ahead and committed this to the trunk.  I'm fairly certain this was the problem, but even if its not, this needs to be there, anyway.  Once you get a chance to verify if the latest trunk fixes your problem, we can close the bug.  :)

By: Bradley Watkins (marquis) 2006-04-29 16:38:15

Yes, that fixes the issue.  Feel free to close this bug.  Thanks!

By: Russell Bryant (russell) 2006-04-29 18:43:35

yay!