【问题标题】:MonetDB test client application not linkingMonetDB 测试客户端应用程序未链接
【发布时间】:2016-01-29 14:58:00
【问题描述】:

我尝试在 Ubuntu 14.04 LTS Trusty Tahr 下为 MonetDB 编译 test application。我按照official site的下载说明,安装成功,然后我安装了一堆其他的包来编译它。现在,当我尝试编译和链接测试应用程序时,出现以下错误:

libtool: compile:  gcc -c -I/usr/include/monetdb test.c  -fPIC -DPIC -o .libs/test.o
libtool: compile:  gcc -c -I/usr/include/monetdb test.c -o test.o >/dev/null 2>&1
libtool: link: gcc -o test test.o  -lmapi -lstream -lssl -lcrypto -lcurl -lz
test.o: In function `die':
test.c:(.text+0x1c): undefined reference to `mapi_explain_query'
test.c:(.text+0x27): undefined reference to `mapi_result_error'
test.c:(.text+0x3f): undefined reference to `mapi_explain_result'
test.c:(.text+0x4a): undefined reference to `mapi_next_result'
test.c:(.text+0x5a): undefined reference to `mapi_close_handle'
test.c:(.text+0x65): undefined reference to `mapi_destroy'
test.c:(.text+0x81): undefined reference to `mapi_explain'
test.c:(.text+0x8c): undefined reference to `mapi_destroy'
test.o: In function `query':
test.c:(.text+0xde): undefined reference to `mapi_query'
test.c:(.text+0xf2): undefined reference to `mapi_error'
test.o: In function `update':
test.c:(.text+0x133): undefined reference to `mapi_close_handle'
test.o: In function `main':
test.c:(.text+0x190): undefined reference to `mapi_connect'
test.c:(.text+0x1a0): undefined reference to `mapi_error'
test.c:(.text+0x222): undefined reference to `mapi_fetch_field'
test.c:(.text+0x23a): undefined reference to `mapi_fetch_field'
test.c:(.text+0x266): undefined reference to `mapi_fetch_row'
test.c:(.text+0x276): undefined reference to `mapi_close_handle'
test.c:(.text+0x282): undefined reference to `mapi_destroy'
collect2: error: ld returned 1 exit status
./t.sh: 11: ./t.sh: ./test: not found

我做错了什么?我应该额外安装或更改编译选项以成功链接测试示例?

【问题讨论】:

    标签: c linux ubuntu monetdb


    【解决方案1】:

    在使用以下命令安装(附加)包libmonetdb-client-dev 后,我能够在 Ubuntu 14.04 上使用从 Ubuntu 二进制包安装的 MonetDB 编译示例:

    gcc test.c -I /usr/include/monetdb -lmapi
    

    您是否从源代码编译和安装 MonetDB?在这种情况下,使用了哪个前缀?

    【讨论】:

    • 我使用了 MonetDB 官方存储库中的二进制包。不幸的是,您的变体并没有为我解决问题,但非常感谢您的帮助!我想我会转移到 PostgreSQL 来解决这个问题 :)
    • 那么现在有什么问题?
    • 当我尝试你的编译命令时,错误是一样的:multiplie "undefined reference to `mapi_XXXXX'" 错误。
    • 是的,我肯定已经安装了它(我已经运行 apt-get 来安装该软件包,后来在突触软件包管理器中看到它已安装)。谢谢你的帮助,汉内斯!我认为我的操作系统副本有问题,如果您可以在相同版本的相同版本上成功编译。
    【解决方案2】:

    这里是使用 ubuntu 18.04 的工作原理

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-09-07
      • 2019-01-09
      • 1970-01-01
      • 1970-01-01
      • 2010-12-11
      • 2014-01-30
      • 1970-01-01
      • 2015-01-08
      相关资源
      最近更新 更多