使用C代码链接错误以连接到Monetdb

时间:2018-09-10 15:11:51

标签: c gcc linker-errors mapi monetdb

我试图编译here所示的代码:

但是我出现了链接错误。
我尝试了解决方案提及here

但是,再次出现此错误:

  

gcc main.c -I / usr / include / monetdb -lmapi
  /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so:未定义对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:对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:对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:对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:对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:未定义对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:对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:对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:未定义对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:对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:未定义对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:未定义对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:对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:对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:对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:未定义对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:对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:未定义对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:未定义对open_wastream'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libmapi.so: undefined reference to
SHA512_Init的引用'
  collect2:错误:ld返回1退出状态

当我尝试解决方案时,请提及here

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

我收到此错误:

  

bzip2搜索路径中找不到包pkg-config
  也许您应该将包含“ bzip2.pc”的目录添加到PKG_CONFIG_PATH环境变量中。
  找不到'monetdb-stream'所需的软件包'bzip2'

在搜索后,我发现Debian没有bzip2.pc
我已经安装了以下库:

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

因此,我们将不胜感激。
我的Ubuntu版本是18.04

1 个答案:

答案 0 :(得分:0)

感谢@David C. Rankin提到的链接问题消失了: 这是完整的命令:

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