Cpp-exe: installMain

The documentation states:

48.5. Working with shared libraries

The C++ plugin provides an installMain task, which creates a development install of the executable, along with the shared libraries it

requires. This allows you to run the executable without needing to install the shared libraries in their final locations.

However, if I have a cpp-exe project which has an external dependency on a cpp-lib project (using an Ivy repository) I find that I can’t run the created executables from neither installMain or compileMain.

This appears to be the case because there is no .so file included in the build directory. It is however uploaded correctly to the Ivy repository so my expectation is that it should work.

I’ve looked at the examples and I can’t work out what I am missing.

apply plugin: ‘java’

apply plugin:‘application’

apply plugin: ‘cpp-exe’



dependencies {



cpp {

sourceSets {

main {

dependency group: “org.x”, name: “a”, version: “1.0.0”



} … (and an uploadArchives and repositories declaration, implemented for the Java plugi)

I have tried disabling the java/application plugins but it doesn’t matter, so there does not appear to be any interference from that.

The error I get is:


build/install/main/lib/m: error while loading shared libraries: liba.so: cannot open shared object file: No such file or directory

While in the repository I find:

$ ls

a-1.0.0-headers.zip a-1.0.0-headers.zip.sha1 a-1.0.0.jar a-1.0.0.jar.sha1 a-1.0.0-so.so a-1.0.0-so.so.sha1 a-ivy-1.0.0.xml a-ivy-1.0.0.xml.sha1

In the build directory I find the headers downloaded ok, but no trace of the so.

Hi Per,

I’m afraid this is an issue with our current c++ support. It’s covered by GRADLE-2211 and GRADLE-2212.