库在os x上编译libuv?
发布时间:2020-12-16 10:33:21 所属栏目:百科 来源:网络整理
导读:我正在尝试学习一些libuv,似乎有一本很棒的书可以通过它.但是,这本书没有解释如何实际编译它.我在 github上提取的代码上运行make,并使用github( https://github.com/joyent/libuv)中描述的GYP编译.但是我不确定我需要包含哪些库来编译代码.我试着编译这段代
我正在尝试学习一些libuv,似乎有一本很棒的书可以通过它.但是,这本书没有解释如何实际编译它.我在
github上提取的代码上运行make,并使用github(
https://github.com/joyent/libuv)中描述的GYP编译.但是我不确定我需要包含哪些库来编译代码.我试着编译这段代码:
/* first.c */ #include <stdio.h> #include <uv.h> int main() { uv_loop_t *loop = uv_loop_new(); printf("Now quitting.n"); uv_run(loop,UV_RUN_DEFAULT); return 0; } 我使用libuv文件夹中的以下命令编译它: gcc -o first first.c build/Release/libuv.a 我得到了以下缺少的符号: Undefined symbols for architecture x86_64: "_CFArrayCreate",referenced from: _uv__fsevents_init in libuv.a(fsevents.o) "_CFRunLoopAddSource",referenced from: _uv__cf_loop_runner in libuv.a(darwin.o) "_CFRunLoopGetCurrent",referenced from: _uv__cf_loop_runner in libuv.a(darwin.o) "_CFRunLoopRemoveSource",referenced from: _uv__cf_loop_runner in libuv.a(darwin.o) "_CFRunLoopRun",referenced from: _uv__cf_loop_runner in libuv.a(darwin.o) "_CFRunLoopSourceCreate",referenced from: _uv__platform_loop_init in libuv.a(darwin.o) "_CFRunLoopSourceSignal",referenced from: _uv__cf_loop_signal in libuv.a(darwin.o) "_CFRunLoopStop",referenced from: _uv__platform_loop_delete in libuv.a(darwin.o) "_CFRunLoopWakeUp",referenced from: _uv__cf_loop_signal in libuv.a(darwin.o) "_CFStringCreateWithCString",referenced from: _uv__fsevents_init in libuv.a(fsevents.o) "_CFStringGetSystemEncoding",referenced from: _uv__fsevents_init in libuv.a(fsevents.o) "_FSEventStreamCreate",referenced from: _uv__fsevents_init in libuv.a(fsevents.o) "_FSEventStreamInvalidate",referenced from: _uv__fsevents_close in libuv.a(fsevents.o) "_FSEventStreamRelease",referenced from: _uv__fsevents_close in libuv.a(fsevents.o) "_FSEventStreamScheduleWithRunLoop",referenced from: _uv__fsevents_schedule in libuv.a(fsevents.o) "_FSEventStreamStart",referenced from: _uv__fsevents_schedule in libuv.a(fsevents.o) "_FSEventStreamStop",referenced from: _uv__fsevents_close in libuv.a(fsevents.o) "_kCFRunLoopDefaultMode",referenced from: _uv__cf_loop_runner in libuv.a(darwin.o) _uv__fsevents_schedule in libuv.a(fsevents.o) ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status 有人可以给我一个关于如何构建libuv的快速教程,或者我还需要什么? 解决方法
通过自制软件安装libuv:
$gcc -luv main.c (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |