sigscale / snmp-collector

SNMP Manager for 3GPP Alarm IRP
Apache License 2.0
10 stars 0 forks source link

make is failing with an error "invalid application of ‘sizeof’ to incomplete type ‘EVP_MD_CTX’" #1

Open bhuvanplus opened 6 months ago

bhuvanplus commented 6 months ago

I have followed the procedure explained in the file README.maintainer. All the steps till "make" have succeeded. The " make " command throws the following error "invalid application of ‘sizeof’ to incomplete type ‘EVP_MD_CTX’ {aka ‘struct evp_md_ctx_st’}". Please help me in resolving this issue.

/usr/local/bin/erlc -W -v -I ../../snmp-collector/include -I ../include ../../snmp-collector/src/snmp_collector_manager_fsm.erl
/usr/local/bin/erlc -W -v -I ../../snmp-collector/include -I ../include ../../snmp-collector/src/snmp_collector_manager_fsm_sup.erl
/usr/local/bin/erlc -W -v -I ../../snmp-collector/include -I ../include ../../snmp-collector/src/snmp_collector_manager_server.erl
/usr/local/bin/erlc -W -v -I ../../snmp-collector/include -I ../include ../../snmp-collector/src/snmp_collector_manager_sup_sup.erl
/usr/local/bin/erlc -W -v -I ../../snmp-collector/include -I ../include ../../snmp-collector/src/snmp_collector_manager_port_sup.erl
/usr/local/bin/erlc -W -v -I ../../snmp-collector/include -I ../include ../../snmp-collector/src/snmp_collector_manager_sup.erl
make[2]: Leaving directory '/home/bhuvan/git/snmp_collector.build/ebin'

Making all in c_src
make[2]: Entering directory '/home/bhuvan/git/snmp_collector.build/c_src'
/bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../snmp-collector/c_src -I..   -I/include -I/usr/local/lib/erlang/erts-14.1.1/include  -g -O2 -Wall -MT snmp_collector_usm.lo -MD -MP -MF .deps/snmp_collector_usm.Tpo -c -o snmp_collector_usm.lo ../../snmp-collector/c_src/snmp_collector_usm.c

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../snmp-collector/c_src -I.. -I/include -I/usr/local/lib/erlang/erts-14.1.1/include -g -O2 -Wall -MT snmp_collector_usm.lo -MD -MP -MF .deps/snmp_collector_usm.Tpo -c ../../snmp-collector/c_src/snmp_collector_usm.c  -fPIC -DPIC -o .libs/snmp_collector_usm.o

../../snmp-collector/c_src/snmp_collector_usm.c: In function ‘ku_nif’:
../../snmp-collector/c_src/snmp_collector_usm.c:165:32: **error: invalid application of ‘sizeof’ to incomplete type ‘EVP_MD_CTX’ {aka ‘struct evp_md_ctx_st’}**
  165 |                         sizeof(EVP_MD_CTX))) == NULL))
      |                                ^~~~~~~~~~

make[2]: *** [Makefile:462: snmp_collector_usm.lo] Error 1
make[2]: Leaving directory '/home/bhuvan/git/snmp_collector.build/c_src'
make[1]: *** [Makefile:435: all-recursive] Error 1
make[1]: Leaving directory '/home/bhuvan/git/snmp_collector.build'
make: *** [Makefile:365: all] Error 2
bhuvan@vm-alarm:~/git/snmp_collector.build$ 
vances commented 6 months ago

This is an issue with OpenSSL, I would guess that you are using a newer version than this code supports.

bhuvanplus commented 5 months ago

Thanks for a quick response.

I am using Ubuntu 22.04.2 LTS & openssl 3.0.2-0ubuntu1.15 which is around 2 yrs old.

I see snmp-collector/c_src/snmp_collector_usm.c has compiler check for the older openssl version "OpenSSL < v1.1.0". From this, I this understood that snmp-collector supports the latest version such as 3.x as well.

Do you think that openssl 3.0.2 is the reason for the error "error: invalid application of ‘sizeof’ to incomplete type ‘EVP_MD_CTX’"?

vances commented 5 months ago

Totally. The check is for portability between openssl 1.1.0 and older versions. Version 1.1.0 was current at that time. I'm sure it's not difficult to support openssl 3.0.2, however I don't have the time right at the moment.