Snap files location questions

Good morning people:)

I want to build a snap. And i have a folder with all my files and 2 exeutables which i want to pack into the snap, therefoe i use the plugin “dump”, like:

image

so far so good.

My folder contains 2 Executables. The first Executable (AppEngine) is executed by the snap command, like:

image

so far so good , too.

So, the problem: The First executable calls another Executabe (the second one), but this fails , beecause, the second executable is search in:

/var/snap/myApp/

but the second Executable is located (which are from the dump plugin) in

/snap/myApp

So it seem, that snap runs my first Exectuable form /var/snap/myApp not /snap/myApp ? is that right!?

if this the case, how can i tell Snap that the second exectuable must be copies into the /var/snap/myApp folder!?

Thank you

Hello,

In your code, how is your first executable referring to the second one?

By simply browsing your file system, can you check if your first executable is located in your /var/snap/myApp and the second one in /snap/myApp?

Also to make sure where you are placing your files (your two binaries in your case), you could use the organize keyword in your part (see the dump plugin page)

Hey,

the second executable is located in /snap/myApp/

hier you can sie the second Executabel ist the AppEngine.LibLauncher…

You should try to put both your binaries within the same directory by adding organize to your part:

    organize:
        'bin1': usr/bin/bin1
        'bin2': usr/bin/bin2

/snap/var/myApp is not meant to store binaries

1 Like

ok thank, in my case this would like shoming like this?

image

No, you should put the organize in your part and not in your app

parts:
    myApp:
      plugin: dump
      ...
      organize:
        'bin1': usr/bin/bin1
        'bin2': usr/bin/bin2

In your case, is AppEngine an executable or a library?

good morning, thanks for helping…

“AppEngine” is the first executable, and “AppEngine.LibLauncher” the second one.

But i do not understand the concept, my current snapcraft:

  apps:
    app-engine:
        command: AppEngine -config $SNAP/userconfig.yml
        plugs: ['network', 'network-bind', 'process-control', 'network-observe', 'network-control'] 
        daemon: simple
        environment:
          LD_LIBRARY_PATH: $SNAP/extensions:$SNAP/drivers/halcon:$SNAP 

   parts:
     app-engine:
       plugin: dump
       source: ./bin/${SNAPCRAFT_TARGET_ARCH}    
       organize:
           'AppEngine.LibLauncher': ./bin/${SNAPCRAFT_TARGET_ARCH}/AppEngine.LibLauncher
       stage-packages:
         - libheimbase1-heimdal
         - libheimntlm0-heimdal
         - libhx509-5-heimdal
         - libkrb5-26-heimdal
         - libgssapi3-heimdal
         - libldap-2.4-2
         - libnghttp2-14
         - libgomp1
         - libpsl5
         - librtmp1
         - libsasl2-2
         - libx11-6
         - libxau6
         - libxcb1
         - libxdmcp6
         - libxext6
         - libcap2-bin

My application is located in

"./bin/${SNAPCRAFT_TARGET_ARCH} "

there are both exectuables.

if i run my ab wihtout snap from this location… it works… because the “AppEngine” call the “AppEngine.LibLauncher” because it is in the same folder…

but when ich pack /dump this folder into a snap… all this file are in “/snap/AppEngine/current” right? And my question is, what is happening in the “/var/snap/Appengine/current” folder!? Why does AppEngine search the AppEngine.Liblauncher there?

Good Morning,

i could solve the problem, whilst i copy the “AppEngine.Liblauncher” manualy from “/snap/myApp/current” to the “/var/snap/MyApp/current/” folder.

Can i do this with " override-stage too?

You could override the build. Have a look at snapcraft.yaml, there I do something similar:

override-build: |
  snapcraftctl build
  cp target/dayon.browser ../install/bin/
  cp target/dayon.launcher ../install/bin/

ok thanks, but has “…/install/bin” or “target” a special meaning in SNAP or is that a arbitrarily path from you!?=

The target folder is specific to my build, while everything inside install will end up in the root directory of the resulting snap.

ok that mean the install path is the same like /snap/myapp/current or the var/snap/myapp/current… i get more and mor confused… sorry;)

../install/ points to the same directory as the env var $SNAPCRAFT_PART_INSTALL. It is only used during the snap creation. Everything that is put inside that path, ends up in the root directory of the builded snap.

Once the snap is installed, its content lives under /snap/myapp/current/ - exactly as you expected!

which is why you should not use the relative path but the env var … (a future snapcraft version might call that dir “output” or whatever ideas the devs have) no matter how the dir is called the var will point to the correct place:

override-build: |
  snapcraftctl build
  mkdir -p $SNAPCRAFT_PART_INSTALL/bin
  cp target/dayon.browser $SNAPCRAFT_PART_INSTALL/bin/
  cp target/dayon.launcher $SNAPCRAFT_PART_INSTALL/bin/

Indeed, that’s why I already changed that part this morning! :wink:

ok from side from the beginning :slight_smile: This is my part:

inside the source folder , there are a “AppEngine” and a “AppEngine.LibLauncher” executable.

my app looks like:

 apps:
    app-engine:
        command: AppEngine -config $SNAP/userconfig.yml

here you can see , i execute the “AppEngine”… but the “AppEngine.LibLauncher” executable should be installed into the “/var/snap/app-engine/current”.

So how dows the the overide-bulild looks like? can you please give me an example for my case!? thank you in advance