[Home]

Summary:ASTERISK-28623: pjsip: PJPROJECT_CONFIGURE_OPTS install location not honored
Reporter:Richard Frith-Macdonald (richardfm)Labels:
Date Opened:2019-11-20 11:11:33.000-0600Date Closed:
Priority:MinorRegression?
Status:Open/NewComponents:Third-Party/pjproject
Versions:17.0.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:This appears to be deliberate (judging by the comment in third-party/pjproject/Makefile.rules), but its not clear to me why this was done.

The --prefix= option is explicitly overridden in Makefile.rules to set the install location to be /opt/pjproject

Doing this prevents building and installing asterisk into a sandbox area (and means you need to build as root, which is generally a bad idea).

The simple fix is to remove that override in Makefile.rules
If there's a good reason to have that override, I suggest adding a top-level configure option to be used to override the override :-)
Comments:By: Asterisk Team (asteriskteam) 2019-11-20 11:11:34.088-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

By: George Joseph (gjoseph) 2019-12-02 09:33:46.527-0600

The bundled version of pjproject doesn't actually install anything to that location.  In fact, it doesn't install anything at all.  The bundled version is compiled but then linked into libasteriskpj.so which gets installed into whatever prefix you've specified with asterisk's ./configure.

We added /opt/pjproject to the pjproject configure only as a failsafe so that if something got messed up with the install, it wouldn't overwrite anything in the system directories.

Are you seeing something different?  If so, logs or error messages would be appreciated

By: Asterisk Team (asteriskteam) 2019-12-16 12:00:02.275-0600

Suspended due to lack of activity. This issue will be automatically re-opened if the reporter posts a comment. If you are not the reporter and would like this re-opened please create a new issue instead. If the new issue is related to this one a link will be created during the triage process. Further information on issue tracker usage can be found in the Asterisk Issue Guidlines [1].

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

By: Richard Frith-Macdonald (richardfm) 2020-05-15 09:56:25.887-0500

Sorry I never got back on this ... for some reason I never received any emails from the bug tracker.
Anyway, here's a log of the error caused by this bug:

$ make install
/bin/install: cannot create directory ‘/opt/pjproject’: Permission denied
make[2]: *** [_install] Error 1
make[1]: *** [pjproject] Error 2
make: *** [third-party-install] Error 2

This is on CentOS-7 systems ... it may well be the case that pjproject is never installed, but as you can see the installation process tries to create the directory, which means you can't build/install asterisk unless you are root,  which is real  a pain for packaging and automated testing.

By: Asterisk Team (asteriskteam) 2020-05-15 09:56:26.541-0500

This issue has been reopened as a result of your commenting on it as the reporter. It will be triaged once again as applicable.

By: Joshua C. Colp (jcolp) 2020-05-15 10:25:00.209-0500

We'll need to know the precise steps you've taken to build, including the arguments.

By: Richard Frith-Macdonald (richardfm) 2020-05-15 10:42:20.972-0500

This is for a standalone setup installed to /home/brains99/Install/ThirdParty

$ ./configure --prefix=/home/brains99/Install/ThirdParty --with-jansson-bundled --with-pjproject-bundled PJPROJECT_CONFIGURE_OPTS=--prefix=/home/brains99/Install/ThirdParty PJPROJECTCFLAGS=-I/home/brains99/Install/ThirdParty/include PJPROJECTCLIBS=-L/home/brains99/Install/ThirdParty/lib CC=gcc CXX=g++ CFLAGS=-I/home/brains99/Install/ThirdParty/include LDFLAGS=-L/home/brains99/Install/ThirdParty/lib
$ make

Clearly, with an unmodified copy of the asterisk release, the PJPROJECT_CONFIGURE_OPTS=--prefix=/home/brains99/Install/ThirdParty had no effect.  To make that configure command work (as in earlier released), I have to edit third-party/pjproject/Makefile.rules
If pjproject is never installed anywhere, I guess overriding --prefix= is not really a bad thing; as long as the location you override it to is one that the install script can write to, or you can be sure that the install script won't check (I don't know how you'd reliably determine that though).

By: Sean Bright (seanbright) 2020-05-15 12:56:42.539-0500

I was able to reproduce more simply with 17 @ e0c6e1b7:

{noformat}
$ ./configure --prefix=/home/sean/Install/ThirdParty --with-jansson-bundled --with-pjproject-bundled
$ make
$ make install # Note that I am not root here
{noformat}

I get the following error:

{noformat}
CC="cc" CXX="g++" LD="" AR="" RANLIB="" CFLAGS="" LDFLAGS="" make -C menuselect CONFIGURE_SILENT="--silent" makeopts
make[1]: Entering directory '/home/sean/gerrit/asterisk/menuselect'
make[1]: 'makeopts' is up to date.
make[1]: Leaving directory '/home/sean/gerrit/asterisk/menuselect'
/usr/bin/install: cannot create directory ‘/opt/pjproject’: Permission denied
make[2]: *** [Makefile:198: _install] Error 1
make[1]: *** [Makefile:20: pjproject] Error 2
make: *** [Makefile:607: third-party-install] Error 2
{noformat}

And after some tweaking of the Makefile so that we can see what command is bombing:

{noformat}
...
for x in ; do /usr/bin/install -c -m 755 $x "/home/sean/Install/ThirdParty/var/lib/asterisk/agi-bin" ; done
make[1]: Leaving directory '/home/sean/gerrit/asterisk/agi'
make[1]: Entering directory '/home/sean/gerrit/asterisk/contrib'
/usr/bin/install -c -d "/home/sean/Install/ThirdParty/var/lib/asterisk/scripts"
/usr/bin/install -c -m 755 scripts/ast_logescalator "/home/sean/Install/ThirdParty/var/lib/asterisk/scripts/ast_logescalator"
/usr/bin/install -c -m 755 scripts/ast_loggrabber "/home/sean/Install/ThirdParty/var/lib/asterisk/scripts/ast_loggrabber"
/usr/bin/install -c -m 755 scripts/ast_coredumper "/home/sean/Install/ThirdParty/var/lib/asterisk/scripts/ast_coredumper"
/usr/bin/install -c -m 755 scripts/refcounter.py "/home/sean/Install/ThirdParty/var/lib/asterisk/scripts/refcounter.py"
/usr/bin/install -c -m 755 scripts/refstats.py "/home/sean/Install/ThirdParty/var/lib/asterisk/scripts/refstats.py"
/usr/bin/install -c -m 755 scripts/reflocks.py "/home/sean/Install/ThirdParty/var/lib/asterisk/scripts/reflocks.py"
make[1]: Leaving directory '/home/sean/gerrit/asterisk/contrib'
make[1]: Entering directory '/home/sean/gerrit/asterisk/third-party'
make -C pjproject install
make[2]: Entering directory '/home/sean/gerrit/asterisk/third-party/pjproject'
if [ ! -d "/opt/pjproject/var/lib/asterisk/third-party/pjproject" ]; then \
       /usr/bin/install -c -d "/opt/pjproject/var/lib/asterisk/third-party/pjproject"; \
fi;
/usr/bin/install: cannot create directory ‘/opt/pjproject’: Permission denied
make[2]: *** [Makefile:198: _install] Error 1
make[2]: Leaving directory '/home/sean/gerrit/asterisk/third-party/pjproject'
make[1]: *** [Makefile:20: pjproject] Error 2
make[1]: Leaving directory '/home/sean/gerrit/asterisk/third-party'
make: *** [Makefile:607: third-party-install] Error 2
{noformat}