net-snmp5.7.3 porting to the Arm-linux platform

Source: Internet
Author: User
Tags openssl library sha1 snmp

net-snmp5.7.3 porting to the Arm-linux platform

This cross-compilation is performed under Ubuntu 15.04 64-bit systems.

Preparatory work

There are several preparations to complete before compiling the migration.

    • 1 Download net-snmp 5.7.3 Source Package
    • 2 Installing the Cross-compilation environment (ARM-LINUX-GNUEABI-GCC)
      You can install it using the command sudo apt-get install gcc-arm-linux-gnueabi .
Compiling the configuration

Unzip the NET-SNMP source package and enter the source package directory

 unzip net-snmp-5.7.3.zip  cd net-snmp-5.7.3/

There are those that can be used to ./configure --help view the configuration options. There is no post, give directly.

Options Description
–host=arm-linux Operating Platform
–target=arm-linux Target platform
–build=i686-linux Compiling the Platform
–with-cc=arm-linux-gcc Cross compiler
–with-ar=arm-linux-ar Program used for packaging
–prefix=/usr/local/net-snmp installation directory
–disable-shared Static compilation
–disable-scripts Do not install scripts such as MIB2C
–with-endianness=little Specify the small-end mode
-enable-mini-agent The smallest snmpd
–enable-debugging Open Debug Information
–with-openssl=/opt/hardhat OpenSSL Library Path
–disable-ipv6 Do not use IPV6
–disable-manuals Do not install the Manpage instructions page
–disable-ucd-snmp-compatibility No compatible UCD-SNMP required
–enable-as-needed If only the other methods do not work, the link Libperl for the app instead of the NET-SNMP library.
–disable-snmptrapd-subagent No support for SNMPTRAPD's sub-agents
–disable-embedded-perl Do not use embedded Perl
–disable-embedded-perl The SNMP agent and SNMPTRAPD disable embedded Perl. Enabled by default
–disable-applications Whether to turn off snmpget and other functions, choose according to your own needs

Here is the configuration I used

Configure
./configure --host=arm-linux --target=arm-linux --build=i686-linux  --with-cc=arm-linux-gnueabi-gcc-4.9 --with-ar=arm-linux-gnueabi-gcc-ar-4.9 --prefix=/usr/local/net-snmp --disable-shared --disable-scripts --with-endianness=little -enable-mini-agent --disable-ipv6 --disable-manuals  --disable-ucd-snmp-compatibility --enable-as-needed

When configuring, you can specify an empty directory to use as the installation directory, for example /home/o/123 . Then make you can install it after the success make install . When porting to the arm board, you can pack and copy the directory directly.

Configre successful output of the information
---------------------------------------------------------            Net-SNMP configuration summary:---------------------------------------------------------  SNMP Versions Supported:    1 2c 3  Building for:               linux  Net-SNMP Version:           5.7.3  Network transport support:  Callback Unix Alias TCP UDP IPv4Base SocketBase TCPBase UDPIPv4Base UDPBase  SNMPv3 Security Modules:     usm  Agent MIB code:            default_modules =>  snmpv3mibs mibII/snmp_mib mibII/system_mib mibII/sysORTable mibII/vacm_vars mibII/vacm_conf  MYSQL Trap Logging:         unavailable  Embedded Perl support:      disabled  SNMP Perl modules:          building -- not embeddable  SNMP Python modules:        disabled  Crypto support from:        internal  Authentication support:     MD5 SHA1  Encryption support:         DES AES  Local DNSSEC validation:    disabled---------------------------------------------------------
Compile

After the configuration is successful, compile with the make command.
After the compilation succeeds, the following two lines are output.

chmod a+x net-snmp-configtouch net-snmp-config-x

After the compilation is complete, you can go to the agent folder to see if the file is exported snmpd .

[email protected]:~/snmp/net-snmp-5.7.3/agent$ ll snmpd-rwxrwxr-x 1 o o 3029820  9月 16 20:31 snmpd*[email protected]:~/snmp/net-snmp-5.7.3/agent$ file snmpdsnmpd: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=735ab05f48664e1af99c639e6519893be9413d2b, not stripped
Compress executable Files

After the compilation is ready to be used directly, but you can also compress to save space. Using arm-linux-gnueabi-strip programs to compress

[email protected]:~/snmp/net-snmp-5.7.3/agent$ arm-linux-gnueabi-strip snmpd[email protected]:~/snmp/net-snmp-5.7.3/agent$ ll snmpd-rwxrwxr-x 1 o o 703836  9月 16 20:51 snmpd*

As you can see, the size of the executable file after compression 3MB has been reduced from near to not 700KB .

Install to target platform

Once the compilation is successful, it can be installed on the target platform. First copy the agent files from the directory snmpd to the target machine.
Then create the configuration file on the target machine snmpd.conf , how to configure, you can refer to the fifth part of Http://www.cnblogs.com/oloroso/p/4595123.html.
Then you can start to try it.

sudo ./snmpd -c snmpd.conf  –f –Le –d
Problems and workarounds not in Perl library

Compile when there is no Perl library problem, this problem is also good to solve, compile one is. But, without this necessity, trouble.

/usr/lib/gcc-cross/arm-linux-gnueabi/4.9/../../../../arm-linux-gnueabi/bin/ld: cannot find -lperlcollect2: error: ld returned 1 exit statusMakefile:484: recipe for target ‘libnetsnmpagent.la‘ failedmake[1]: *** [libnetsnmpagent.la] Error 1make[1]: Leaving directory ‘/home/o/snmp/net-snmp-5.7.3/agent‘Makefile:656: recipe for target ‘subdirs‘ failedmake: *** [subdirs] Error 1

Solutions
In fact, it's very simple, add configure a parameter to the previous configuration --disable-embedded-perl , and then you can do it again make .

net-snmp5.7.3 porting to the Arm-linux platform

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.