Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bhuvanplus opened this issue Mar 12, 2024 · 3 comments

Comments

@bhuvanplus
Copy link

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
Copy link
Member

vances commented Mar 12, 2024

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

@bhuvanplus
Copy link
Author

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
Copy link
Member

vances commented Mar 13, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants