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.
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.
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
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.
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.
(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" ;;
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.
(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.
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
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
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
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.
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.