[Home]

Summary:ASTERISK-11712: [patch] Cannot compile asterisk with DONT_OPTIMIZE on a 2.4 kernel and an old version of Slackware
Reporter:Francesco Romano (francesco_r)Labels:
Date Opened:2008-03-24 11:11:36Date Closed:2008-05-23 16:15:29
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Utilities/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20080505__bug12289.diff.txt
( 1) 20080512__bug12289.diff.txt
( 2) 20080516__bug12289.diff.txt
( 3) config.log
( 4) nooptcompile2.txt
Description:I use Slackware 11 (gcc 3.4.6)

  [CC] chan_phone.c -> chan_phone.o
In file included from /usr/src/asterisk-1.4/include/asterisk/cdr.h:49,
                from /usr/src/asterisk-1.4/include/asterisk/channel.h:115,
                from chan_phone.c:57:
/usr/src/asterisk-1.4/include/asterisk/utils.h: In function `_ast_asprintf':
/usr/src/asterisk-1.4/include/asterisk/utils.h:476: sorry, unimplemented: functi               on '_ast_asprintf' can never be inlined because it uses variable argument lists
make[1]: *** [chan_phone.o] Error 1
Comments:By: Tilghman Lesher (tilghman) 2008-03-24 12:12:23

That's actually a bug in gcc 3, which has been fixed in gcc 4.  Please upgrade.

By: David Woolley (davidw) 2008-03-25 08:53:21

I was going to report this one as well.  I'm reluctant to change a key component of Slackware 11 to one that I'll have to manage manually.

Does the fix in gcc 4 actually make it inline the code, or does it simply stop it complaining?

By: Tilghman Lesher (tilghman) 2008-03-25 11:50:58

I believe it actually inlines the code properly.

By: Tilghman Lesher (tilghman) 2008-03-25 12:10:30

You could try this, to turn off inlining of that one function under GCC 3.

By: David Woolley (davidw) 2008-03-27 05:20:00

The inlining macro is more complex than it looks.  Firstly there is a macro parameter delimiter comma at the end of the prototype, but even removing that causes a missing prototype error later in the compilation.  There may be an alternative macro that does the prototyping but not the inlining.  I'll have to look for that.

By: Tilghman Lesher (tilghman) 2008-05-05 17:01:40

New patch uploaded that tests for the capability via autoconf.  This needs testing by someone using gcc 3.4 to ensure that it works.

By: David Woolley (davidw) 2008-05-05 17:25:41

Unfortunately it gives a multiple definition error for _ast_astprintf.  See attached typescript of build (actually a second build, so the successful steps aren't included).

By: Tilghman Lesher (tilghman) 2008-05-06 15:59:41

Okay, I have been unable to get Slackware 11 to install, and given that it's a 2.4 kernel, which we don't support anyway, you have two choices:  either you can figure out what is wrong with this patch, and we'll make it work, OR we can close this issue as a "won't fix".

By: Francesco Romano (francesco_r) 2008-05-07 11:15:07

With Slackware 10 and 11 you can select the kernel version to install. Default is 2.4 but all my installations use the alternative 2.6.17.13 (packaged with Slackware). So the corrected subject is not true. The problem it's only with gcc 3.4 , as i wrote in the initial report.

By: Tilghman Lesher (tilghman) 2008-05-07 11:41:46

Regardless, I am not going to expend any more effort trying to test Slackware 11.  Fix or close?

By: David Woolley (davidw) 2008-05-07 12:05:26

I'll have a look at it in the next few days.  It's on my home system (where I only have the one machine, so I don't want to be continually rebooting or installing new OSes) so it is subject to finding evening and weekend time.

By: David Woolley (davidw) 2008-05-11 15:20:39

Take the LOW_MEMORY case branch from AST_INLINE_API  and copy it to create a new macro with the same parameters.  I declared this in utils.h, but one could argue that it should be in inline_api.h

In utils.h, make the first compiler version 3 test select between calling AST_INLINE_API and calling the new macro.  The function declaration can be moved out of the conditional and the second conditional, on the closing ")" is not needed.

Sorry, I can't give the actual patch (potentially "work for hire" and Digium's position on trivial patches).

By: Tilghman Lesher (tilghman) 2008-05-12 11:19:14

Are you saying that the define for LOW_MEMORY works for you?

By: David Woolley (davidw) 2008-05-12 11:26:20

I didn't actually try defining LOW_MEMORY, but the way I read the code, doing so would be a workaround, if you completely reverted the patch.

What LOW_MEMORY does is to inhibit inlining, but the macro still needs to generate the actual body in only one place.  What my extra macro did was to allow one to effectively force the LOW_MEMORY behaviour in just the problem case, so that one didn't inhibit inlining elsewhere.

By: Tilghman Lesher (tilghman) 2008-05-12 15:56:00

Okay, new patch.  Once again, I cannot test, so I need your feedback.

By: David Woolley (davidw) 2008-05-13 02:15:29

You need to do the configure test with optimisation off.  Sorry I don't have time to try changing configure, but manually removing the "can inline variadics" flag from autoconfig.h results in a good compile.

My guess is that, with optimisation on, the compiler ignores inline hints and inlines everything that it thinks would benefit.



By: Tilghman Lesher (tilghman) 2008-05-16 13:58:14

Okay, one more try.  There's not a good way to change the optimization, so hopefully by making it more complex, we can avoid optimization.

By: David Woolley (davidw) 2008-05-18 05:47:43

That didn't help.  However it might be worth noting that <http://gcc.gnu.org/onlinedocs/gcc/Inline.html#Inline> says that varargs is incompatible with inlining in gcc anyway, so I think the difference between compiler versions is that the newer version is generating a warning (which might well be turned off), and the older version was, erroneously, generating an error.

I've noticed that other parts of the code use gcc extensions (blocks as  expresssions, cf. BCPL VALOF), so even, which I suspect id doesn't, standard C allows inlining of variadics, you are constrained by gcc limitations.

As such, the real solution is to declare the functions without inline (which will mean moving them, or wrapping them in the conditional that is used to prevent the generation of multiple out of line copies, in the current code).

By: Tilghman Lesher (tilghman) 2008-05-18 10:19:40

Actually, the newer version ISN'T generating a warning, which makes me think that either gcc is now able to inline variadic functions or else they've automatically avoided inlining on that condition transparently.

I am assigning this to Russell, because if the inlining is ineffective, then the function probably shouldn't be declared AST_INLINE_API at all.

By: David Woolley (davidw) 2008-05-18 11:44:31

-Winline isn't enabled by default, so you wouldn't expect to see the warning.

By: Digium Subversion (svnbot) 2008-05-23 07:24:50

Repository: asterisk
Revision: 118048

U   branches/1.4/include/asterisk/utils.h
U   branches/1.4/main/utils.c

------------------------------------------------------------------------
r118048 | russell | 2008-05-23 07:24:44 -0500 (Fri, 23 May 2008) | 9 lines

Don't declare a function that takes variable arguments as inline, because it's
not valid, and on some compilers, will emit a warning.

http://gcc.gnu.org/onlinedocs/gcc/Inline.html#Inline

(closes issue ASTERISK-11712)
Reported by: francesco_r
Patches by Tilghman, final patch by me

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

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

By: Digium Subversion (svnbot) 2008-05-23 07:31:25

Repository: asterisk
Revision: 118049

_U  trunk/
U   trunk/include/asterisk/utils.h
U   trunk/main/utils.c

------------------------------------------------------------------------
r118049 | russell | 2008-05-23 07:31:20 -0500 (Fri, 23 May 2008) | 17 lines

Merged revisions 118048 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r118048 | russell | 2008-05-23 07:30:53 -0500 (Fri, 23 May 2008) | 9 lines

Don't declare a function that takes variable arguments as inline, because it's
not valid, and on some compilers, will emit a warning.

http://gcc.gnu.org/onlinedocs/gcc/Inline.html#Inline

(closes issue ASTERISK-11712)
Reported by: francesco_r
Patches by Tilghman, final patch by me

........

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

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

By: Digium Subversion (svnbot) 2008-05-23 07:31:57

Repository: asterisk
Revision: 118050

_U  branches/1.6.0/
U   branches/1.6.0/include/asterisk/utils.h
U   branches/1.6.0/main/utils.c

------------------------------------------------------------------------
r118050 | russell | 2008-05-23 07:31:56 -0500 (Fri, 23 May 2008) | 25 lines

Merged revisions 118049 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
r118049 | russell | 2008-05-23 07:37:31 -0500 (Fri, 23 May 2008) | 17 lines

Merged revisions 118048 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r118048 | russell | 2008-05-23 07:30:53 -0500 (Fri, 23 May 2008) | 9 lines

Don't declare a function that takes variable arguments as inline, because it's
not valid, and on some compilers, will emit a warning.

http://gcc.gnu.org/onlinedocs/gcc/Inline.html#Inline

(closes issue ASTERISK-11712)
Reported by: francesco_r
Patches by Tilghman, final patch by me

........

................

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

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

By: Digium Subversion (svnbot) 2008-05-23 16:15:29

Repository: asterisk
Revision: 118162

_U  team/seanbright/resolve-shadow-warnings/
U   team/seanbright/resolve-shadow-warnings/CHANGES
U   team/seanbright/resolve-shadow-warnings/apps/app_chanisavail.c
U   team/seanbright/resolve-shadow-warnings/apps/app_voicemail.c
U   team/seanbright/resolve-shadow-warnings/channels/chan_gtalk.c
U   team/seanbright/resolve-shadow-warnings/channels/chan_usbradio.c
U   team/seanbright/resolve-shadow-warnings/channels/chan_vpb.cc
A   team/seanbright/resolve-shadow-warnings/configs/pbx_realtime.conf
A   team/seanbright/resolve-shadow-warnings/doc/cli.txt
U   team/seanbright/resolve-shadow-warnings/include/asterisk/utils.h
U   team/seanbright/resolve-shadow-warnings/main/utils.c
U   team/seanbright/resolve-shadow-warnings/pbx/pbx_realtime.c
U   team/seanbright/resolve-shadow-warnings/res/res_jabber.c
U   team/seanbright/resolve-shadow-warnings/res/res_odbc.c

------------------------------------------------------------------------
r118162 | seanbright | 2008-05-23 16:15:24 -0500 (Fri, 23 May 2008) | 127 lines

Merged revisions 117983,117986,117988,118020,118049,118053,118059,118101,118129,118157,118159 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
r117983 | tilghman | 2008-05-22 17:27:00 -0400 (Thu, 22 May 2008) | 2 lines

Fix trunk breakage

................
r117986 | tilghman | 2008-05-22 17:42:50 -0400 (Thu, 22 May 2008) | 2 lines

Add a compatibility option for upgrading realtime extensions

................
r117988 | seanbright | 2008-05-22 17:43:54 -0400 (Thu, 22 May 2008) | 1 line

Split the compile flags out and wire up some dependencies
................
r118020 | phsultan | 2008-05-23 06:33:21 -0400 (Fri, 23 May 2008) | 15 lines

- remove whitespaces between tags in received XML packets before giving
them to the parser ;
- report Gtalk error messages from a buddy to the console.

This patch makes Asterisk "Google Jingle" (chan_gtalk) implementation
work with Empathy. Note that this is only true for audio streams, not
video.

Thank you to PH for his great help!

(closes issue ASTERISK-12017)
Reported by: PH
Patches:
     trunk-12647-1.diff uploaded by phsultan (license 73)
Tested by: phsultan, PH
................
r118049 | russell | 2008-05-23 08:37:31 -0400 (Fri, 23 May 2008) | 17 lines

Merged revisions 118048 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r118048 | russell | 2008-05-23 07:30:53 -0500 (Fri, 23 May 2008) | 9 lines

Don't declare a function that takes variable arguments as inline, because it's
not valid, and on some compilers, will emit a warning.

http://gcc.gnu.org/onlinedocs/gcc/Inline.html#Inline

(closes issue ASTERISK-11712)
Reported by: francesco_r
Patches by Tilghman, final patch by me

........

................
r118053 | tilghman | 2008-05-23 09:00:10 -0400 (Fri, 23 May 2008) | 11 lines

Merged revisions 118052 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r118052 | tilghman | 2008-05-23 07:59:16 -0500 (Fri, 23 May 2008) | 3 lines

Add information on using the Asterisk console, including tab command line
completion.  (Closes issue ASTERISK-12044)

........

................
r118059 | tilghman | 2008-05-23 09:20:13 -0400 (Fri, 23 May 2008) | 9 lines

Blocked revisions 118055 via svnmerge

........
r118055 | tilghman | 2008-05-23 08:18:44 -0500 (Fri, 23 May 2008) | 2 lines

Add format type checking for recently de-inlined function

........

................
r118101 | mvanbaak | 2008-05-23 13:12:04 -0400 (Fri, 23 May 2008) | 15 lines

add option 'a' to chanisavail.
If you give chanisavail a list of channels, it will only
return the first available channel.
When this option is set, it will return all the available
channels from the given list.

(closes issue ASTERISK-11673)
Reported by: dagmoller
Patches:
     app_chanisavail-snv.patch-v2.txt uploaded by dagmoller (license 436)
  - major changes by me because russellb pointed out some buffer overflows
    and codeguideline issues.
Converted it all to the ast_str_* api
Tested by: dagmoller, mvanbaak

................
r118129 | tilghman | 2008-05-23 14:09:14 -0400 (Fri, 23 May 2008) | 3 lines

Protect the object from changing while the 'odbc show' CLI command is running
(Closes issue ASTERISK-12065)

................
r118157 | mmichelson | 2008-05-23 15:57:40 -0400 (Fri, 23 May 2008) | 10 lines

Use a deep copy on strings that come from ast_events. Otherwise it is
likely that after the event is freed, we no longer refer to valid memory.

(closes issue ASTERISK-12073)
Reported by: tomo1657
Patches:
     12712.patch uploaded by putnopvut (license 60)
Tested by: tomo1657


................
r118159 | mmichelson | 2008-05-23 16:55:02 -0400 (Fri, 23 May 2008) | 4 lines

Get rid of warnings for those silly compilers which warn when freeing
a const pointer


................

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

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