name: my-lib
apps:
library-sample:
command: library_sample $SNAP/arg_file.json
parts:
library:
source: https://github.com/the/sample.git
plugin: cmake
install: |
cp -r samples/library_sample $SNAPCRAFT_PART_INSTALL/
cp -r ../src/samples/src/arg_file.json $SNAPCRAFT_PART_INSTALL/
cp --parents modules/dep_lib1/libdep_lib1.so $SNAPCRAFT_PART_INSTALL/
cp --parents modules/dep_lib2/libdep_lib2.so $SNAPCRAFT_PART_INSTALL/
When I create this snap, I am able to run my-lib.library_sample
. However, when the sample tries to load the dependency libraries using a relative path, it fails using the path ./modules/dep_lib1/libdep_lib1.so
My install folder looks as I expect:
parts/library/install/
|-- arg_file.json
|-- library-sample
|-- include
| |-- ...
|-- lib
| |-- ...
|-- modules
|-- dep_lib1
| |-- libdep_lib1.so
|-- dep_lib2
|-- libdep_lib2.so
If you look at the command:
for library-sample:
, you can see that I needed to prefix the relative path with $SNAP
in order to get the sample to load arg_file.json
correctly. However, there are relative paths specified for the dependency libraries inside the argument file that I cannot prefix.
How can I resolve relative paths from within a snap package?