Bug 554747 - net-snmp-config should not contain perl options
Summary: net-snmp-config should not contain perl options
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: net-snmp
Version: 13
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Jan Safranek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-01-12 14:58 UTC by Stepan Kasal
Modified: 2010-09-02 20:46 UTC (History)
11 users (show)

Fixed In Version: net-snmp-5.5-16.fc13
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-09-02 03:59:04 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Stepan Kasal 2010-01-12 14:58:07 UTC
net-snmp is built with embedded perl imperpreter.  To do that,a long list of options has to be added to the compile and link commands.

Unfortunately, these options (or at least some of them) are then published by net-snmp-config.

An annoying instance is option -Wl,-rpath,/usr/lib{,64}/perl5/CORE that appears in the output ofnet-snmp-config --agent-libs.
This causes the application linked against net-snmp agent library to contain the infamous RPATH record.  (For an example, see /usr/bin/hpiSubagent from openhpi-subagent package.)

Another issue is that "net-snmp-config" contains long list of "embed perl" options, e.g. various -f -D -I options.  This make the compile commands less readable.

Please make sure that the perl-related compile options do not get propagated to net-snmp-config.

Comment 1 Jan Safranek 2010-01-15 13:58:38 UTC
I need a little help there. net-snmp-config appends output of 'perl -V:ccdlflags' to --agent-libs. Question is, what are the magic 'ccdlflags'? I haven't found any documentation and it contains '-Wl,-E -Wl,-rpath,/usr/lib64/perl5/CORE' which looks completely useless to me.

Upstream SVN logs do not show anything useful, it appeared there during complete perl compilation rework, without any note why ccdlflags are important.

I am afraid to remove it upstream without exact description of ccdlflags, Net-SNMP is multiplatform project and it might break something on those fragile old UN*Xes with ancient versions of Perl.

Comment 2 Bug Zapper 2010-03-15 13:52:09 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 13 development cycle.
Changing version to '13'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 3 Jan Safranek 2010-08-05 10:23:40 UTC
Net-SNMP agent libraries contain embedded perl engine, so it must link with Perl. Net-SNMP does not know, how to link with it and it queries Perl to provide list of compile and link options to get the linking right. The rpath option therefore comes from perl itself, namely perl -V:ccdlflags.

So, the perl itself should be changed and rpath removed from perl -V:ccdlflags output.

Comment 4 Petr Pisar 2010-08-17 12:47:05 UTC
I see it's annoying. However net-snmp does not contain perl engine. It uses and links against libperl.so---the Perl engine provided by perl-libs package.

The libperl.so resides in non-standard path /usr/%{_libdir}/perl5/CORE. Thus any binary linking against libperl.so must hardcode the run-time search path.

See Configure script in perl sources:

# How will the perl executable find the installed shared $libperl?
# Add $xxx to ccdlflags.
# If we can't figure out a command-line option, use $shrpenv to
# set env LD_RUN_PATH.  The main perl makefile uses this.
shrpdir=$archlibexp/CORE
xxx=''
tmp_shrpenv=''
if "$useshrplib"; then
    case "$osname" in
    aix)
        # We'll set it in Makefile.SH...
        ;;
    solaris)
        xxx="-R $shrpdir"
        ;;
    freebsd|netbsd|openbsd|interix|dragonfly)
        xxx="-Wl,-R$shrpdir"
        ;;
[...]

Therefore libnetsnmpagent.so does so:

$ scanelf -r /usr/lib64/libnetsnmpagent.so.20 
 TYPE   RPATH FILE 
ET_DYN /usr/lib64/perl5/CORE /usr/lib64/libnetsnmpagent.so.20


Question is does SNMP agent plug-in need to link against perl directly, if libnetsnmpagent library provides Perl transitively?

If yes, then net-snmp-config needs to exports the linker option to allow third-party ELFs to link against libperl.so.

If no, then net-snmp-config should not export the option.

Comment 5 Petr Pisar 2010-08-17 12:49:36 UTC
(In reply to comment #4)
> See Configure script in perl sources:
> 
> # How will the perl executable find the installed shared $libperl?
> # Add $xxx to ccdlflags.
> # If we can't figure out a command-line option, use $shrpenv to
> # set env LD_RUN_PATH.  The main perl makefile uses this.
> shrpdir=$archlibexp/CORE
> xxx=''
> tmp_shrpenv=''
> if "$useshrplib"; then
>     case "$osname" in
>     aix)
>         # We'll set it in Makefile.SH...
>         ;;
>     solaris)
>         xxx="-R $shrpdir"
>         ;;
>     freebsd|netbsd|openbsd|interix|dragonfly)
>         xxx="-Wl,-R$shrpdir"
>         ;;
> [...]
      bsdos|linux|irix*|dec_osf|gnu*)
          xxx="-Wl,-rpath,$shrpdir"
          ;;

Comment 6 Petr Pisar 2010-08-17 12:55:01 UTC
The in-perl compiled options are described briefly in Perl Config module (perldoc Config):

 "ccdlflags"
           From dlsrc.U:

           This variable contains any special flags that might need to be
           passed to cc to link with a shared library for dynamic loading.  It
           is up to the makefile to use it.  For sunos 4.1, it should be
           empty.

Comment 7 Jan Safranek 2010-08-19 13:20:44 UTC
(In reply to comment #4)
> $ scanelf -r /usr/lib64/libnetsnmpagent.so.20 
>  TYPE   RPATH FILE 
> ET_DYN /usr/lib64/perl5/CORE /usr/lib64/libnetsnmpagent.so.20
> 
> 
> Question is does SNMP agent plug-in need to link against perl directly, if
> libnetsnmpagent library provides Perl transitively?
> 
> If yes, then net-snmp-config needs to exports the linker option to allow
> third-party ELFs to link against libperl.so.
> 
> If no, then net-snmp-config should not export the option.

This seems to be the case, I've compiled sample subagent (i.e. standalone application with some SNMP functionality) and it seems it links with libnetsnmpagent.so.20 and libperl.so just fine, without the RPATH inside the subagent binary. I'll remove the RPATH from net-snmp-config output.

Comment 8 Fedora Update System 2010-08-20 07:02:04 UTC
net-snmp-5.5-20.fc14 has been submitted as an update for Fedora 14.
http://admin.fedoraproject.org/updates/net-snmp-5.5-20.fc14

Comment 9 Fedora Update System 2010-08-20 07:02:11 UTC
net-snmp-5.5-16.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/net-snmp-5.5-16.fc13

Comment 10 Fedora Update System 2010-08-20 18:44:13 UTC
net-snmp-5.5-20.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update net-snmp'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/net-snmp-5.5-20.fc14

Comment 11 Fedora Update System 2010-09-02 03:58:58 UTC
net-snmp-5.5-20.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2010-09-02 20:46:17 UTC
net-snmp-5.5-16.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.