I'm trying to learn some libuv and it seems there's a great book that goes through it. However, the book doesn't explain how to actually compile it. I ran make on the code that I pulled from github, and compiled with GYP as described on the github (https://github.com/joyent/libuv). However I'm not sure what kind of libraries I need to include to get the code to compile. I tried to compile this code:
/* 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;
}
I compiled it with the following command from the libuv
folder:
gcc -o first first.c build/Release/libuv.a
and I got the following missing symbols:
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
Can someone give me a quick tutorial for how to build libuv, or if there's anything else I need?