How to build a dependency for a part

Dear List,

I am currently getting started with my first snapcraft build.

I have to link my application against a library which I also want to be built from source. How do I do that? Building the library as an extra part seems to not install it into the right location (I see that it is being built though, and installed into a directory which seems to be part-specific). The library is not found while the main application is being built.

Here is the relevant part of my yaml:

    source: libssrckdtree-1.0.8
    source-type: local
    plugin: autotools
        - libssrckdtree      
    source-type: hg
    plugin: scons

Sorry for this probably very basic question, any pointer appreciated!

the output of the first part should end up in the stage/ subdir of your source tree during build, snapcraft automatically adds that dir to your build environment of the part that defines after:

Thanks for your reply, ogra, but I am not sure if I understand (total newbie). So do you expect my setup to actually work? This is a sample for an “install” as issued by the build system of the library:

/usr/bin/install -c -m 644 ssrc/libssrckdtree-packages.h ssrc/libssrckdtree-config.h '/root/parts/libssrckdtree/install/include/ssrc'

This does not look to me like it is place which can be found by the subsequent builders.

add something like the following:

    override-build: |
      snapcraftctl build

that should print out the content of your stage dir before starting the scons build …

Is the stage-dir is something like the “/usr”-dir, as it is set up during the build time of the package?

The stage dir is a place that parts are installed into once they are built. The snap is then created from the files within the stage dir (after they are linked into the prime dir to allow for any final customisations by override scripts).

So there is one stage dir per part, then?
Under /root/parts/, is that the stage dirs?

ogra, your suggested edit did not produce any additional output as far as I can tell. But I checked /root/parts/afry, and it has no trace of libssrckdtree artifacts. If I understand your first reply correctly, you expected this this to be the case?

the parts dirs are really only used for the specific part … you wont find any bits from other parts in them … as @lucyllewy said above, the stage dir is the one where bits get shared and later copied into the prime dir … i.e. after a build your directory structure in your source tree should look like:

ls -l
drwxr-xr-x 4 root root     4096 Feb 11 14:17 parts
drwxr-xr-x 8 root root     4096 Feb  9 14:13 prime
drwxr-xr-x 3 root root     4096 Feb 12 12:14 snap
drwxr-xr-x 6 root root     4096 Feb  9 14:13 stage 

Ok. I see that stage/include and stage/lib actually do contain the artifacts of the library build. So what does snapcraft do that these are actually transformed to “-I” and “-L” directives for the build of my application? I think now that the problem is the scons build. All scons builds are different, and there is no well established interface like with autotools.