Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Linking with libuv #609

peters opened this Issue · 8 comments

3 participants



It would be great if you guys could add an example of how one could link with libuv using gyp. Because when you add libuv to 'dependencies' I get the following error message:

gyp: Undefined variable library in deps/libuv/uv.gyp while loading dependencies of digterm.gyp while trying to load digterm.gyp

So how could one get this to work? I've been googling and reading your irc logs, but I just can't get it to work. Even tried defining 'library%' : 'static_library' in my common.gypi (Same way node does it). But still the same error message.

Then i tried using -Dstatic_library, but then it spits out: ../deps/libuv/src/fs-poll.c:22:16: fatal error: uv.h: No such file or directory even if I've added libuv to 'includes'.

Some help would be appreciated :)

Using latest from master, and building on Ubuntu 12.10.


gyp -Dlibrary=static_library --depth=$PWD digterm.gyp should do it. If you keep running into issues, can you post your gyp file and the exact steps you took, including the output of make V=1?


No follow-up, closing.

@bnoordhuis bnoordhuis closed this

Got the same error when trying to to link to libuv I got the same error (OSX 10.8, clang 3.3):

% make V=1
/usr/local/bin/clang -MMD -MF out/Debug/.deps/out/Debug/ -c -o out/Debug/ deps/libuv/src/fs-poll.c

deps/libuv/src/fs-poll.c:22:10: fatal error: 'uv.h' file not found
#include "uv.h"
1 error generated.
make: *** [out/Debug/] Error 1

The contents of my gyp file are:

  'target_defaults': {
    'default_configuration': 'Debug',
    'configurations': {
      'Debug': {
        'defines': [ 'DEBUG', '_DEBUG' ],
      'Release': {
        'defines': [ 'NDEBUG' ],
    'include_dirs': [

  'targets': [
      'target_name': 'project',
      'type': 'executable',
      'dependencies': [
      'sources': [

And I generate the Makefile with the following command:

deps/gyp/gyp --format=make -Dlibrary=static_library --depth=$PWD project.gyp

Another thing I've noticed is an error after invoking gyp, but I'm not sure if it's a gyp problem or cause by your gyp file:

$ deps/gyp/gyp --format=make -Dlibrary=static_library --depth=$PWD project.gyp
2013-08-13 22:05:24.496 xcodebuild[74416:1207] error: (null)

Any ideas what the problem could be?


@vongruenigen There is a long explanation as to why gyp works the way it does but I'll spare you that. The executive summary is: if you split up your gyp file into a common.gypi and your-project.gyp, then run gyp with -Icommon.gypi, there's a pretty good chance it'll work.


@bnoordhuis Ok, I'll give it a try, thanks.


@bnoordhuis, it worked, thanks! :+1: But I'm still confused on why it requires a common.gypi file.. do you know where I can find good resources about how gyp works in detail?


It sounds corny but your best bet is probably the source. Either that or the mailing list because documentation is pretty much non-existing.

As to why you need a common.gypi, without it your sub-projects don't share a common configuration with the main project and instead use a default configuration (which usually doesn't do what you want.)


I was expecting that..but anyway, thanks a lot for your help! :+1:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.