[Home]

Summary:ASTERISK-23711: Asterisk does not compile when HAVE_PJ_TRANSACTION_GRP_LOCK is not defined
Reporter:Marcello Ceschia (marcelloceschia)Labels:
Date Opened:2014-05-02 14:01:45Date Closed:2015-01-19 10:27:45.000-0600
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Resources/res_pjsip
Versions:12.2.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:gcc (SUSE Linux) 4.8.1 20130909 pjsip 2.2.1Attachments:( 0) autoconfig.h
( 1) config.log
( 2) config.log
( 3) configure
( 4) obs-build-log-asterisk13-i586.txt
( 5) PJSIP_config.log
Description:{code}
res_pjsip/pjsip_distributor.c: In function ‘find_dialog’:
res_pjsip/pjsip_distributor.c:141:21: error: ‘pjsip_transaction’ has no member named ‘mutex’
 pj_mutex_unlock(tsx->mutex);
                    ^
{code}
Comments:By: Matt Jordan (mjordan) 2014-05-03 22:01:32.402-0500

A few comments/questions:
# Where did you get version of pjsip? Was it from their site, or from the Asterisk github repo?
# In your {{include/asterisk/autoconfig.h}}, what is the value of {{HAVE_PJ_TRANSACTION_GRP_LOCK}}?
# Please attach your {{config.log}}, showing how Asterisk was configured.

By: Marcello Ceschia (marcelloceschia) 2014-05-04 03:54:21.068-0500

1. pjsip cloned from https://github.com/asterisk/pjproject configure flags: --enable-shared --disable-sound --disable-resample --disable-video --disable-opencore-amr --with-external-speex --with-external-gsm --with-external-srtp --disable-g7221-codec --disable-ilbc-codec CFLAGS='-DPJ_HAS_IPV6=1'

2. In include/asterisk/autoconfig.h is not defined

so I checked the configure output and found {noformat}config.status: include/asterisk/autoconfig.h is unchanged {noformat}
After deleting include/asterisk/autoconfig.h and rerun configure HAVE_PJ_TRANSACTION_GRP_LOCK is defined in include/asterisk/autoconfig.h

Nevertheless the problem is, that mutex is not a member of pjsip_transaction, see https://github.com/asterisk/pjproject/blob/master/pjsip/include/pjsip/sip_transaction.h#L90
and the else part generates a compile error.

By: Matt Jordan (mjordan) 2014-05-04 19:34:43.549-0500

You may have previously configured that instance of Asterisk against another version of pjproject. Try a {{make distclean}}, followed by a {{./configure}} and {{make}}.

By: Marcello Ceschia (marcelloceschia) 2014-05-05 09:38:05.769-0500

But the problem is, it does not compile without {{HAVE_PJ_TRANSACTION_GRP_LOCK}}
If {{HAVE_PJ_TRANSACTION_GRP_LOCK}} is required, throw an exception in configure script or do not allow pjsip.
If it is not required, the else part should be fixed.

The issue is also present in svn trunk with a clean installation (open build service)

By: Joshua C. Colp (jcolp) 2014-05-05 09:48:16.006-0500

That's not the problem. The HAVE_PJ_TRANSACTION_GRP_LOCK value is set by the check logic within the configure script. The configure script determines if the pjproject available has support for group locks, if it does then that value is set and used. If it does not have support then the old logic (with direct mutexes) is in use.

If the environment is compromised (pjproject updated but configure hasn't been re-run) then it will not know things have changed and will assume conditions are the same as they were. This also applies for other libraries. As for your comment about the issue being present with OBS - the config.log, environment details, and autoconfig.h would be needed to determine what is going on there.

By: Marcello Ceschia (marcelloceschia) 2014-05-05 09:58:08.068-0500

@Joshua Colp
But it does NOT compile without {{HAVE_PJ_TRANSACTION_GRP_LOCK}}, because there is no member mutex in {{struct pjsip_transaction}}

Please try to compile without {{#define HAVE_PJ_TRANSACTION_GRP_LOCK 1}} in include/asterisk/autoconfig.h

By: Joshua C. Colp (jcolp) 2014-05-05 10:08:01.453-0500

If the pjproject does not have group lock support it will compile. This was added to ease the migration when group lock support was added to our git repo so that everyone was not forced to upgrade immediately.

It won't compile if pjproject has group lock support and HAVE_PJ_TRANSACTION_GRP_LOCK is not set, and that is expected behavior.

What shouldn't happen is that the configure script and build system fails to do the right thing on a clean environment.

By: Marcello Ceschia (marcelloceschia) 2014-05-05 10:52:18.576-0500

{code}
configure:23626: result: no
configure:23657: checking for PJPROJECT
configure:23664: $PKG_CONFIG --exists --print-errors "libpjproject"
configure:23667: $? = 0
configure:23681: $PKG_CONFIG --exists --print-errors "libpjproject"
configure:23684: $? = 0
configure:23728: result: yes
configure:23760: checking for pjsip_tsx_create_uac2 in -lpjsip
configure:23785: gcc -o conftest -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g    conftest.c -lpjsip   -lm  >&5
/usr/lib64/libpj.so.2: undefined reference to `SSLv2_method'
/usr/lib64/libpj.so.2: undefined reference to `SSLv2_server_method'
collect2: error: ld returned 1 exit status
configure:23785: $? = 1
{code}

By: Joshua C. Colp (jcolp) 2014-05-05 10:59:17.181-0500

That looks like some build issue involving pjproject and OpenSSL. This is causing the test for group lock support to fail when it shouldn't.

By: Rusty Newton (rnewton) 2014-05-19 13:45:59.206-0500

[~marcelloceschia]

What version of openssl are you using? We haven't been able to reproduce this yet.

By: Rusty Newton (rnewton) 2014-06-06 08:37:47.018-0500

Suspended due to lack of activity. Please request a bug marshal in #asterisk-bugs on the IRC network irc.freenode.net to reopen the issue should you have the additional information requested.  Further information can be found at http://www.asterisk.org/developers/bug-guidelines



By: Ray Crumrine (proftech) 2014-07-22 20:15:22.385-0500

I am attaching 4 files. the config.logs of both asterisk and pjsip. Also the Asterisk config script that I was using and the resultant autoconfig.h file that was generated. Running Debian 7.5 and Asterisk 12.4. Note that after 4 or 5 tries at compiling it, and examining the notes in ASTERISK-23711, I noticed that they were "checking for pjsip_tsx_create_uac2 in -lpjsip" in the log. So I checked my log and saw that the test passed. So I went ahead and manually entered the define in autoconfig.h as you will see. After doing this it compiled with no problem and is now in use. Also, not sure if it means anything or not but when I initially ran the Asterisk configure script I was using the command line "./configure --with-pjproject" as shown in the article by Matt Jordan for the Raspberry PI since both systems supposedly run the same operating system. Then I thought I noticed where the switch "with-pjproject" was supposed to have an = and a path after it. Since I wasn't sure if that might be causing a problem, you will see in the log that the last time I ran it I left off that switch. It didn't seem to make any difference one way or the other. Note that I tried using both the "official" git version of PJSIP and v2.2.1 from the PJ SIP web site and both gave the same result. Also note that I previously used these same tar files to install every thing on my x86 computer running Debian 7.5 and it worked ok on the x86. So it seems the issue may be tied to the ARMHF version ??? This was a fresh install of everything on a BeagleBone Black Rev C.

By: Marcello Ceschia (marcelloceschia) 2014-08-16 12:57:03.309-0500

This issue always happens when pjproject is compiled with the default ssl support.

{code}
configure:23677: checking for PJPROJECT
configure:23684: $PKG_CONFIG --exists --print-errors "libpjproject"
configure:23687: $? = 0
configure:23701: $PKG_CONFIG --exists --print-errors "libpjproject"
configure:23704: $? = 0
configure:23748: result: yes
configure:23780: checking for pjsip_tsx_create_uac2 in -lpjsip
configure:23805: gcc -o conftest -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DPJ_AUTOCONF=1 -DPJ_HAS_IPV6=1 -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1 -fPIC    conftest.c -lpjsip  -lpjsua -lpjsip-ua -lpjsip-simple -lpjsip -lpjmedia-codec -lpjmedia -lpjmedia-videodev -lpjmedia-audiodev -lpjmedia -lpjnath -lpjlib-util -lsrtp -lgsm -lspeex -lspeexdsp -lpj -lm -lrt -lpthread -lcrypto -lssl  -lm  >&5
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/libpj.so: undefined reference to `SSLv2_method'
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../lib64/libpj.so: undefined reference to `SSLv2_server_method'
collect2: error: ld returned 1 exit status
configure:23805: $? = 1
{code}

With --disable-ssl as configure option in pjproject, the build will be fine.
openssl version: 1.0.1h

By: Walter Doekes (wdoekes) 2014-08-16 15:38:51.845-0500

Try this patch to pjproject:

http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20140816/eb270c60/attachment.patch

By: Walter Doekes (wdoekes) 2014-08-19 01:48:34.550-0500

(Has been committed in pjproject r4892.)

By: Walter Doekes (wdoekes) 2014-10-09 05:27:32.421-0500

Marcello: can we close this?

By: Marcello Ceschia (marcelloceschia) 2014-10-09 16:07:05.558-0500

At the moment I do have much time to test this on an other clean installation, but we see some issue on open build service that uses an clean installation. https://build.opensuse.org/package/live_build_log/home:chan-sccp-b:asterisk-13/asterisk/openSUSE_Factory/i586
I think we can close the issue for the moment and we can reopen this when I checked this an an clean installation.

By: Walter Doekes (wdoekes) 2014-10-09 16:17:48.649-0500

Problem appears solved by updating pjproject.

Thanks for the feedback.

By: Marcello Ceschia (marcelloceschia) 2014-10-10 02:54:31.066-0500

build log from open build service

By: Marcello Ceschia (marcelloceschia) 2014-10-10 02:55:54.244-0500

Sorry this issue is not solve with the new pjproject, see obs-build-log-asterisk13-i586.txt


By: Walter Doekes (wdoekes) 2014-10-10 03:00:58.873-0500

Ok. Reopening. But that log file you just uploaded tells me nothing.

By: Marcello Ceschia (marcelloceschia) 2014-10-10 03:17:02.711-0500

What do you need?
Just rebuilding with config.log output

By: Walter Doekes (wdoekes) 2014-10-10 04:29:05.037-0500

Your config.log says this:
{noformat}
[  154s] configure:23780: checking for pjsip_tsx_create_uac2 in -lpjsip
[  154s] configure:23805: gcc -o conftest -fomit-frame-pointer -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DPJ_AUTOCONF=1 -DPJ_HAS_IPV6=1 -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1 -fPIC    conftest.c -lpjsip  -lpjsua2 -lstdc++ -lpjsua -lpjsip-ua -lpjsip-simple -lpjsip -lpjmedia-codec -lpjmedia -lpjmedia-videodev -lpjmedia-audiodev -lpjmedia -lpjnath -lpjlib-util -lsrtp -lgsm -lspeex -lspeexdsp -lpj -lm -lrt -lpthread -lcrypto -lssl  -lm  >&5
[  154s] /usr/lib/gcc/i586-suse-linux/4.8/../../../libpj.so: undefined reference to `SSLv2_method'
[  154s] /usr/lib/gcc/i586-suse-linux/4.8/../../../libpj.so: undefined reference to `SSLv2_server_method'
[  154s] collect2: error: ld returned 1 exit status
{noformat}

Did http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20140816/eb270c60/attachment.patch ever reach your pjproject?

By: Marcello Ceschia (marcelloceschia) 2014-10-10 04:40:18.022-0500

You said "Problem appears solved by updating pjproject."
I build with MASTER of https://github.com/asterisk/pjproject as you can find in https://build.opensuse.org/package/show/home:chan-sccp-b:base_packages/pjproject
Should I apply the patch again to pjproject?

By: Walter Doekes (wdoekes) 2014-10-10 04:58:40.774-0500

No. You should use the base pjproject, not the asterisk version.

http://svn.pjsip.org/repos/pjproject/trunk/

By: Walter Doekes (wdoekes) 2014-10-12 03:36:30.576-0500

[~rnewton]: Does the patch need to be backported to the Asterisk pjproject? Or can we point people to the vanilla Teluu svn?

(I updated the wiki a bit, although the wysiwyg editor was horribly annoying so I stopped early.)

By: Rusty Newton (rnewton) 2014-11-03 10:17:49.992-0600

[~wdoekes] we can point people to the latest Teluu pjproject.

[~marcelloceschia] can you confirm that using the latest pjproject from http://svn.pjsip.org/repos/pjproject/trunk/ resolves your issue?

By: Rusty Newton (rnewton) 2014-11-17 20:22:33.977-0600

This is still waiting on Marcello's response as comments on this issue seemed ambiguous as to whether the issue was resolved with the latest pjproject build or not.

By: Payam Azadi (payamazadi) 2014-11-24 13:46:38.433-0600

no idea about the underlying technical resolution, but using the latest trunk as specified above clears out all make/installation errors. thanks.

By: Rusty Newton (rnewton) 2015-01-19 10:27:45.953-0600

Closing out then since this appears to be resolved by latest pjproject version.

If anyone runs into this issue or similar, please open a new issue so we can keep things clear.