[Home]

Summary:ASTERISK-22559: gcc 4.6 and higher supports weakref attribute but asterisk doesn't detect it.
Reporter:ibercom (ibercom)Labels:
Date Opened:2013-09-19 16:36:03Date Closed:2015-06-10 12:25:41
Priority:MajorRegression?
Status:Closed/CompleteComponents:Core/General
Versions:1.8.23.0 11.17.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Debian WheezyAttachments:( 0) config.log
( 1) config.log
( 2) make.log
( 3) menuselect.makeopts
Description:Server running Debian Squeeze and Asterisk 1.8.23. After server upgrading from Debian 6 to Debian 7 with the same configuration asterisk don't load app_voicemail.so and chan_dahdi.so

Asterisk compiles fine, make menuselect without res_adsi and res_smdi. The modules don't exist.

Asterisk logs when start:

[Sep 19 15:17:08] WARNING[7490] loader.c: Error loading module 'res_adsi': /usr/lib/asterisk/modules/res_adsi.so: cannot open shared object file: No such file or directory
[Sep 19 15:17:08] WARNING[7490] loader.c: Module 'res_adsi' could not be loaded.
[Sep 19 15:17:08] WARNING[7490] loader.c: Error loading module 'res_smdi': /usr/lib/asterisk/modules/res_smdi.so: cannot open shared object file: No such file or directory
[Sep 19 15:17:08] WARNING[7490] loader.c: Module 'res_smdi' could not be loaded.
[Sep 19 15:17:08] WARNING[7490] loader.c: Error loading module 'app_voicemail.so': /usr/lib/asterisk/modules/app_voicemail.so: undefined symbol: ast_smdi_mwi_set
[Sep 19 15:17:08] WARNING[7490] loader.c: Module 'app_voicemail.so' could not be loaded.
[Sep 19 15:17:08] WARNING[7490] loader.c: Error loading module 'res_smdi': /usr/lib/asterisk/modules/res_smdi.so: cannot open shared object file: No such file or directory
[Sep 19 15:17:08] WARNING[7490] loader.c: Module 'res_smdi' could not be loaded.
[Sep 19 15:17:08] WARNING[7490] loader.c: Error loading module 'chan_dahdi.so': /usr/lib/asterisk/modules/chan_dahdi.so: undefined symbol: ast_smdi_interface_unref
[Sep 19 15:17:08] WARNING[7490] loader.c: Module 'chan_dahdi.so' could not be loaded.
[Sep 19 15:17:08] WARNING[7490] loader.c: Error loading module 'res_adsi': /usr/lib/asterisk/modules/res_adsi.so: cannot open shared object file: No such file or directory
[Sep 19 15:17:08] WARNING[7490] loader.c: Module 'res_adsi' could not be loaded.
Comments:By: ibercom (ibercom) 2013-09-19 16:37:29.698-0500

Related to ASTERISK-19920


By: ibercom (ibercom) 2013-09-22 14:01:04.188-0500

Testing with:

/usr/bin/gcc-4.7   Error - Fail chan_dahdi.so and app_voicemail.so
/usr/bin/gcc-4.6   Error - Fail chan_dahdi.so and app_voicemail.so
/usr/bin/gcc-4.4   Ok    - Load all


By: Rusty Newton (rnewton) 2013-09-26 16:59:52.862-0500

Can you post the config.log from the source directory you built in? (More Options > Attach Files)

By: Rusty Newton (rnewton) 2013-10-25 18:09:04.263-0500

After upgrading Debian did you make uninstall-all Asterisk, and then re-build and re-install DAHDI and Asterisk in that order?

Now that I've re-read your description. It is a little confusing.

With the latest Debian and gcc 4.7, do you have any failures during compilation of DAHDI or Asterisk? If no, then which modules at that point do not load when starting Asterisk? (please verify those modules were built since the upgrade, and not before)

By: ibercom (ibercom) 2013-10-28 17:37:11.481-0500

I have downloaded asterisk-1.8.24.0.tar.gz
I have run:
- configure
Here I copy my menuselect.makeopts file in asterisk dir
- make
It didn't finish successfully:
make: *** [menuselect.makeopts] Error 255


By: ibercom (ibercom) 2013-10-28 17:38:44.484-0500

New config.log file
menuselect.makeopts
make.log


By: Rusty Newton (rnewton) 2013-10-31 09:52:25.569-0500

You didn't answer my questions regarding DAHDI.

After upgrading Debian did you make uninstall-all Asterisk, and then re-build and re-install DAHDI and Asterisk in that order?

Were there any failures in compilation of DAHDI as well?

By: Matt Jordan (mjordan) 2013-10-31 11:13:30.370-0500

This is quickly turning into a support request.

The errors in the make log tell you what is going on and how to fix the problem:

{noformat}
***********************************************************
 The existing menuselect.makeopts file did not specify
 that 'res_snmp' should not be included.  However, either some
 dependencies for this module were not found or a
 conflict exists.

 Either run 'make menuselect' or remove the existing
 menuselect.makeopts file to resolve this issue.
***********************************************************
{noformat}

Your make options that you selected in menuselect are no longer valid, as dependencies that used to be found for the module no longer exist per your {{config}} script. You need to either re-run menuselect, or delete {{menuselect.makeopts}}.

By: ibercom (ibercom) 2013-11-01 13:29:40.830-0500

Rusty Newton:
Yes, after upgrading I uninstall-all Asterisk, and then re-build and re-install DAHDI, LIBPRI and Asterisk in that order.
DAHDI compiles fine with gcc-4.7. LIBPRI too.
The same operations are good for gcc-4.4 and Asterisk. Not for gcc-4.7.
It seems that 'app_voicemail' and 'chan_dahdi':
  Depends on: res_adsi(M), res_smdi(M)   ---> gcc-4.7
Instead of:
  Can use: res_adsi(M), res_smdi(M)      ---> gcc-4.4

Matt Jordan:
The problem is the "dependencies" of such modules with gcc-4.7.
menuselect.makeopts file always is the same with gcc-4.4 and gcc-4.7
You must not have in mind 'res_snmp'. It is a little bug mine.


By: Rusty Newton (rnewton) 2013-11-14 12:52:50.998-0600

I tested with a clean install of Debian 7.2 in VirtualBox

* gcc 4.7.2
* DAHDI complete 2.8.0-rc1+2.8.0-rc1
* libpri 1.4.14
* asterisk 1.8.25.0-rc1

I built and installed DAHDI, libpri, then used the /contrib/scripts/install_prereq script for Asterisk dependencies, then installed Asterisk with menuselect defaults.

chan_dahdi and app_voicemail build and load up fine, as well as the other modules mentioned.

Closing this out as "Not A Bug" since we can't reproduce it and it's likely a environment/dependency issue for your particular situation.

If you have further questions or discussion, the appropriate place to resolve it is on the asterisk-users list or the forums where others can help out.

By: ibercom (ibercom) 2013-11-14 15:25:20.276-0600

"I built and installed DAHDI, libpri, then used the /contrib/scripts/install_prereq script for Asterisk dependencies, then installed Asterisk with menuselect defaults.

chan_dahdi and app_voicemail build and load up fine, as well as the other modules mentioned."

>>> The problem is when you don't want menuselect defaults. I don't want compile some modules. <<<

The problem is that 'app_voicemail' and 'chan_dahdi' depend on: res_adsi(M), res_smdi(M) in gcc-4.7. They don't depend on: res_adsi(M), res_smdi(M) in gcc-4.4

Needs chan_dahdi res_adsi or res_smdi ?
Needs app_voicemail res_adsi or res_smdi ?

If this is so it isn't a bug. I'm sorry.


By: ibercom (ibercom) 2013-12-08 12:06:16.299-0600

I think so than I found the problem.

Debian 7 with gcc 4.7 supports weakref attribute but asterisk DOESN'T detect it.

The patch is simple and it is seen here https://reviewboard.asterisk.org/r/1330/diff/

1) You need ';' as attribute's body with weakref attribute.

2) You need '{return (void *) 0;}' as attribute's body in the other cases.

"...weakref seems to be meaningless for a function with a complete definition, and hence I change $2 to be a flag: if its value is 'no', the function has no body."


By: ibercom (ibercom) 2015-04-08 14:11:38.968-0500

weakref attribute -> detection broken with gcc 4.6 and higher.

GCC 4.7 Manual:
http://gcc.gnu.org/onlinedocs/gcc-4.7.4/gcc/Function-Attributes.html

Here you can read:
weakref ("target")
{code}
static int x() __attribute__ ((weakref ("y")));
{code}
A weak reference is an alias that does not by itself require a definition to be given for the target symbol.

Hence the error in config.log:
{code}
configure:16034: checking for compiler 'attribute weakref' support
configure:16080: gcc -c -g -O2 -Wall -Wno-unused -Werror  conftest.c >&5
conftest.c:215:46: error: 'weakref' attribute ignored because function is defined [-Werror=attributes]
{code}

To test weakref attribute you only need this function:
{code}
static void __attribute__((weakref("foo"))) *test(void *muffin, ...) ;
{code}
and not:
{code}
static void __attribute__((weakref("foo"))) *test(void *muffin, ...) {return (void *) 0;}
{code}