Part referencing other part?

Awesome! You know where to find us if you have more questions :slight_smile: .

Hi, has anybody tried this lately?

Some of the packages in my ROS workspace need a library that is provided through a previously staged part, more or less as follows:

parts:
  library:
    plugin: dump
    source: /foo/bar/library
    override-build: |
      snapcraftctl build
      ./install_snap.sh # This basically creates some symbolic links and copy the files where needed
    stage:
      - usr/*
      - etc/*
  ros-workspace:
    plugin: catkin
    rosdistro: indigo
    source-space: /foo/bar/catkin_ws/src 
    catkin-packages:
      - package A
      - package B # Some of these packages have to be linked against the previously staged library
      - ...
      - package N
    catkin-cmake-args:
      - -DCMAKE_LIBRARY_PATH=$SNAPCRAFT_STAGE/usr/local/lib
    after: [library]

According to this post it should work, however, the linking fails since the DCMAKE_LIBRARY_PATH seems to be ignored. I can check that the parameter is properly taken by the plugin but not sure if it is doing something with it. I also can check how the library is properly staged by the part.

Is it necessary to adapt the /etc/ld.so.conf at the host or staged to make it visible for ldd?

For now, in order to solve that, I had to modify the CMakeList.txt and include the absolute path to the libraries part when linking with something like $SNAPCRAFT_STAGE/use/local/lib/libfoo.so.

@mbeneto without using after you have no guarantee that library is staged before ros-workspace is built. If you add that, does it change anything?

@kyrofa, Iā€™m already using after in the real yaml, I just forgot to add it into this dummy example.