# Linking native executables having transitive dependencies

**URL:** <https://discuss.gradle.org/t/linking-native-executables-having-transitive-dependencies/26067>\
**Category:** Help/Discuss\
**Created:** [March 2, 2018, 3:42pm UTC](https://discuss.gradle.org/t/linking-native-executables-having-transitive-dependencies/26067 "2018-03-02T15:42:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kalaand](https://avatars.discourse-cdn.com/v4/letter/k/dbc845/32.png) [@kalaand](https://discuss.gradle.org/u/kalaand)\
**Post date:** [March 2, 2018, 3:42pm UTC](https://discuss.gradle.org/t/linking-native-executables-having-transitive-dependencies/26067/1 "2018-03-02T15:42:22Z")

</div>

Hi,

We’re trying to build some big native c++ project on linux/gcc with ~300 libs and ~500 executables.  
Consider executable A depends on library B, and library B depends on library C (for simplicity, consider they are are all from the same project).  
When gradle links A with option -l it has also provide -rlink-path= option (and so on for other transitive dependencies). However, gradle doesn’t add -rlink-path option for transitive dependencies.

Solution we have now is to copy all libraries to a single directory once they are built, and add -rlink-path= as linker.args.

May be there is a better solution for that? We use “cpp” plugin to build, and use “lib project:xxx, library:yyy” on cpp source sets to define depencies between libraries and executables.

Andrey
