I am trying to install an open source project on my ubuntu 13:04 but the make process fails on a method in a class called updateDB.c. During compilation, i have this error :
updateDB.o: In function `update_cache_hash':
/usr/local/src/bgpinspect-0.5/src/updateDB.c:142: undefined reference to `EVP_DigestUpdate'
/usr/local/src/bgpinspect-0.5/src/updateDB.c:143: undefined reference to `EVP_DigestFinal_ex'
collect2: error: ld returned 1 exit status
make[1]: *** [BGPdb] Error 1
make[1]: Leaving directory `/usr/local/src/bgpinspect-0.5/src'
make: *** [all] Error 2
This is the method update_cache_hash that fails :
static uint16_t update_cache_hash( char *buff, int size ) {
unsigned char md_hash[EVP_MAX_MD_SIZE];
unsigned int md_len;
uint16_t hash;
EVP_DigestUpdate(&global_table.ctx, buff, size );
EVP_DigestFinal_ex(&global_table.ctx, md_hash, &md_len);
if ( md_len < 2 ) {
ps_log( PS_LOG_ERROR, "EVP_DigestFinal_ex returned a short hash.\n" );
return 0;
}
hash = ( (uint16_t) md_hash[md_len - 2] << 8 ) | md_hash[md_len - 1];
hash = UPDATE_CACHE_MASK( hash );
return hash;
}
The top of this class has an include statement
#include <openssl/evp.h>
I have openssl installed on my computer alongside libssl-dev ; I can't figure out why it gives that error since i am new with c and static links etc. I have evp.h on this path : /usr/include/openssl/evp.h
So how may i change the makefile or configure to maybe fix this issue ? because it seems make can't see this path /usr/include/openssl/evp.h
The undefined reference
error is a linker error, so it appears that gcc
is finding /usr/include/openssl/evp.h
but the linker is unable to find the library that has the EVP_DigestUpdate
and EVP_DigestFinal_ex
functions.
I'd check that the makefile in question has an -lcrypto
argument and that make
is finding the right libcrypto
on your system.