External Library Error

layout: /usr/lib/libgdal.so: bind-file: $SNAP/usr/lib/libgdal.so
/usr/lib/libgdal.so.26: bind-file: $SNAP/usr/lib/libgdal.so.26
/usr/lib/libgdal.so.26.0.4: bind-file: $SNAP/usr/lib/libgdal.so.26.0.4

My app needs access to the GDAL library. When I use the above text in my yaml I get:

error while loading shared libraries: /snap/tdhogr/x9/usr/lib/libgdal.so.26: file too short

Any suggestion? Thanks

The file is likely malformed, as it seems to be a library compatibility symlink please check the link destination is correct (and fix it if it’s not)

Thanks for the reply. My app runs fine independent of snapcraft, so I believe the original files are ok. I suspect that snapcraft is somehow corrupting the symbolic link information. I have tried using: symlink: $SNAP/usr/lib/libgdal.so.26 but then the result is: cannot open shared object file: No such file or directory

you should really share your whole snapcraft.yaml and properly use three backticks ``` before and after pasted code …

did you add libgdal26 to your stage-packages: at all so it will show up at the desired path for the layout ?

name: tdhogr
version: '22.05.20'
summary: Translate Vector Data
description: |
  Translate Vector Data

# The path of icon to represent the snap, relative to the source tree directory
# Only PNG or SVG image is supported, dimension must be greater than 256x256px
#icon: TdhGIS_logo.png

grade: stable
confinement: strict

base: core18

parts:
    
#parts:
  tdhogr:
    plugin: dump
    source: TdhOGR_linux64.zip
    stage-packages:
     - libwxgtk3.0-0v5
     - libcairo2 
#     - libgdal26  "package not found"

apps:
  tdhogr:
    command: TdhOGR_launcher.sh 

layout:
  /lib/libproj.so:
     bind-file: $SNAP/lib/libproj.so
  /lib/libproj.so.22:
     bind-file: $SNAP/lib/libproj.so.22
  /lib/libproj.so.22.1.1:
     bind-file: $SNAP/lib/libproj.so.22.1.1
  /lib/libgdal.so:
     bind-file: $SNAP/lib/libgdal.so     
  /lib/libgdal.so.26:
     bind-file: $SNAP/lib/libgdal.so.26     
  /lib/libgdal.so.26.0.4:
     bind-file: $SNAP/lib/libgdal.so.26.0.4     

plugs:
  # For snaps with a graphical user interface:
  desktop:
  desktop-legacy:
  x11:
  unity7:
  wayland:

  # Storage access
  home:
  removable-media: # Non-A/C

  # Network access
  #network: