1
votes

I have tried to compile the code shown here:

But I got a linking error.
I tried the solution mention here.

But again, I got this error:

gcc main.c -I /usr/include/monetdb -lmapi
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to SHA224_Update'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
mnstr_settimeout'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to socket_rastream'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
mnstr_destroy'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to SHA384_Init'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
MD5_Final'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to RIPEMD160_Init'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
mnstr_errnr'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to RIPEMD160_Update'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
SHA384_Update'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to SHA224_Init'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
SHA256_Init'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to SHA512_Update'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
mnstr_init'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to block_stream'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
mnstr_write'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to SHA384_Final'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
SHA1_Update'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to mnstr_error'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
SHA512_Final'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to SHA256_Final'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
mnstr_flush'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to SHA1_Init'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
SHA224_Final'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to mnstr_read_block'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
mnstr_printf'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to SHA256_Update'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
isa_block_stream'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to mnstr_set_byteorder'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
mnstr_read'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to socket_wastream'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
MD5_Init'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to RIPEMD160_Final'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
close_stream'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to MD5_Update'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
SHA1_Final'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to open_wastream'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
SHA512_Init'
collect2: error: ld returned 1 exit status

When I tried the solution mention here:

pkg-config --libs monetdb-mapi and pkg-config --cflags monetdb-mapi

I got this error:

The package bzip2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `bzip2.pc' to the PKG_CONFIG_PATH environment variable.
Package 'bzip2', required by 'monetdb-stream', not found

which, after a search, I found, that Debian doesn't have a bzip2.pc.
I have installed the following libraries:

sudo apt-get install libmonetdb-client-dev
sudo apt-get install libmonetdb-stream-dev
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install liblzma-dev

So any help would be appreciated.
My Ubuntu version is 18.04

1
It looks like you are missing linking with libSSL (e.g. -lssl, and possibly -lcrypto) look at what is not found, e.g. "undefined reference to SHA224_Update". See SHA224_UpdateDavid C. Rankin
Thanks a lot for your helpMahmoud Mohsen

1 Answers

0
votes

Thanks to what @David C. Rankin mentioned the linking problem vanished: Here is the full command:

gcc main.c -I /usr/include/monetdb -lmapi -lssl -lcrypto -lstream -lcurl -llzma -lbz2