How to exclude a library from the link line of a shared object?

9 views
Skip to first unread message

asharif

unread,
Apr 23, 2012, 1:50:17 PM4/23/12
to gyp-de...@googlegroups.com
I am building Chromium's _pyautolib.so file, whose generated *.mk file pulls in a particular library (liballocator.a). I understand that this particular library is pulled in because a variable is set (linux_use_tcmalloc). What I want to do is, just for this particular shared object, I want to not include liballocator.a.

By looking at the gyp file which generates _pyautolib.so (http://src.chromium.org/svn/trunk/src/chrome/chrome_tests.gypi search on this page for pyautolib), you can see that it doesn't directly pull in this library. Rather, a few of the dependencies that it lists pull in that library.

I've tried the following approaches without success:

'all_dependent_settings': {
  'dependencies!' : [
  '../base/allocator/allocator.gyp:allocator'
]
}

and this one:

'all_dependent_settings': {
  'linux_use_tcmalloc' : '0'
}

These aren't seem to be working (i.e. liballocator.a still shows up at the link line of _pyautolib.so). Do you have any suggestions on how this can be done without refactoring all the libraries and separating them out into parts which depend on liballocator and parts which don't?

Thanks,

Ryan Sleevi

unread,
Apr 23, 2012, 3:37:41 PM4/23/12
to asharif, gyp-de...@googlegroups.com
You cannot revoke a GYP dependency that has been injected from a lower layer, particularly when it's multiple layers removed. IIRC, for Pyauto's case, base/allocator/allocator.gyp flows from base/base.gyp.

Since these dependencies can have an effect on how dictionary merging is performed - they may set custom defines, add new dependencies, etc - there's no reasonable way to "unmerge" the dictionaries.

If your pyauto target does not build when 'linux_use_tcmalloc': '1' is true, then it sounds like you should instead be excluding that target from Chromium builds where that is the case, and setup new Chromium bots to build _pyautolib.so and explicitly specify 'linux_use_tcmalloc': '0'.

For Chromium, it's especially problematic to mix and match allocators, so this may be your best bet.
Reply all
Reply to author
Forward
0 new messages