CESNET / netopeer2

NETCONF toolset
BSD 3-Clause "New" or "Revised" License
301 stars 190 forks source link

cmake errors if openssl and ssh are installed in non default locations #1582

Open rakichinni opened 6 months ago

rakichinni commented 6 months ago

Hi, Pulled latest code base for libnetconf2, libyang, sysrepo, netopeer2 modules on 21st may 2024 and project versions are captured below, libnetcon2: 3.1.1 libyang: 3.0.5 netopeer2: 2.2.23 sysrepo: 2.3.9 cmake: 3.28.3

[root@localhost netconf]# ls
bin  libnetconf2  netopeer2  sysrepo libyang

libnetconf2, libyang, sysrepo and netopeer2 modules are cloned in one directory (output shared above).

We are upgrading openssl from 1.0.2k to 3.0.13. Hence rebuilding above set of modules requires rebuild for libssh 0.9.5, curl-8.8.0, ssh2 with openssl 3.0.13 and generated binaries/libraries maintained at non-standard paths (ex: /opt/openssl-3.0.13, /opt/curl-8.8.0/, etc). The reason for maintaining in non-standard path is because centos 7 base comes with openssl 1.0.2k and is not recommended to replaced. link

Observation1 Observed cmake and build failures in finding curl dependencies (lib and includes) in building libnetcon2 library. target_link_libraries(netconf2 CURL::libcurl) => current libnetcon2/CMakeLists.txt does this to link libcurl from /usr/lib64/libcurl.so

To solve curl dependency and finding its sources, Added below in libnetconf2/CMakeLists.txt

include_directories(${CURL_INCLUDE_DIR})
target_link_libraries(netconf2 ${CURL_LIBRARY})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${CURL_LIBRARY})

Initiated cmake with args related to curl include and library:

 cmake  -DENABLE_TLS=ON -DENABLE_SSH=ON -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INCLUDE_PATH="/root/libssh-0.9.5/include/;/root/netconf/bin/include/" \
  -DCURL_INCLUDE_DIR="/root/curl-8.8.0/curl-build/include/" -DCURL_LIBRARY="/root/curl-8.8.0/curl-build/lib/libcurl.so" \
  -DCMAKE_LIBRARY_PATH="/root/libssh-0.9.5/lib64/;/root/netconf/bin/lib64/" ..

Observation2 Observed that netopeer2 is not linking openssl and libssh when installed in different path, added lines in bold to resolve. I couldn't identify the reason why libs are not found with list(append ...).

if(OPENSSL_FOUND)
    list(APPEND CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
    list(APPEND CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
    **target_link_libraries(netopeer2-server ${OPENSSL_LIBRARIES}**
    **include_directories(${OPENSSL_INCLUDE_DIR})**
endif()

# dependencies - libssh (also required by libnetconf2 checks)
find_package(LibSSH 0.9.5)
if(LIBSSH_FOUND)
    list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBSSH_INCLUDE_DIRS})
    list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBSSH_LIBRARIES})
    **target_link_libraries(netopeer2-server ${LIBSSH_LIBRARIES})**
endif()

Please let me know if it is not recommended to use non-standard paths for ssl, ssh, curl, etc when building netopeer2. Also, let me know if changes made above in cmakelists.txt to build sources are fine?

michalvasko commented 6 months ago

Observation1

Yes, this needed to be improved and I have added the commands as an alternative if the CURL target does not exist, should work for you now.

Observation2

You are right that netopeer2 is not linking OpenSSL nor libssh but the reason is that it is not using them so it is redundant to link them. Why do you need to link these libraries?

rakichinni commented 6 months ago

netopeer2-server links libnetconf2 which has dependency with OpenSSL and libssh. So building netopeer2-server require above mentioned changes to link OpenSSL and libssh libs.

michalvasko commented 6 months ago

No, libnetconf2 links its dependencies and any project linking libnetconf2 does not have to link its dependencies separately (you can easily verify this is how it always works in cmake, for all the libraries).

rakichinni commented 6 months ago

Thanks, i just reverified again.

Observed below linker issue if we do not provide OpenSSL (non-standard path) in netopeer2/CMakeLists.txt (target_link_libraries).

/usr/bin/ld: warning: libssl.so.3, needed by /root/netconf/bin/lib64/libnetconf2.so, not found (try using -rpath or -rpath-link)

OpenSSL libs are dynamically linked to libnetcon2 and are maintained in non-standard paths. So target_link_libraries step seems to be needed. Will check again if anything wrong in the generated 'link.txt'

michalvasko commented 6 months ago

I believe this is an error of libnetconf2 compilation, not netopeer2. Unfortunately, since libnetconf2 is just a dynamic library, its dependencies are not actually resolved until a binary is compiled that is actually using those functions (such as netopeer2). So you need to fix your libnetconf2 build.

rakichinni commented 6 months ago

Sure i will check if there is anything that need to be done in libnetcon2 build.

Dumps from libnetcon2 and netopeer2 builds are added below for reference. Apologies for adding complete build dump. Error is from netopeer2-server build. Pls ignore if this is some basic config issue. Will figure out why dependencies are not identified while building netopeer2-server.

========== libnetconf2 Compilation ========== Repo Located at /root/netconf/libnetconf2 built binaries, headers, libs will be installed at /root/netconf/bin/

-- The C compiler identification is GNU 4.8.5 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Looking for _POSIX_TIMERS -- Looking for _POSIX_TIMERS - found -- Looking for pthread_mutex_timedlock -- Looking for pthread_mutex_timedlock - found -- Looking for pthread_mutex_clocklock -- Looking for pthread_mutex_clocklock - not found -- Looking for pthread_rwlock_timedrdlock -- Looking for pthread_rwlock_timedrdlock - found -- Looking for pthread_rwlock_clockrdlock -- Looking for pthread_rwlock_clockrdlock - not found -- Looking for pthread_rwlock_timedwrlock -- Looking for pthread_rwlock_timedwrlock - found -- Looking for pthread_rwlock_clockwrlock -- Looking for pthread_rwlock_clockwrlock - not found -- Looking for pthread_cond_clockwait -- Looking for pthread_cond_clockwait - not found -- Looking for vdprintf -- Looking for vdprintf - found -- Looking for asprintf -- Looking for asprintf - found -- Looking for vasprintf -- Looking for vasprintf - found -- Looking for getline -- Looking for getline - found -- Looking for strndup -- Looking for strndup - found -- Looking for strnstr -- Looking for strnstr - not found -- Looking for strdupa -- Looking for strdupa - found -- Looking for strchrnul -- Looking for strchrnul - found -- Looking for get_current_dir_name -- Looking for get_current_dir_name - found -- Looking for crypt.h -- Looking for crypt.h - found -- Looking for crypt_r -- Looking for crypt_r - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE -- Looking for pthread_rwlockattr_setkind_np -- Looking for pthread_rwlockattr_setkind_np - found -- Looking for shadow.h -- Looking for shadow.h - found -- Looking for termios.h -- Looking for termios.h - found -- Could NOT find MbedTLS (missing: MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARIES) (Required is at least version "3.5.0") -- Found OpenSSL: /root/openssl-3.0.13-build/lib64/libcrypto.so (found suitable version "3.0.13", minimum required is "3.0.0") -- Found LibSSH: /root/libssh-0.9.5-build/include (found suitable version "0.9.5", minimum required is "0.9.5") -- Found CURL: /root/curl-8.8.0/curl-build/lib/libcurl.so (found suitable version "8.8.1-DEV", minimum required is "7.30.0") -- Looking for crypt in crypt -- Looking for crypt in crypt - found -- Could NOT find LibPAM (missing: LIBPAM_LIBRARIES LIBPAM_INCLUDE_DIRS) -- SSH Keyboard Interactive system method: local users -- Found LibYANG: /root/netconf/bin/lib64/libyang.so (found suitable version "3.0.15", minimum required is "3.0.0") -- Found PkgConfig: /usr/bin/pkg-config (found version "0.27.1") -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) -- Configuring done (1.9s) -- Generating done (0.0s) CMake Warning: Manually-specified variables were not used by the project:

ENABLE_SSH
ENABLE_TLS

-- Build files have been written to: /root/netconf/libnetconf2/build [ 3%] Building C object CMakeFiles/netconf2.dir/src/io.c.o [ 7%] Building C object CMakeFiles/netconf2.dir/src/log.c.o In file included from /root/netconf/libnetconf2/src/log.c:31:0: /root/netconf/libnetconf2/src/log.c: In function ‘prv_printf’: /root/netconf/libnetconf2/src/LoggerApi.h:47:11: warning: ‘cslog_level’ may be used uninitialized in this function [-Wmaybe-uninitialized] cslog(level, context, msgBuf); \ ^ /root/netconf/libnetconf2/src/log.c:112:6: note: ‘cslog_level’ was declared here int cslog_level; ^ [ 11%] Building C object CMakeFiles/netconf2.dir/src/messages_client.c.o [ 14%] Building C object CMakeFiles/netconf2.dir/src/messages_server.c.o [ 18%] Building C object CMakeFiles/netconf2.dir/src/session.c.o [ 22%] Building C object CMakeFiles/netconf2.dir/src/session_client.c.o [ 25%] Building C object CMakeFiles/netconf2.dir/src/session_server.c.o [ 29%] Building C object CMakeFiles/netconf2.dir/src/msgqueue.c.o [ 33%] Building C object CMakeFiles/netconf2.dir/src/LoggerLib.c.o /root/netconf/libnetconf2/src/LoggerLib.c: In function ‘init_cs_log_handler’: /root/netconf/libnetconf2/src/LoggerLib.c:33:3: warning: implicit declaration of function ‘pthread_setname_np’ [-Wimplicit-function-declaration] pthread_setname_np(cs_logger_thread_id, "cslog_queue_thread");^M ^ /root/netconf/libnetconf2/src/LoggerLib.c: In function ‘cslog_queue_monitor’: /root/netconf/libnetconf2/src/LoggerLib.c:75:3: warning: implicit declaration of function ‘usleep’ [-Wimplicit-function-declaration] usleep(QUEUE_HANDLER_SLEEP_MICRO_SECS_10000);^M ^ /root/netconf/libnetconf2/src/LoggerLib.c:57:33: warning: unused parameter ‘vargp’ [-Wunused-parameter] void cslog_queue_monitor(void vargp)^M ^ [ 37%] Building C object CMakeFiles/netconf2.dir/src/LoggerApi.c.o In file included from /root/netconf/libnetconf2/src/LoggerApi.c:1:0: /root/netconf/libnetconf2/src/LoggerApi.h:17:12: warning: ‘cslog_mutex_flag’ defined but not used [-Wunused-variable] static int cslog_mutex_flag = 0; ^ /root/netconf/libnetconf2/src/LoggerApi.h:18:24: warning: ‘cslog_mutex’ defined but not used [-Wunused-variable] static pthread_mutex_t cslog_mutex; ^ /root/netconf/libnetconf2/src/LoggerApi.h:20:13: warning: ‘msgBuf’ defined but not used [-Wunused-variable] static char msgBuf[MAX_LOG_BUFF_LEN] = {0}; ^ [ 40%] Building C object CMakeFiles/netconf2.dir/src/server_config.c.o [ 44%] Building C object CMakeFiles/netconf2.dir/src/server_config_util.c.o [ 48%] Building C object CMakeFiles/netconf2.dir/src/session_client_ssh.c.o [ 51%] Building C object CMakeFiles/netconf2.dir/src/session_server_ssh.c.o /root/netconf/libnetconf2/src/session_server_ssh.c: In function ‘auth_password_compare_pwd’: /root/netconf/libnetconf2/src/session_server_ssh.c:418:12: warning: missing braces around initializer [-Wmissing-braces] struct crypt_data cdata = {0}; ^ /root/netconf/libnetconf2/src/session_server_ssh.c:418:12: warning: (near initialization for ‘cdata.keysched’) [-Wmissing-braces] /root/netconf/libnetconf2/src/session_server_ssh.c:418:12: warning: missing initializer for field ‘sb0’ of ‘struct crypt_data’ [-Wmissing-field-initializers] In file included from /root/netconf/libnetconf2/build/compat/compat.h:23:0, from /root/netconf/libnetconf2/src/session_server_ssh.c:43: /usr/include/crypt.h:49:10: note: ‘sb0’ declared here char sb0[32768]; ^ [ 55%] Building C object CMakeFiles/netconf2.dir/src/server_config_util_ssh.c.o /root/netconf/libnetconf2/src/server_config_util_ssh.c: In function ‘_nc_server_config_add_ssh_user_password’: /root/netconf/libnetconf2/src/server_config_util_ssh.c:501:12: warning: missing braces around initializer [-Wmissing-braces] struct crypt_data cdata = {0}; ^ /root/netconf/libnetconf2/src/server_config_util_ssh.c:501:12: warning: (near initialization for ‘cdata.keysched’) [-Wmissing-braces] /root/netconf/libnetconf2/src/server_config_util_ssh.c:501:12: warning: missing initializer for field ‘sb0’ of ‘struct crypt_data’ [-Wmissing-field-initializers] In file included from /root/netconf/libnetconf2/build/compat/compat.h:23:0, from /root/netconf/libnetconf2/src/session_p.h:28, [ 59%] Building C object CMakeFiles/netconf2.dir/src/session_client_tls.c.o [ 62%] Building C object CMakeFiles/netconf2.dir/src/session_server_tls.c.o [ 66%] Building C object CMakeFiles/netconf2.dir/src/server_config_util_tls.c.o [ 70%] Building C object CMakeFiles/netconf2.dir/src/server_config_ks.c.o [ 74%] Building C object CMakeFiles/netconf2.dir/src/server_config_ts.c.o [ 77%] Building C object CMakeFiles/netconf2.dir/src/session_openssl.c.o [ 81%] Building C object CMakeFiles/netconf2.dir/compat/compat.c.o [ 85%] Linking C shared library libnetconf2.so [ 85%] Built target netconf2 [ 88%] Building C object examples/CMakeFiles/server.dir/server.c.o [ 92%] Linking C executable server [ 92%] Built target server [ 96%] Building C object examples/CMakeFiles/client.dir/client.c.o [100%] Linking C executable client [100%] Built target client [ 85%] Built target netconf2 [ 92%] Built target server [100%] Built target client Install the project... -- Install configuration: "Release" -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2 -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/ietf-keystore@2023-12-28.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/iana-ssh-key-exchange-algs@2022-06-16.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/libnetconf2-netconf-server@2024-01-15.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/iana-tls-cipher-suite-algs@2022-06-16.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/ietf-truststore@2023-12-28.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/ietf-netconf-monitoring@2010-10-04.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/ietf-x509-cert-to-name@2014-12-10.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/ietf-ssh-common@2023-12-28.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/ietf-netconf-acm@2018-02-14.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/ietf-netconf-server@2023-12-28.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/ietf-ssh-server@2023-12-28.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/iana-crypt-hash@2014-04-04.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/ietf-tcp-server@2023-12-28.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/iana-ssh-public-key-algs@2022-06-16.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/ietf-tcp-client@2023-12-28.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/ietf-tls-server@2023-12-28.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/iana-ssh-mac-algs@2022-06-16.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/ietf-netconf@2013-09-29.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/iana-ssh-encryption-algs@2022-06-16.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/ietf-crypto-types@2023-12-28.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/ietf-tls-common@2023-12-28.yang -- Installing: /root/netconf/bin/share/yang/modules/libnetconf2/ietf-tcp-common@2023-12-28.yang -- Installing: /root/netconf/bin/lib64/libnetconf2.so.4.2.0 -- Installing: /root/netconf/bin/lib64/libnetconf2.so.4 -- Set non-toolchain portion of runtime path of "/root/netconf/bin/lib64/libnetconf2.so.4.2.0" to "" -- Installing: /root/netconf/bin/lib64/libnetconf2.so -- Installing: /root/netconf/bin/include/nc_client.h -- Installing: /root/netconf/bin/include/nc_server.h -- Installing: /root/netconf/bin/include/nc_version.h -- Installing: /root/netconf/bin/include/libnetconf2 -- Installing: /root/netconf/bin/include/libnetconf2/log.h -- Installing: /root/netconf/bin/include/libnetconf2/netconf.h -- Installing: /root/netconf/bin/include/libnetconf2/session.h -- Installing: /root/netconf/bin/include/libnetconf2/messages_client.h -- Installing: /root/netconf/bin/include/libnetconf2/messages_server.h -- Installing: /root/netconf/bin/include/libnetconf2/session_client.h -- Installing: /root/netconf/bin/include/libnetconf2/session_client_ch.h -- Installing: /root/netconf/bin/include/libnetconf2/session_server.h -- Installing: /root/netconf/bin/include/libnetconf2/session_server_ch.h -- Installing: /root/netconf/bin/include/libnetconf2/server_config.h -- Installing: /root/netconf/bin/lib64/pkgconfig/libnetconf2.pc

========== netopeer2 Compilation ========== Repo Located at /root/netconf/netopeer2 built binaries, headers, libs will be installed at /root/netconf/bin/

-- The C compiler identification is GNU 4.8.5 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Unable to learn libnetconf2 thread support, check skipped CMake Warning at CMakeLists.txt:185 (message): valgrind executable not found! Disabling memory leaks tests.

-- Could NOT find CMocka (missing: CMOCKA_LIBRARIES CMOCKA_INCLUDE_DIR) (Required is at least version "1.0.1") -- Disabling tests because of missing CMocka -- Could NOT find Uncrustify (missing: UNCRUSTIFY) (Required is at least version "0.77") -- if($LIBNETCONF2_LIBRARIES AND $LIBNETCONF2_INCLUDE_DIRS) -- Looking for _POSIX_TIMERS -- Looking for _POSIX_TIMERS - found -- Looking for pthread_mutex_timedlock -- Looking for pthread_mutex_timedlock - found -- Looking for pthread_mutex_clocklock -- Looking for pthread_mutex_clocklock - not found -- Looking for pthread_rwlock_clockrdlock -- Looking for pthread_rwlock_clockrdlock - not found -- Looking for pthread_rwlock_clockwrlock -- Looking for pthread_rwlock_clockwrlock - not found -- Looking for pthread_cond_clockwait -- Looking for pthread_cond_clockwait - not found -- Looking for vdprintf -- Looking for vdprintf - found -- Looking for asprintf -- Looking for asprintf - found -- Looking for vasprintf -- Looking for vasprintf - found -- Looking for getline -- Looking for getline - found -- Looking for strndup -- Looking for strndup - found -- Looking for strnstr -- Looking for strnstr - not found -- Looking for strdupa -- Looking for strdupa - found -- Looking for strchrnul -- Looking for strchrnul - found -- Looking for get_current_dir_name -- Looking for get_current_dir_name - found -- Looking for stdatomic.h -- Looking for stdatomic.h - not found -- Found OpenSSL: /root/openssl-3.0.13-build/lib64/libcrypto.so (found suitable version "3.0.13", minimum required is "3.0.0") -- Found LibSSH: /root/libssh-0.9.5-build/include (found suitable version "0.9.5", minimum required is "0.9.5") -- Looking for sigaction -- Looking for sigaction - found -- Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR) -- libcurl not found, url capability will not be supported -- Could NOT find LibSystemd (missing: LIBSYSTEMD_LIBRARY LIBSYSTEMD_INCLUDE_DIR) CMake Warning at CMakeLists.txt:312 (message): Disabling netopeer2-server systemd support because libsystemd was not found.

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE -- Found LibYANG: /root/netconf/bin/lib64/libyang.so (found suitable version "3.0.15", minimum required is "3.0.0") -- Found Sysrepo: /root/netconf/bin/lib64/libsysrepo.so (found suitable version "7.25.3", minimum required is "7.24.0") CMake Warning at CMakeLists.txt:433 (message): Server will refuse to start if the modules are not installed!

-- Looking for eaccess -- Looking for eaccess - found -- Looking for mkstemps -- Looking for mkstemps - found -- Configuring done (1.7s) -- Generating done (0.0s) CMake Warning: Manually-specified variables were not used by the project:

GENERATE_HOSTKEY
INSTALL_MODULES
MERGE_LISTEN_CONFIG
SYSREPOCFG_EXECUTABLE
SYSREPOCTL_EXECUTABLE

-- Build files have been written to: /root/netconf/netopeer2/build [ 4%] Building C object CMakeFiles/serverobj.dir/src/common.c.o [ 9%] Building C object CMakeFiles/serverobj.dir/src/netconf.c.o /root/netconf/netopeer2/src/netconf.c: In function ‘np2srv_rpc_copyconfig_cb’: /root/netconf/netopeer2/src/netconf.c:365:16: warning: unused variable ‘sr_data’ [-Wunused-variable] sr_data_t sr_data; [ 14%] Building C object CMakeFiles/serverobj.dir/src/netconf_monitoring.c.o [ 19%] Building C object CMakeFiles/serverobj.dir/src/netconf_nmda.c.o [ 23%] Building C object CMakeFiles/serverobj.dir/src/netconf_subscribed_notifications.c.o [ 28%] Building C object CMakeFiles/serverobj.dir/src/netconf_confirmed_commit.c.o /root/netconf/netopeer2/src/netconf_confirmed_commit.c: In function ‘ncc_commit_timeout_schedule’: /root/netconf/netopeer2/src/netconf_confirmed_commit.c:616:12: warning: missing braces around initializer [-Wmissing-braces] struct sigevent sev = {0}; ^ /root/netconf/netopeer2/src/netconf_confirmed_commit.c:616:12: warning: (near initialization for ‘sev.sigev_value’) [-Wmissing-braces] /root/netconf/netopeer2/src/netconf_confirmed_commit.c:616:12: warning: missing initializer for field ‘sigev_signo’ of ‘struct sigevent’ [-Wmissing-field-initializers] In file included from /usr/include/netdb.h:37:0, from /root/libssh-0.9.5-build/include/libssh/libssh.h:70, from /root/libssh-0.9.5-build/include/libssh/callbacks.h:28, from /root/netconf/bin/include/libnetconf2/session_server.h:31, from /root/netconf/bin/include/nc_server.h:31, from /root/netconf/netopeer2/src/common.h:27, from /root/netconf/netopeer2/src/netconf_confirmed_commit.h:26, from /root/netconf/netopeer2/src/netconf_confirmed_commit.c:20: /usr/include/bits/siginfo.h:304:9: note: ‘sigev_signo’ declared here int sigev_signo; ^ /root/netconf/netopeer2/src/netconf_confirmed_commit.c:617:12: warning: missing braces around initializer [-Wmissing-braces] struct itimerspec its = {0}; ^ /root/netconf/netopeer2/src/netconf_confirmed_commit.c:617:12: warning: (near initialization for ‘its.it_interval’) [-Wmissing-braces] /root/netconf/netopeer2/src/netconf_confirmed_commit.c:617:12: warning: missing initializer for field ‘it_value’ of ‘struct itimerspec’ [-Wmissing-field-initializers] In file included from /root/netconf/bin/include/libyang/tree_data.h:31:0, from /root/netconf/bin/include/libyang/context.h:23, from /root/netconf/bin/include/libyang/libyang.h:25, from /root/netconf/netopeer2/src/netconf_confirmed_commit.h:23, from /root/netconf/netopeer2/src/netconf_confirmed_commit.c:20: /usr/include/time.h:164:21: note: ‘it_value’ declared here struct timespec it_value; ^ [ 33%] Building C object CMakeFiles/serverobj.dir/src/log.c.o [ 38%] Building C object CMakeFiles/serverobj.dir/src/err_netconf.c.o [ 42%] Building C object CMakeFiles/serverobj.dir/src/msgqueue.c.o [ 47%] Building C object CMakeFiles/serverobj.dir/src/LoggerLib.c.o /root/netconf/netopeer2/src/LoggerLib.c: In function ‘init_cs_log_handler’: /root/netconf/netopeer2/src/LoggerLib.c:33:3: warning: implicit declaration of function ‘pthread_setname_np’ [-Wimplicit-function-declaration] pthread_setname_np(cs_logger_thread_id, "cslog_queue_thread");^M ^ /root/netconf/netopeer2/src/LoggerLib.c: In function ‘cslog_queue_monitor’: /root/netconf/netopeer2/src/LoggerLib.c:75:3: warning: implicit declaration of function ‘usleep’ [-Wimplicit-function-declaration] usleep(QUEUE_HANDLER_SLEEP_MICRO_SECS_10000);^M ^ /root/netconf/netopeer2/src/LoggerLib.c:57:33: warning: unused parameter ‘vargp’ [-Wunused-parameter] void cslog_queue_monitor(void *vargp)^M ^ [ 52%] Building C object CMakeFiles/serverobj.dir/src/LoggerApi.c.o In file included from /root/netconf/netopeer2/src/LoggerApi.c:1:0: /root/netconf/netopeer2/src/LoggerApi.h:17:12: warning: ‘cslog_mutex_flag’ defined but not used [-Wunused-variable] static int cslog_mutex_flag = 0; ^ /root/netconf/netopeer2/src/LoggerApi.h:18:24: warning: ‘cslog_mutex’ defined but not used [-Wunused-variable] static pthread_mutex_t cslog_mutex; ^ /root/netconf/netopeer2/src/LoggerApi.h:20:13: warning: ‘msgBuf’ defined but not used [-Wunused-variable] static char msgBuf[MAX_LOG_BUFF_LEN] = {0}; ^ [ 52%] Built target serverobj [ 57%] Building C object CMakeFiles/netopeer2-server.dir/src/main.c.o [ 61%] Building C object CMakeFiles/netopeer2-server.dir/compat/compat.c.o [ 66%] Linking C executable netopeer2-server /usr/bin/ld: warning: libcrypto.so.3, needed by /root/libssh-0.9.5-build/lib64/libssh.so, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libssl.so.3, needed by /root/netconf/bin/lib64/libnetconf2.so, not found (try using -rpath or -rpath-link)

michalvasko commented 6 months ago

So netopeer2 log:

/usr/bin/ld: warning: libcrypto.so.3, needed by /root/libssh-0.9.5-build/lib64/libssh.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libssl.so.3, needed by /root/netconf/bin/lib64/libnetconf2.so, not found (try using -rpath or -rpath-link)

meaning libssh is not compiled properly, its OpenSSL dependency and libnetconf2 also with its OpenSSL dependency. In both cases, when specifying the cmake variables manually, you need to link all the OpenSSL libraries (libssl.so and libcrypto.so). In any case, these problems are not specific to our projects and I try to help whenever I can but please try to solve these on your own first (the errors are quite obvious) before asking for help.