FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important
information on the platform change.
04-07-2022 08:42 AM
Good Morning,
i have a applikation /binary which i want to pack to a SNAP. I setup a Linux VM on my PC (amd64).
to execute my app directly i have to setup the dynamic-runtime linker in order to copy my own config file with lib pathes to
cp myConfigFileWithPathes.conf /etc/ld.so.conf.d/
ldconfig
after thas. i can create a SNAP on my VM target , and i can this snap...
So my question:
But how can i do this for a SNAP on a xCtrl Hardware? How can i setup my snapcraft, that the dynamic linker pathes will autmatice setup according to the target!? I read about the $LD_CONFIG_PATH
I tried so something like that in my app in the snap yaml (but it does not work)
environment:
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:my_pathes_from_the_config_file
This part is missing libraries that cannot be satisfied with any available stage-packages known to snapcraft:
- home/xctrlvm/AppEngine/drivers/halcon/libhalcon.so.20.11.1
- home/xctrlvm/AppEngine/drivers/halcon/libhalconc.so.20.11.1
- home/xctrlvm/AppEngine/drivers/halcon/libhalconcpp.so.20.11.1
- home/xctrlvm/AppEngine/drivers/halcon/libhdevenginecpp.so.20.11.1
- home/xctrlvm/AppEngine/libeuler_log_frontend.so.1
- home/xctrlvm/AppEngine/libeuler_plugin_loader.so.1
Solved! Go to Solution.
04-07-2022 04:22 PM
Hello,
some topics from my side:
I'm sorry, but I didn't understand everything from your post. Can you please explain your issue and your desired snap build process a little bit deeper (maybe also share your snapcraft.yaml)?
Best regards,
Nick
04-08-2022 06:02 AM
Good morning nick,
thank for response. I'll try to explany it clearer.
First, i setup a VM with sdk and so on, and iam able to build the sample-snaps form the sdk. until then everything is fine:)
Second, i am a noob in Linux and SNAP, but i try to learn this technologies and do my best.
I have a application binary-builds for Linux arm64 and amd64. An i can run this appilcation in my linux VM whitout SNAP. To get the applikation running, i have to copy a .conf (from my app) file to the /etc/ld.so.conf.d/ folder which contians lib-path from my app. And with ldconfig i announce the dynamic linker of linux that ther are new lib locations... than i can execute my app from the cli .
Now, i want to pack my Application to a SNAP. So, my first though, create a snapcraft with a app and and part (plugin:dump) with the source of my binary (which mention above). the problem ist now, that the SNAP build process has to the same which i have done above for the dynamic-linker. So is read soming about the LD_PATH_LIBRARY. to provide dynamic-linker path something like this:
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SNAP/path/to1/:$SNAP/path/to2/:$SNAP/path/to3/"
but how can i to that with SNAP implcity!?
So i understand, is the a .snap file which is build, contains ALL Libs which are needed, that meand the lib from the dynanamic.linker are alos copies to the snap file !?!?!?!
Thank you
04-08-2022 09:18 AM - last edited on 04-08-2022 11:44 AM by CodeShepherd
Hello,
Just to show some basics about snaps I copied out an extract from the snapcraft.yaml of the hello.world sample from the SDK and added some comments:
# define how apps & services are exposed to host system
apps:
HelloWorld: #name of your application (binary build)
command: HelloWorld #this will be the command to run the service
plugs: #plugs to connect to interfaces
- network
daemon: simple #declares that your application gets started by the system deamon
passthrough: #restarts the application if it shuts down after 10 sec
restart-condition: always
restart-delay: 10s
#describes how the binary application (from folder ./generated/build) gets packed (dumped) into the snap
parts:
helloworld:
plugin: dump
source: ./generated/build
Please a look into the snpacraft.yaml reference. It describes all the details snapcraft needs to build a snap.
@schwebo wrote:
So i understand, is the a .snap file which is build, contains ALL Libs which are needed, that meand the lib from the dynanamic.linker are alos copies to the snap file !?!?!?!
Yes, this is true. Snaps in general are self contained and therefor have to have all needed dependencies inside.
I hope I could clarify some things. You can share your snapcraft.yaml (with some comments) so we can have a look at your snap build mechanism.
04-08-2022 12:03 PM
Hi
maybe you are looking for "stage-packages" ?
If you have to add own libraries you can dump it into the snap using the dump plugin.
$SNAP/lib:$SNAP/usr/lib:$SNAP/usr/lib/x86_64-linux-gnu (on amd64 architecture) are default part of the LD_LIBRARY_PATH
If you add your library to another directory within your snap you have to extend the environment variable e.g.:
apps: example-app: [...] environment: LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/<example-directory>
Regards
Johannes