error while copying shared lib to another folder

Bug #1765282 reported by shweta
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
Kyle Fazzari

Bug Description

Hi I am new to snapcraft. I want to copy shared lib files to stage folder in one part.I can use these files in second part to cmake c++ code.

In first part while copying shared libs it shows such file or directory...but the files are already present. I have tried both of things file with symlink and without symlink.....Please help if I am doing something wrong or I should chnage follow_symlink to True.

Preparing to pull files-copy
Pulling files-copy
'image-reading2' has prerequisites that need to be staged: files-copy
Preparing to build files-copy
Building files-copy
Traceback (most recent call last):
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/", line 119, in link_or_copy, destination, follow_symlinks=False)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/' -> '/root/build_image-reading2/parts/files-copy/install/'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/snap/snapcraft/1345/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==2.40.1', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/1345/usr/lib/python3.6/site-packages/pkg_resources/", line 565, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/snap/snapcraft/1345/usr/lib/python3.6/site-packages/pkg_resources/", line 2631, in load_entry_point
    return ep.load()
  File "/snap/snapcraft/1345/usr/lib/python3.6/site-packages/pkg_resources/", line 2291, in load
    return self.resolve()
  File "/snap/snapcraft/1345/usr/lib/python3.6/site-packages/pkg_resources/", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/cli/", line 43, in <module>
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/click/", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/click/", line 697, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/click/", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/click/", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/click/", line 535, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/cli/", line 139, in snap
    project_options, directory=directory, output=output)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/internal/lifecycle/", line 46, in snap
    execute('prime', project_options)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/internal/lifecycle/", line 80, in execute
    _Executor(config, project_options).run(step, part_names)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/internal/lifecycle/", line 191, in run
    self._run_step(step, part, part_names)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/internal/lifecycle/", line 225, in _run_step, step_prereqs)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/internal/lifecycle/", line 191, in run
    self._run_step(step, part, part_names)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/internal/lifecycle/", line 236, in _run_step
    getattr(part, step)()
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/", line 368, in build
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/plugins/", line 103, in build
    _recursively_link(src, dst, self.installdir)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/plugins/", line 139, in _recursively_link
    _link_or_copy(source, destination, boundary)
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/plugins/", line 124, in _link_or_copy
  File "/snap/snapcraft/1345/lib/python3.6/site-packages/snapcraft/", line 126, in link_or_copy
    shutil.copy2(source, destination, follow_symlinks=follow_symlinks)
  File "/snap/snapcraft/1345/usr/lib/python3.6/", line 251, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/snap/snapcraft/1345/usr/lib/python3.6/", line 114, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/'
Stopping local:snapcraft-superexpressively-untestifying-noel

Tags: stacktrace
Revision history for this message
shweta (shwandere) wrote :
tags: added: stacktrace
Changed in snapcraft:
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → Christian Dywan (kalikiana)
Changed in snapcraft:
milestone: none → 2.43
Revision history for this message
Kyle Fazzari (kyrofa) wrote :

This snapcraft.yaml is very dependent on your host system, which isn't really how snapcraft was designed to be used. It's impossible for us to know exactly what's happening as a result. You should get rid of that first part, and stage those packages directly instead, something like this:

# ...
    plugin: cmake
    source: src
        - g++
        - libopencv-core3.2
        - libopencv-highgui3.2
        - libopencv-imgproc3.2
        - libopencv-imgcodecs3.2

That said, that still may not be what you want, since you probably want to ensure the -dev packages are installed as well (e.g. libopencv-highgui-dev in build-packages), but I won't assume too much.

Revision history for this message
Kyle Fazzari (kyrofa) wrote :

(What we can and will do, of course, is fix the fact that this is a traceback)

Revision history for this message
Kyle Fazzari (kyrofa) wrote :
Changed in snapcraft:
status: Triaged → In Progress
assignee: Christian Dywan (kalikiana) → Kyle Fazzari (kyrofa)
Changed in snapcraft:
status: In Progress → Fix Committed
Changed in snapcraft:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.