Agent++: cannot find suitable libsnmp++ library

Hello,
I am evaluating AGENT+±4.3.1 and SNMP+±3.4.2 with cross-compiler for arm architecture. The SNMP++ is configured to install library in the local directory (–prefix) as I have not sudo rights to install it in the /usr/local. The path to the library is provided during AGENT++ configuration, but it failed with the error: Cannot find suitable libsnmp++ library.
checking if libsnmp++ can be linked with flags from pkg-config… no
checking if libsnmp++ is in /home/safetpepeljak/Projects/agentpp… yes
checking if libsnmp++ can be linked alone… no
checking if libsnmp++ is in /usr/local… no
checking if libsnmp++ is in /usr… no
configure: error: Cannot find suitable libsnmp++ library

Can you please, help?
Regards,
Safet

Have you configured in AGENT++ the location of the SNMP++ library correctly?

(There is no auto-detection of non-default locations)

I did it using LDFLAGS. Is it the way to do it or you have something else to recommend?
I also I used --with-libsnmp-prefix, but still the same issue. As you can see it detects the libsnmp++ is is the local directory but for some reason it doesn’t work.

Hi,

I just checked two usages (but not for a cross compiler):

  1. Install both into the same directory:
    ./configure --prefix=/tmp/INSTALL && make && make install” in snmp++ and then the same in agent++ directory
  2. Install both into different directories:
    snmp++: “./configure --prefix=/tmp/INSTALL.SNMP && make && make install
    agent++ “./configure --prefix=/tmp/INSTALL.AGENT --with-libsnmp-prefix=/ /tmp/INSTALL.SNMP && make && make install

Maybe autoconf is mixing up lib and lib64 directories for your cross compiler. Try to copy the installed files from lib directory to lib64 directory (or from lib64 to lib) before calling configure for agent++.

Kind regards,
Jochen

Hello Jochen,

Thank you for your help. I am still looking into config.log file and see that there is something that can help me to figure out what is wrong.
I will try what you suggested and post the results here.

Regards,
Safet

Hello,

I did the same as Jochen, did: I build without no issue if I don’t use any prefix or cross-compile (–host) just on native machine.
I compared the config.log files for both and noticed that when I cross-compile and provide the prefix the compliation is terminated with the next fatal error during configuration of AGENT++
configure:9280: checking if libsnmp++ is wanted
configure:9298: result: yes
configure:9301: checking if libsnmp++ wants a prefix
configure:9332: result: /home/safetpepeljak/Projects/agentpp
configure:9373: checking for snmp
configure:9380: $PKG_CONFIG --exists --print-errors “snmp+±3 >= 3.3.0”
configure:9383: $? = 0
configure:9397: $PKG_CONFIG --exists --print-errors “snmp+±3 >= 3.3.0”
configure:9400: $? = 0
configure:9442: result: yes
configure:9496: checking if libsnmp++ can be linked with flags from pkg-config
configure:9528: arm-buildroot-linux-gnueabihf-g++ -o conftest -g -O2 -pthread -D_GNU_SOURCE -D_XOPEN_SOURCE=XPG6 -I/opt/toolchains/armv7-eabihf–glibc–stable-2018.02-2/bin/…/arm-buildroot-linux-gnueabihf/sysroot/home/safetpepeljak/Projects/agentpp/include -Wl,-rpath,/home/safetpepeljak/Projects/agentpp/lib conftest.cpp -L/opt/toolchains/armv7-eabihf–glibc–stable-2018.02-2/bin/…/arm-buildroot-linux-gnueabihf/sysroot/home/safetpepeljak/Projects/agentpp/lib -lsnmp++ >&5
conftest.cpp:92:29: fatal error: snmp_pp/snmp_pp.h: No such file or directory
#include <snmp_pp/snmp_pp.h>
^
compilation terminated.
configure:9528: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME “agent++”
| #define PACKAGE_TARNAME “agent++”
| #define PACKAGE_VERSION “4.3.1”
| #define PACKAGE_STRING “agent++ 4.3.1”
| #define PACKAGE_BUGREPORT “support@agentpp.com

I check for this file and it is exactly where include points to.
I think this is something related to the wrong include paths during configuration for cross-compilation.
Is there anything I am missing here to be able to cross-compile with local installation paths

Regards,
Safet

Hello,

The update on this issue. If I provide the flag --without-ssl, I am able to configure AGENT++,
but this flag removes SNMPv3 which I need.
So definitely it is something related to the how the OpenSSL is build and used in SNMP++.
Does anyone can help about this issue: how properly to build and include OpenSSL for AGENTPP?

Regards,
Safet

Hi,

configure:9528: arm-buildroot-linux-gnueabihf-g++ -o conftest -g -O2 -pthread -D_GNU_SOURCE -D_XOPEN_SOURCE=XPG6 -I/opt/toolchains/armv7-eabihf–glibc–stable-2018.02-2/bin/…/arm-buildroot-linux-gnueabihf/sysroot/home/safetpepeljak/Projects/agentpp/include -Wl,-rpath,/home/safetpepeljak/Projects/agentpp/lib conftest.cpp -L/opt/toolchains/armv7-eabihf–glibc–stable-2018.02-2/bin/…/arm-buildroot-linux-gnueabihf/sysroot/home/safetpepeljak/Projects/agentpp/lib -lsnmp++ >&5
conftest.cpp:92:29: fatal error: snmp_pp/snmp_pp.h: No such file or directory

what happens if you try to compile a simple cpp file with added #include <snmp_pp/snmp_pp.h> with this command line?

Do the installed pkgconfig and libsnmp++.la files look ok?

As you wrote that it works without SNMPv3/SSL: Did you check that the compiler finds the right SSL libraries for the target? (This is just a wild guess…)

Kind regards,
Jochen

Hello Jochen,

I checked if the path for libsnmp++ is correct during AGENT++ configuration and it is correct. It points to my local directory where libsnmp++, libcrypto, libssl are located.

Once the libsnmp++.a is installed in my local directory I checked the symbols with nm and see that AES_* are all in with U which should be fine as they are from libcrypto.a. But when AGENT++ checking for libsnmp++ during configuration it failed with undefined references to ‘AES_*@OPENSSL_1_1_0’.
I do cross-compiling OpneSSL version 1.1.1h for linux-arm. Is there anything hard coded to OpenSSL version in AGENTPP (snmp++, agent++)?

It looks like no options are passed to the cross compiler??

configure:9669: arm-buildroot-linux-gnueabihf-g++ -o conftest -g -O2 -pthread -D_GNU_SOURCE -D_XOPEN_SOURCE=XPG6 -I/opt/toolchains/armv7-eabihf–glibc–stable-2018.02-2/bin/…/arm-buildroot-linux-gnueabihf/sysroot/home/safetpepeljak/ws/artila/include -I/home/safetpepeljak/ws/artila/include -Wl,-rpath,/home/safetpepeljak/ws/artila conftest.cpp -L/home/safetpepeljak/ws/artila/lib -lsnmp++ >&5
Preformatted text/opt/toolchains/armv7-eabihf–glibc–stable-2018.02-2/bin/…/lib/gcc/arm-buildroot-linux-gnueabihf/6.4.0/…/…/…/…/arm-buildroot-linux-gnueabihf/bin/ld: warning: libssl.so.1.1, needed by /home/safetpepeljak/ws/artila/lib/libsnmp++.so, not found (try using -rpath or -rpath-link)/opt/toolchains/armv7-eabihf--glibc--stable-2018.02-2/bin/../lib/gcc/arm-buildroot-linux-gnueabihf/6.4.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: warning: libcrypto.so.1.1, needed by /home/safetpepeljak/ws/artila/lib/libsnmp++.so, not found (try using -rpath or -rpath-link) /home/safetpepeljak/ws/artila/lib/libsnmp++.so: undefined reference toAES_set_encrypt_key@OPENSSL_1_1_0’
/home/safetpepeljak/ws/artila/lib/libsnmp++.so: undefined reference to EVP_DigestInit@OPENSSL_1_1_0' /home/safetpepeljak/ws/artila/lib/libsnmp++.so: undefined reference to EVP_sha256@OPENSSL_1_1_0’
/home/safetpepeljak/ws/artila/lib/libsnmp++.so: undefined reference to EVP_MD_CTX_new@OPENSSL_1_1_0' /home/safetpepeljak/ws/artila/lib/libsnmp++.so: undefined reference to EVP_MD_CTX_free@OPENSSL_1_1_0’
/home/safetpepeljak/ws/artila/lib/libsnmp++.so: undefined reference to EVP_DigestFinal@OPENSSL_1_1_0' /home/safetpepeljak/ws/artila/lib/libsnmp++.so: undefined reference to EVP_sha512@OPENSSL_1_1_0’
/home/safetpepeljak/ws/artila/lib/libsnmp++.so: undefined reference to EVP_sha1@OPENSSL_1_1_0' /home/safetpepeljak/ws/artila/lib/libsnmp++.so: undefined reference to EVP_DigestUpdate@OPENSSL_1_1_0’
/home/safetpepeljak/ws/artila/lib/libsnmp++.so: undefined reference to DES_key_sched@OPENSSL_1_1_0' /home/safetpepeljak/ws/artila/lib/libsnmp++.so: undefined reference to EVP_md5@OPENSSL_1_1_0’
/home/safetpepeljak/ws/artila/lib/libsnmp++.so: undefined reference to AES_cfb128_encrypt@OPENSSL_1_1_0' /home/safetpepeljak/ws/artila/lib/libsnmp++.so: undefined reference to EVP_sha384@OPENSSL_1_1_0’
/home/safetpepeljak/ws/artila/lib/libsnmp++.so: undefined reference to EVP_sha224@OPENSSL_1_1_0' /home/safetpepeljak/ws/artila/lib/libsnmp++.so: undefined reference to DES_ncbc_encrypt@OPENSSL_1_1_0’

Hello,

I copied the “libssl.so” and “libcrypto.so” in the cross-compilation tools sysroot/lib. After this I was able to configure AGENT++.
It looks a bit odd that even though I provided path in LDFLAGS to configure command line it still looks only in sysroot/lib. Is the any issue with configuration of AGENT++ for cross compilation?

Now make looks like works but link failed:
/bin/sed: can’t read /opt/armv7-eabihf–glibc–stable-2018.02-2/arm-buildroot-linux-gnueabihf/lib/libstdc++.la: No such file or directory
libtool: error: ‘/opt/armv7-eabihf–glibc–stable-2018.02-2/arm-buildroot-linux-gnueabihf/lib/libstdc++.la’ is not a valid libtool archive
Makefile:509: recipe for target ‘libagent++.la’ failed
make[2]: *** [libagent++.la] Error 1

Any suggestion?

Regards,
Safet

Hi,

I looked into the configure files of agent++ and there is nothing related to OpenSSL or the other crypto libraries. So agent++ seems to fully rely on the configuration of snmp++. This works for normal compilation and might be wrong for cross compilation.

For a normal compilation, the installed libsnmp++.la just has a line dependency_libs=' -lssl -lcrypto' while the libagent++.la shows dependency_libs=' -L/prefix/lib64 /prefix/lib64/libsnmp++.la -lssl -lcrypto'.

Kind regards,
Jochen

Hello Jochen,

I have installed my cross-compiler in the /opt/toolchains/armv7-eabihf–glibc–stable-2018.02-2, and I set the LDFLAGS to /opt/toolchains/, but I see from the error during the linking stage is that path to look for the libstdc++.la is missing the /toolchain.
Do you think this might be issue with how I provide the paths or might be some problem in agent++ configuration script?
Regards,
Safet

Hi,

how do you provide the paths during the call to make? What will not work is LDFLAGS="-L /opt/toolchains/" make, as the generated Makefiles will not allow this. What should work is make LDFLAGS="-L /opt/toolchains/".

I can’t rule out that the configure setup of agent++ has a problem for cross compilation…

Kind regards,
Jochen

Hello Jachen,

This is what I do to configure agent++

autoreconf -i --force

./configure --build=x86_64 --host=$MYHOST --target=$MYHOST --prefix=$HOME/ws/artila --with-libsnmp-prefix=$HOME/ws/artila --with-examples --with-agenpro-simagent LDFLAGS="-L$HOME/ws/artila/lib -L/opt/toolchains/armv7-eabihf–glibc–stable-2020.08-1/lib -Wl,-rpath,$HOME/ws/artila/lib -Wl,-rpath,/opt/toolchains/armv7-eabihf–glibc–stable-2020.08-1/lib" CPPFLAGS="-I$HOME/ws/artila/include -I$HOME/ws/artila/include/openssl -Wl,-rpath,$HOME/ws/artila/include -Wl,-rpath,$HOME/ws/artila/include/openssl"

autoreconf -i --force

./configure --build=x86_64 --host=$MYHOST --target=$MYHOST --prefix=$HOME/ws/artila --with-libsnmp-prefix=$HOME/ws/artila --with-examples --with-agenpro-simagent LDFLAGS="-L$HOME/ws/artila/lib -L/opt/toolchains/armv7-eabihf–glibc–stable-2020.08-1/lib -Wl,-rpath,$HOME/ws/artila/lib -Wl,-rpath,/opt/toolchains/armv7-eabihf–glibc–stable-2020.08-1/lib" CPPFLAGS="-I$HOME/ws/artila/include -I$HOME/ws/artila/include/openssl -Wl,-rpath,$HOME/ws/artila/include -Wl,-rpath,$HOME/ws/artila/include/openssl"

Regards,
Safet

Hello Jachen,

I extended path -L/opt/toolchains/armv7-eabihf–glibc–stable-2020.08-1/lib to
-L/opt/toolchains/armv7-eabihf–glibc–stable-2020.08-1/arm-buildroot-linux-gnueabihf/lib to two places in the configuration command. Now I got the error that “include_modules.h” is missing.
I removed the option --with-agenpro-simagent and got make works with our error.

Do you have any idea why this happen with “–with-agenpro-simagen” option?

Regards,
Safet

That happens when there has not been any simulation code generated by AgenPro in the directories where that code should be placed (i.e. in agent++/agenpro/simagent/*).

Hello,

Thank you. As I have now compiled code (without examples too) I will generate some code by
AgenPro and try how it works on our platform before my evaluation license expire.

Regards,
Safet

Hello,

When I add option --with-examples AGENT++ build failed with “No rule to make target ‘all’. Stop”
in /examples/multi_agent.
The other examples: atm_mib, cmd_exe_mib, dynamic_table, and static_table are built ok.
Please, help?

Regards,
Safet

Hi,

the multi_agent directories are missing in the file configure.ac. At the end where all the Makefiles are listed, the multi_agent directories are missing (see patch below, which will be part of the next release).

Kind regards,
Jochen

diff --git a/configure.ac b/configure.ac
index c47aeb8..43857f6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -718,6 +718,9 @@ AC_CONFIG_FILES([Makefile
                  examples/cmd_exe_mib/src/Makefile
                  examples/dynamic_table/Makefile
                  examples/dynamic_table/src/Makefile
+                 examples/multi_agent/Makefile
+                 examples/multi_agent/include/Makefile
+                 examples/multi_agent/src/Makefile
                  examples/proxy/Makefile
                  examples/proxy/src/Makefile
                  examples/proxy_forwarder/Makefile

Thank you Jochen,

I will apply the provided patch and rebuild AGENT++.

Regards,
Safet