Search code examples
solarisnet-snmp

Issue with net-snmp build on Solaris 11


I am building net-snmp 5.7.3 on Solaris11 sparc. I am having my path set as:

/usr/local/lib:/bin:/usr/bin:/usr/dev_infra/platform/bin:/usr/dev_infra/generic/bin:/usr/local/bin:/usr/X11R6/bin:/usr/local/ade/bin:/usr/sfw/bin:/usr/ccs/bin:/opt/csw/bin:/opt/csw/gnu:/usr/sbin:/usr/bin:/usr/ccs/bin/ar

I run ./configure --prefix=/opt with default option and it was successful. After that when i do make, i am getting below error message, Any help is appreciated.

libtool: compile:  gcc -I../include -I. -I../snmplib -fno-strict-aliasing -g -O2 -Usolaris2 -Dsolaris2=solaris2 -c keytools.c  -fPIC -DPIC -o .libs/keytools.o
keytools.c: In function ‘generate_Ku’:
keytools.c:153:9: warning: assignment makes pointer from integer without a cast
keytools.c:161:9: error: invalid use of void expression
keytools.c:166:13: error: invalid use of void expression
*** Error code 1
make: Fatal error: Command failed for target `keytools.lo'
Current working directory /scratch/kkumsati/net-snmp/snmplib
*** Error code 1
The following command caused the error:
if test "snmplib  agent apps man local mibs" != ""; then \
        it="snmplib  agent apps man local mibs" ; \
        for i in $it ; do \
                echo "making all in `pwd`/$i"; \
                ( cd $i ; make ) ; \
                if test $? != 0 ; then \
                        exit 1 ; \
                fi  \
        done \
fi
make: Fatal error: Command failed for target `subdirs'

Solution

  • Look for README.solaris file in source folder. It has 'Compiling net-snmp' section. In README you could find the following:

    You need to set your $PATH.  This is extremely important
    because otherwise there may be conflicts between the various
    components of the development environment.
    

    Wrong PATH is your problem.

    The other possible problem are old openssl headers in your system. You have an error about function EVP_MD_CTX_create() (error in keytools.c:153:9), this function is declared in Solaris file /usr/include/openssl/evp.h, this file is included in package pkg:/library/security/openssl. Version of this package on my OS is 1.0.1.18-0.175.3.5.0.5.0. I recommend you to update OS, or package pkg:/library/security/openssl or try to run configure script with --with-openssl=internal option.

    Also update gcc, I used this version

    pkg install developer/gcc-48 
    
    export PATH=/usr/sbin:/usr/local/bin:/usr/ccs/bin:/usr/bin:
    ./configure --prefix=/opt --with-mib-modules="ucd-snmp/lmSensors \
                ucd-snmp/diskio smux mibII/mta_sendmail" --with-cc=gcc
    gmake
    

    Here I received an error about:

    /usr/include/sys/processor.h:188:45: error: unknown type name 'kthread_t'
     extern boolean_t i_processor_affinity_check(kthread_t *, struct cpu *);
                                             ^
    /usr/include/sys/processor.h:189:37: error: unknown type name 'kthread_t'
     extern int i_processor_affinity_one(kthread_t *, id_t, boolean_t);
                                     ^
    /usr/include/sys/processor.h:190:33: error: unknown type name 'kthread_t'
     extern int i_processor_affinity(kthread_t *, uint_t *, id_t *, uint32_t *,
                                 ^
    

    To solve this edit file agent/mibgroup/host/data_access/swrun_procfs_psinfo.c and add to its header at 26 line (before problem line):

    #include <sys/processor.h>
    #include <sys/procset.h>
    #include <thread.h>
    

    Link about this bug

    then repeat

    gmake
    gmake test
    gmake install;  #this command with root permissons 
    

    I succeed on SPARC.