[asterisk-bugs] [JIRA] (ASTERISK-25727) RPM build requires OPTIONAL_API cflag due to PJSIP requirement

George Joseph (JIRA) noreply at issues.asterisk.org
Tue Feb 16 11:39:33 CST 2016


    [ https://issues.asterisk.org/jira/browse/ASTERISK-25727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=229527#comment-229527 ] 

George Joseph commented on ASTERISK-25727:
------------------------------------------

You would think that OPTIONAL_API turns on and off the optional apis, but it's a little more complicated than that.  When it's on, the optional apis are indeed optional but when it's off, the optional apis become REQUIRED.  In this case with OPTIONAL_API turned off, ast_statsd_log_full_va (and a whole bunch of other things) became required instead of optional.  Unfortunately, res_pjsip tried to load before res_statsd and failed.  You *could* fix this at runtime in modules.conf by loading res_statsd before res_pjsip but that's probably not the best solution.

Hardened build makes this even a little more complicated.   When the Asterisk module loader opens each module, it does it with lazy symbol resolution meaning that it defers lookup of functions until the function is actually called.  This way if one module depends on another, they'll still both load.  Hardened build adds the "-z now" flag to the linker which requires that those symbols be resolved at load so many modules will fail.  OPTIONAL_API helps again here.  With it turned on, the api will be available as a stub until the module providing the api loads. This satisfies the system loader (but still spits out messages).



> RPM build requires OPTIONAL_API cflag due to PJSIP requirement
> --------------------------------------------------------------
>
>                 Key: ASTERISK-25727
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-25727
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_pjsip
>    Affects Versions: 13.7.0
>         Environment: Fedora 23
>            Reporter: Gergely Dömsödi
>            Assignee: Unassigned
>         Attachments: asterisk_hardened_debug.txt, asterisk_not_hardened_debug.txt, build.log.txt, modules.dir.txt
>
>
> I built 13.7.0 on Fedora 23 (gcc 5.3.1) and res_pjsip fails to load with the message: {{Error loading module 'res_pjsip.so': /usr/lib64/asterisk/modules/res_pjsip.so: undefined symbol: ast_statsd_log_full_va}}
> Vanilla configure, make, make install: works
> rpm build with hardening enabled (fedora default): asterisk starts up, but res_pjsip is not loaded, and cannot be loaded
> rpm build with hardenind disabled (%undefine _hardened_build): asterisk doesn't even starts with the message above
> update:
> Made a successful build with rpmbuild:
> The problem was with the OPTIONAL_API cflag was not enabled in my build. As it turned out, it is not optional for PJSIP in 13.7.0 (it uses ast_statsd_log_full_va which is exported only if this flag is set), thus it must be turned on.
> If it is enabled, asterisk starts properly both with _hardened_build enabled and disabled. However when _hardened_build is enabled, there are a bunch of warnings during startup about various undefined symbols, but at the end everything loads just fine. If it is disabled there are no such messages.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list