编译vmci程序

时间:2011-04-20 12:40:23

标签: linux gcc

我正在尝试编译vmware vmci示例程序。该计划分为两部分

a)内核模块 b)示例数据报程序

当我编译该数据报程序时,我得到了这些错误:

gcc -I headers_path datagramApp.c
/tmp/cc6KkQ4a.o: In function `main':
datagramApp.c:(.text+0x16c): undefined reference to `VMCI_InitApp'
datagramApp.c:(.text+0x1be): undefined reference to `VMCI_CleanupApp'
/tmp/cc6KkQ4a.o: In function `DoDatagramServer':
datagramApp.c:(.text+0x1e6): undefined reference to `VMCIDatagram_CreateHnd'
datagramApp.c:(.text+0x24f): undefined reference to `VMCIDs_Lookup'
datagramApp.c:(.text+0x2d7): undefined reference to `VMCIResource_AddClientPrivileges'
datagramApp.c:(.text+0x333): undefined reference to `VMCIDs_Register'
datagramApp.c:(.text+0x3bf): undefined reference to `VMCIDatagram_RecvFrom'
datagramApp.c:(.text+0x44f): undefined reference to `VMCIDatagram_SendTo'
datagramApp.c:(.text+0x4a8): undefined reference to `VMCIDs_Unregister'
datagramApp.c:(.text+0x4c0): undefined reference to `VMCIDatagram_DestroyHnd'
/tmp/cc6KkQ4a.o: In function `DoDatagramClient':
datagramApp.c:(.text+0x505): undefined reference to `VMCIDs_Lookup'
datagramApp.c:(.text+0x563): undefined reference to `VMCIDatagram_CreateHnd'
datagramApp.c:(.text+0x608): undefined reference to `VMCIResource_AddClientPrivileges'
datagramApp.c:(.text+0x680): undefined reference to `VMCIDatagram_SendTo'
datagramApp.c:(.text+0x6b8): undefined reference to `VMCIDatagram_RecvFrom'
datagramApp.c:(.text+0x6f7): undefined reference to `VMCIDatagram_DestroyHnd'

TNX

1 个答案:

答案 0 :(得分:0)

您需要链接(共享)对象以获取VMCI的用户界面

AFAICT这是来自Vmware(?)的专有API,你应该安装[1]

典型的编译行看起来更像是:

gcc -I <headers_path> datagramApp.c -lvmci

注释

  • 用类似的东西替换header_path(取决于构建模块的位置)
    • 的/ usr / src / linux中/包括
    • /选择器/ VMware /包括
  • -lvmci会建议在您的库路径中提供libvmci.so(请记住sudo ldconfig -a,可选择包含-L/path/to/libs以使gcc / ld找到它们)

[1]也许是Custom Installation of VMware Tools的一部分?