【问题标题】:driver in globus toolkitglobus 工具包中的驱动程序
【发布时间】:2014-05-04 04:38:40
【问题描述】:

我一直在尝试运行 globus 工具包网站中给出的示例驱动程序。这是程序:

#include "globus_xio.h"

int main(int argc,char *argv[])
{
    globus_result_t                 res;
    char *                          driver_name;
    globus_xio_driver_t             driver;
    globus_xio_stack_t              stack;
    globus_xio_handle_t             handle;
    globus_size_t                   nbytes;
    char *                          contact_string = NULL;
    char                            buf[256];

    contact_string = argv[1];
    driver_name = argv[2];

    globus_module_activate(GLOBUS_XIO_MODULE);
    res = globus_xio_driver_load(driver_name,&driver);
    assert(res == GLOBUS_SUCCESS);

    res = globus_xio_stack_init(&stack, NULL);
    assert(res == GLOBUS_SUCCESS);
    res = globus_xio_stack_push_driver(stack, driver);
    assert(res == GLOBUS_SUCCESS);

    res = globus_xio_handle_create(&handle, stack);
    assert(res == GLOBUS_SUCCESS);

    res = globus_xio_open(handle, contact_string, NULL);
    assert(res == GLOBUS_SUCCESS);

    do
    {
        res = globus_xio_read(handle, buf, sizeof(buf) - 1, 1, &nbytes, NULL);
        if(nbytes > 0)
        {
            buf[nbytes] = '\0';
            fprintf(stderr, "%s", buf);
        }
    } while(res == GLOBUS_SUCCESS);

    globus_xio_close(handle, NULL);

    globus_module_deactivate(GLOBUS_XIO_MODULE);

    return 0;
}

当我使用命令编译它时
cc -I /usr/include/globus globus_xio_example.c
我收到以下错误

/tmp/ccLMLlli.o:在函数“main”中: globus_xio_example.c:(.text+0x57): undefined reference to `globus_i_xio_module' globus_xio_example.c:(.text+0x5c): undefined reference to `globus_module_activate' globus_xio_example.c:(.text+0x75): undefined reference to `globus_xio_driver_load' globus_xio_example.c:(.text+0xb1): 未定义的对 `globus_xio_stack_init' 的引用 globus_xio_example.c:(.text+0xf2): undefined reference to `globus_xio_stack_push_driver' globus_xio_example.c:(.text+0x133): undefined reference to `globus_xio_handle_create' globus_xio_example.c:(.text+0x179): undefined reference to `globus_xio_open' globus_xio_example.c:(.text+0x1d1): undefined reference to `globus_xio_read' globus_xio_example.c:(.text+0x22b): undefined reference to `globus_xio_close' globus_xio_example.c:(.text+0x230): undefined reference to `globus_i_xio_module' globus_xio_example.c:(.text+0x235): undefined reference to `globus_module_deactivate' collect2: ld 返回 1 个退出状态

【问题讨论】:

    标签: c grid globus-toolkit


    【解决方案1】:

    看来编译的命令不够用:

    cc -I /usr/include/globus globus_xio_example.c
    

    具体来说,链接器进程指示有许多符号无法解析。我怀疑用于编译的命令缺少关于需要链接哪些库来解析未定义符号的指令。


    提示:
    使用“globus-makefile-header”来帮助确定库依赖关系。

    % globus-makefile-header -flavor=gcc32dbg globus_xio > header
    

    检查 'header' 的内容以获得适当的 makefile 宏。
    在您的 makefile 中包含 header 并使用所需的 makefile 宏。

    【讨论】:

    • 当我这样做时,我得到输出:没有找到与您的查询匹配的包!
    【解决方案2】:

    试试这个gcc -I /usr/include/globus globus_xio_example.c -lglobus_xio -lglobus_common

    【讨论】:

      猜你喜欢
      • 2018-06-07
      • 2015-01-05
      • 1970-01-01
      • 2022-01-10
      • 2020-01-11
      • 2023-04-03
      • 1970-01-01
      • 2014-11-05
      • 2019-02-18
      相关资源
      最近更新 更多