Summary:ASTERISK-21720: Asterisk 11 cannot compile with multiple definitions. Possible libasteriskssl + openssl issue.
Reporter:Boris (raidenz)Labels:
Date Opened:2013-04-28 23:22:18Date Closed:2017-12-13 09:13:29.000-0600
Versions:11.1.2 11.2.1 11.2.2 Frequency of
Environment:Gcc 4.8, openssl 1.0.1.e, uname -m = x86_64 uname -r = 3.9.0-rc8 uname -s = Linux uname -v = #2 SMP Sun Apr 21 23:07:19 CDT 2013Attachments:( 0) config.log.txt
( 1) makenoisybuild.txt
Description:It seems when compiling with and without --disable-asteriskssl, It always fails at the same place building. I have even tried building asterisk 11 from the latest SVN repo. Still fails at the same place.

make[1]: Leaving directory `/tmp/asterisk-11/menuselect'
  [LD] abstract_jb.o acl.o adsi.o alaw.o aoc.o app.o ast_expr2.o ast_expr2f.o asterisk.o astfd.o astmm.o astobj2.o audiohook.o autochan.o autoservice.o bridging.o callerid.o ccss.o cdr.o cel.o channel.o channel_internal_api.o chanvars.o cli.o config.o config_options.o data.o datastore.o db.o devicestate.o dial.o dns.o dnsmgr.o dsp.o enum.o event.o features.o file.o fixedjitterbuf.o format.o format_cap.o format_pref.o frame.o framehook.o fskmodem.o global_datastores.o hashtab.o heap.o http.o image.o indications.o io.o jitterbuf.o libasteriskssl.o loader.o lock.o logger.o manager.o md5.o message.o named_acl.o netsock.o netsock2.o pbx.o plc.o poll.o presencestate.o privacy.o rtp_engine.o say.o sched.o security_events.o sha1.o sip_api.o slinfactory.o srv.o stdtime/localtime.o strcompat.o strings.o stun.o syslog.o taskprocessor.o tcptls.o tdd.o term.o test.o threadstorage.o timing.o translate.o udptl.o ulaw.o utils.o version.o xml.o xmldoc.o editline/libedit.a  -> asterisk
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../lib64/libcrypto.a(cryptlib.o): In function `CRYPTO_set_locking_callback':
(.text+0x150): multiple definition of `CRYPTO_set_locking_callback'
libasteriskssl.o:/tmp/asterisk-11/main/libasteriskssl.c:133: first defined here
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../lib64/libcrypto.a(cryptlib.o): In function `CRYPTO_set_id_callback':
(.text+0x270): multiple definition of `CRYPTO_set_id_callback'
libasteriskssl.o:/tmp/asterisk-11/main/libasteriskssl.c:124: first defined here
/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../lib64/libcrypto.a(err.o): In function `ERR_free_strings':
(.text+0x1110): multiple definition of `ERR_free_strings'
libasteriskssl.o:/tmp/asterisk-11/main/libasteriskssl.c:142: first defined here
collect2: error: ld returned 1 exit status

It looks like something in libasteriskssl is also defined in openssl (1.0.1e) that is making it fail.
Comments:By: Rusty Newton (rnewton) 2013-04-30 19:08:00.874-0500

Can you attach the config.log and the output of make NOISY_BUILD=yes?

By: Boris (raidenz) 2013-04-30 20:30:12.311-0500

Done but it complains when trying to upload files so here's link to both files.

config.log -> http://goo.gl/2V5Ny
make NOISY_BUILD=yes -> http://goo.gl/fsvnr

By: Rusty Newton (rnewton) 2013-05-06 19:47:13.383-0500


Done but it complains when trying to upload files so here's link to both files

You shouldn't be getting an error when uploading..

What error do you get when attempting to upload the files?

By: Rusty Newton (rnewton) 2013-05-06 19:58:45.764-0500

Neither of your links works for me, I'm getting temporarily unavailable or busy. Can you try to attach the files again and let us know what error you are getting?

By: Boris (raidenz) 2013-05-06 21:25:58.138-0500

Sorry, The link was getting old. Try it again.

By: Boris (raidenz) 2013-05-07 16:49:35.448-0500

It looks like there might be the same definitions defined in both openssl's libcrypto and asterisk's libasteriskssl library which is causing the problems. I think libasteriskssl might need extra if not defined options in the code for those functions?

By: Matt Jordan (mjordan) 2013-05-07 17:03:54.402-0500

That's actually the point of libasteriskssl.

That library actually prevents a number of rather nasty bugs that happen when multiple libraries attempt to initialize OpenSSL at the same time. It intercepts these calls and ensures that they only occur once. It also manages some locking issues that multiple libraries using OpenSSL can run into.

Asterisk uses OpenSSL; a number of libraries that Asterisk uses also use OpenSSL. Someone has to initialize it; Asterisk ensures that only one does.

By: Rusty Newton (rnewton) 2013-05-07 17:09:14.159-0500

Attaching reporter's debug to the issue.

By: Boris (raidenz) 2013-05-07 23:22:17.639-0500

if "if not defined then" option might not work. What about renaming those functions in libasteriskssl to prevent the duplicate functions? The duplication might be because the latest version of openssl might have those function definitions already.

By: Rusty Newton (rnewton) 2013-05-13 17:30:25.642-0500

Have you tried using an older version of openssl to see if the failure differs?

I'm in Ubuntu land. I don't have the issue on 3.2.0-39-generic #62-Ubuntu x86_64 with their package: openssl 1.0.1-4ubuntu5.8

By: Boris (raidenz) 2013-05-13 21:14:51.592-0500

I just built openssl 1.0.1d, and even openssl 1.0.0a and it gives the SAME error. If I compile openssl 0.9.8y (0.9.8 series) and then build asterisk 11 from svn, it compiles without any issues. It seems to be an error occurs with anything 1.0.0 or higher. The weird part is that I can compile asterisk 10 from SVN with the latest openssl 1.0.1e without any issues, just not asterisk 11 from SVN.

By: Matt Jordan (mjordan) 2013-05-21 09:07:21.322-0500

{{libasteriskssl}} was added in Asterisk 11.

That being said, I'm running with OpenSSL 1.0.1c and have no compilation issues.

By: Corey Farrell (coreyfarrell) 2017-12-13 09:13:29.608-0600

I believe this issue has been fixed in currently supported Asterisk releases.


Per the Asterisk versions page [1], the maintenance (bug fix) support for the Asterisk branch you are using has ended. For continued maintenance support please move to a supported branch of Asterisk. After testing with a supported branch, if you find this problem has not been resolved, please open a new issue against the latest version of that Asterisk branch.


[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Versions