Summary:ASTERISK-10948: Compiling Asterisk --with-imap support fails
Reporter:Leif Madsen (lmadsen)Labels:
Date Opened:2007-12-02 20:35:00.000-0600Date Closed:2007-12-20 17:40:10.000-0600
Versions:Frequency of
Description:When compiling against the imap-2006k library on CentOS 5, 64-bit, I get the following:

  [CC] app_voicemail.c -> app_voicemail.o
In file included from /usr/local/src/imap-2006k/c-client/osdep.h:63,
                from /usr/local/src/imap-2006k/c-client/c-client.h:42,
                from app_voicemail.c:84:
/usr/local/src/imap-2006k/c-client/env_unix.h:71: warning: function declaration isnâ??t a prototype
app_voicemail.c: In function â??apply_optionâ??:
app_voicemail.c:719: error: too few arguments to function â??ast_logâ??
app_voicemail.c:733: warning: passing argument 3 of â??ast_logâ?? makes integer from pointer without a cast
app_voicemail.c:733: warning: passing argument 4 of â??ast_logâ?? makes pointer from integer without a cast
app_voicemail.c:733: error: too few arguments to function â??ast_logâ??
app_voicemail.c:739: error: too few arguments to function â??ast_logâ??
app_voicemail.c:743: warning: passing argument 3 of â??ast_logâ?? makes integer from pointer without a cast
app_voicemail.c:743: warning: passing argument 4 of â??ast_logâ?? makes pointer from integer without a cast
make[1]: *** [app_voicemail.o] Error 1
make: *** [apps] Error 2


I'm not entirely sure where this error lies, but can provide access to a box if that is useful.
Comments:By: Leif Madsen (lmadsen) 2007-12-03 16:32:05.000-0600

Hrmmmm... seems to compile into 1.4, but not trunk... so something I guess has changed?

Gonna try on a 32-bit machine and see if it's a 64-bit-ism

By: Leif Madsen (lmadsen) 2007-12-03 18:01:22.000-0600

After talking with Paul about this, he noticed that because we're including logger.h in asterisk.h, when we do the IMAP_STORAGE in app_voicemail.c, it seems to be overwriting what Asterisk thinks the LOG_WARNING should be defined as, and thus changing the format that is being passed to ast_log().

If I moved the #ifdef IMAP_STORAGE block to ABOVE #include asterisk.h, then app_voicemail.c compiles with no errors. I do end up with:

In file included from /usr/local/src/imap-2006k/c-client/osdep.h:63,
                from /usr/local/src/imap-2006k/c-client/c-client.h:42,
                from app_voicemail.c:73:
/usr/local/src/imap-2006k/c-client/env_unix.h:71: warning: function declaration isnâ??t a prototype
app_voicemail.c: In function â??forward_messageâ??:
app_voicemail.c:4287: warning: passing argument 3 of â??imap_retrieve_fileâ?? discards qualifiers from pointer target type
  [LD] app_voicemail.o -> app_voicemail.so

Not sure if that is an issue or not. I haven't tried connecting with any IMAP servers yet, so we'll see what happens.

Is this a real fix?

By: Mark Michelson (mmichelson) 2007-12-04 11:41:24.000-0600

The first warning, from env_unix.h, is from within the IMAP toolkit code, and is not an issue, nor is it our responsibility to fix.

The second one, regarding discarding qualifiers from a pointer, I will look at more closely.

By: Mark Michelson (mmichelson) 2007-12-04 12:11:56.000-0600

Revision 90928 should clear that second warning.

By: Leif Madsen (lmadsen) 2007-12-09 18:52:59.000-0600

Setting this to feedback since it should trigger to me to test this and verify the fix.

By: James Rothenberger (jaroth) 2007-12-12 13:34:59.000-0600

I have the same problems (in a trunk that I checked out today - 92526), and moving the IMAP includes above the asterisk includes does fix this problem.  I was about to submit a patch for this, should I?  

You are correct, the imap toolkit also defines LOG_WARNING as the integer '4'.  This creates the conflict.

By: Mark Michelson (mmichelson) 2007-12-14 16:09:21.000-0600

I also have recently started having this problem too. I attempted moving the includes of the IMAP-related code above the include of asterisk.h but this did not work for me. I was able to get a successful compilation by moving the IMAP-related includes to INSIDE of asterisk.h, but I feel this is not a sensible solution.

What versions of gcc are you using, blitzrage and jaroth?

By: James Rothenberger (jaroth) 2007-12-14 16:11:53.000-0600

gcc version 3.4.6 20060404 (Red Hat 3.4.6-8)

By: Mark Michelson (mmichelson) 2007-12-14 16:39:56.000-0600

For the record, I'm using gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4).

If I had to guess which version of gcc blitzrage is using, it would probably be 4.1.1 (since he is using CentOS 5). Qwell confirmed that he fixed the issue the same way as the two of you and he's using 4.1.2 too, so I think I'm barking up the wrong tree with the compiler version idea.

I guess there's some other factor in my environment which is causing the problem. I'll try to figure it out.

By: Leif Madsen (lmadsen) 2007-12-20 17:25:11.000-0600

FYI: using gcc 4.1.2 on CentOS 5

I tried the test again by moving the ifdef block above asterisk.h, and it still seems to work for me in latest trunk.

Not sure how else to fix this... but I'm no coder :)

By: Digium Subversion (svnbot) 2007-12-20 17:40:10.000-0600

Repository: asterisk
Revision: 94345

U   trunk/apps/app_voicemail.c

r94345 | mmichelson | 2007-12-20 17:40:10 -0600 (Thu, 20 Dec 2007) | 8 lines

The changes to header inclusion in trunk broke compilation of app_voicemail when using
IMAP storage. The reason is that c-client has its own definitions for LOG_WARNING
and LOG_DEBUG, so we need to be sure to include asterisk's definitions last so that
we use the proper values in app_voicemail.

(closes issue ASTERISK-10948, reported by blitzrage, patch suggested by blitzrage)