Attempting my first build - Notepadqq


#1

Hello,
M
I am having a problem with my first build. I did search the forums & reference website to no avail.

Here is the (hopefully) relevant part. Please let me know if anything else is needed.

Thanks!

Building my-part
Makefile:2: *** DESTDIR is not set. Stop.
make -j4
Traceback (most recent call last):
File “/usr/bin/snapcraft”, line 9, in
load_entry_point(‘snapcraft==2.35’, ‘console_scripts’, ‘snapcraft’)()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 542, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 2569, in load_entry_point
return ep.load()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 2229, in load
return self.resolve()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 2235, in resolve
module = import(self.module_name, fromlist=[‘name’], level=0)
File “/usr/lib/python3/dist-packages/snapcraft/cli/main.py”, line 19, in
run(prog_name=‘snapcraft’)
File “/usr/lib/python3/dist-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/usr/lib/python3/dist-packages/click/core.py”, line 1037, in invoke
return Command.invoke(self, ctx)
File “/usr/lib/python3/dist-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python3/dist-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/usr/lib/python3/dist-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/usr/lib/python3/dist-packages/snapcraft/cli/init.py”, line 124, in run
ctx.forward(lifecyclecli.commands[‘snap’])
File “/usr/lib/python3/dist-packages/click/core.py”, line 552, in forward
return self.invoke(cmd, **kwargs)
File “/usr/lib/python3/dist-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/usr/lib/python3/dist-packages/snapcraft/cli/lifecycle.py”, line 140, in snap
project_options, directory=directory, output=output)
File “/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_packer.py”, line 45, in snap
execute(‘prime’, project_options)
File “/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py”, line 80, in execute
_Executor(config, project_options).run(step, part_names)
File “/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py”, line 175, in run
self._run_step(step, part, part_names)
File “/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py”, line 212, in _run_step
getattr(part, step)()
File “/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/init.py”, line 330, in build
self.plugin.build()
File “/usr/lib/python3/dist-packages/snapcraft/plugins/make.py”, line 128, in build
self.make()
File “/usr/lib/python3/dist-packages/snapcraft/plugins/make.py”, line 107, in make
self.run(command + [’-j{}’.format(self.parallel_build_count)], env=env)
File “/usr/lib/python3/dist-packages/snapcraft/_baseplugin.py”, line 202, in run
return common.run(cmd, cwd=cwd, **kwargs)
File “/usr/lib/python3/dist-packages/snapcraft/internal/common.py”, line 63, in run
subprocess.check_call([’/bin/sh’, f.name] + cmd, **kwargs)
File “/usr/lib/python3.5/subprocess.py”, line 581, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[’/bin/sh’, ‘/tmp/tmpc7fk9ztr’, ‘make’, ‘-j4’]’ returned non-zero exit status 2
Build failed
Traceback (most recent call last):
File “/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py”, line 226, in run
self.build()
File “/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py”, line 200, in build
env=env)
File “/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py”, line 88, in run_build_command
return self.backend.run(args, cwd=cwd, env=full_env, **kwargs)
File “/usr/lib/python2.7/dist-packages/lpbuildd/target/lxd.py”, line 448, in run
subprocess.check_call(cmd, **kwargs)
File “/usr/lib/python2.7/subprocess.py”, line 541, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command ‘[‘lxc’, ‘exec’, ‘lp-xenial-i386’, ‘–env’, ‘LANG=C.UTF-8’, ‘–env’, ‘SHELL=/bin/sh’, ‘–env’, ‘SNAPCRAFT_BUILD_INFO=1’, ‘–env’, ‘http_proxy=http://snap-proxy.launchpad.net:3128’, ‘–env’, ‘https_proxy=http://snap-proxy.launchpad.net:3128’, ‘–env’, ‘GIT_PROXY_COMMAND=/usr/local/bin/snap-git-proxy’, ‘–’, ‘/bin/sh’, ‘-c’, ‘cd /build/a75296a6b229b927ad5ed6242fa0c4a2-xenial && linux32 snapcraft’]’ returned non-zero exit status 1
Revoking proxy token…
RUN: /usr/share/launchpad-buildd/slavebin/in-target scan-for-processes --backend=lxd --series=xenial --arch=i386 SNAPBUILD-145880
Scanning for processes to kill in build SNAPBUILD-145880
RUN: /usr/share/launchpad-buildd/slavebin/in-target umount-chroot --backend=lxd --series=xenial --arch=i386 SNAPBUILD-145880
Stopping target for build SNAPBUILD-145880
RUN: /usr/share/launchpad-buildd/slavebin/in-target remove-build --backend=lxd --series=xenial --arch=i386 SNAPBUILD-145880


#2

Here is a copy of my yaml.

version: '1.2.0+git' # check the version number of notepadqq's packages
summary: Notepadqq is a Notepad++-like editor for the Linux desktop. # 79 char long summary
description: |
  It helps developers by providing all you can expect from a general purpose text editor, such as syntax highlighting for more than 100 different languages, code folding, color schemes, file monitoring, multiple selection and much more.
  You can search text using the power of regular expressions. You can organize documents side by side. You can use real-time highlighting to find near identifiers in no time.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs
  
apps:
  notepadqq: 
    command: desktop-launch $SNAP/bin/notepadqq 
    desktop: share/applications/notepadqq.desktop

parts:
  my-part:
    # See 'snapcraft plugins'
    build-packages:

      - qtbase5-dev
      - libqt5webkit5-dev
      - libqt5svg5-dev
      - qttools5-dev-tools
      
      
    stage-packages: 
      
      - qtbase5-dev      
      - libqt5webkit5
      - libqt5svg5
      - coreutils

    source-type: git
    source: https://github.com/notepadqq/notepadqq
    source-subdir: src/editor
    make-install-var: PREFIX
    after: [desktop-qt5] 
    plugin: make
    install: |
      make
      make install```

#3

you don’t need these for the make plugin, as the plugin handles calling those two commands itself. If you did want to override the plugin then you need to alter your make install to tell it where you want to install your files to (i.e. into the snap):

make DESTDIR=$SNAPCRAFT_PART_INSTALL install

#4

Looking through the repository for notepadqq it looks like you really want to be using the autotools plugin instead of the make plugin, which will handle running any configure script or autogen.sh script present (the notepadqq has a configure script).


#5

Thanks Daniel. I changed it to autotools and it went further, but I am getting a different error message now. Any ideas with this? I tried a couple of different options I found but same error each time.

make -j4
make install DESTDIR=/build/a75296a6b229b927ad5ed6242fa0c4a2-xenial/parts/my-part/install
Staging my-part
Priming desktop-qt5
Priming my-part
The path ‘prime/usr/share/applications/notepadqq.desktop’ set for ‘desktop’ in ‘notepadqq’ does not exist.
Build failed
Traceback (most recent call last):
File “/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py”, line 226, in run
self.build()
File “/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py”, line 200, in build
env=env)
File “/usr/lib/python2.7/dist-packages/lpbuildd/target/build_snap.py”, line 88, in run_build_command
return self.backend.run(args, cwd=cwd, env=full_env, **kwargs)
File “/usr/lib/python2.7/dist-packages/lpbuildd/target/lxd.py”, line 448, in run
subprocess.check_call(cmd, **kwargs)
File “/usr/lib/python2.7/subprocess.py”, line 541, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command ‘[‘lxc’, ‘exec’, ‘lp-xenial-amd64’, ‘–env’, ‘LANG=C.UTF-8’, ‘–env’, ‘SHELL=/bin/sh’, ‘–env’, ‘SNAPCRAFT_BUILD_INFO=1’, ‘–env’, ‘http_proxy=http://snap-proxy.launchpad.net:3128’, ‘–env’, ‘https_proxy=http://snap-proxy.launchpad.net:3128’, ‘–env’, ‘GIT_PROXY_COMMAND=/usr/local/bin/snap-git-proxy’, ‘–’, ‘/bin/sh’, ‘-c’, ‘cd /build/a75296a6b229b927ad5ed6242fa0c4a2-xenial && linux64 snapcraft’]’ returned non-zero exit status 2
Revoking proxy token…
RUN: /usr/share/launchpad-buildd/slavebin/in-target scan-for-processes --backend=lxd --series=xenial --arch=amd64 SNAPBUILD-146193
Scanning for processes to kill in build SNAPBUILD-146193
RUN: /usr/share/launchpad-buildd/slavebin/in-target umount-chroot --backend=lxd --series=xenial --arch=amd64 SNAPBUILD-146193
Stopping target for build SNAPBUILD-146193
RUN: /usr/share/launchpad-buildd/slavebin/in-target remove-build --backend=lxd --series=xenial --arch=amd64 SNAPBUILD-146193


#6

My new yaml file.

version: '1.2.0+git' # check the version number of notepadqq's packages
summary: Notepadqq is a Notepad++-like editor for the Linux desktop. # 79 char long summary
description: |
  It helps developers by providing all you can expect from a general purpose text editor, such as syntax highlighting for more than 100 different languages, code folding, color schemes, file monitoring, multiple selection and much more.
  You can search text using the power of regular expressions. You can organize documents side by side. You can use real-time highlighting to find near identifiers in no time.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs
  
apps:
  notepadqq: 
    command: desktop-launch $SNAP/bin/notepadqq 
    desktop: usr/share/applications/notepadqq.desktop

parts:
  my-part:
    # See 'snapcraft plugins'
    build-packages:

      - qtbase5-dev
      - libqt5webkit5-dev
      - libqt5svg5-dev
      - qttools5-dev-tools
      
      
    stage-packages: 
      
      - qtbase5-dev      
      - libqt5webkit5
      - libqt5svg5
      - coreutils

    source-type: git
    source: https://github.com/notepadqq/notepadqq
    after: [desktop-qt5] 
    plugin: autotools
    configflags:
      - --prefix=/usr

#7

I’ve done some investigation, and it seems the configflags need to be altered to get the files in the right place (this build is actually not autotools-based like I told you, but seems to be a qmake project with a weird hybrid wrapper script which causes inconsistencies with how we expect things to work in the snap world):

parts:
  my-part:
    ...
    configflags:
      - --prefix=$SNAPCRAFT_PART_INSTALL/usr

Normally we’d rely on make with the DESTDIR override by snapcraft to get the files into $SNAPCRAFT_PART_INSTALL but it seems that the Makefile created by notepadqq’s configure script doesn’t respect that variable so the --prefix needs altering to fix it - hopefully notepadqq doesn’t save any paths into it’s binary files during the build - some apps do that which causes us no-end of trouble relocating them via snaps.


#8

Thank you again Daniel. It is running now, with just a few remaining messages:

Qt: Session management error: None of the authentication protocols specified are supported

Missing icon: "go-previous"
Missing icon: “go-next”

I would appreciate anyone who wants to test it. Thanks!


#9

That one seems to be innocuous (not a problem). I’ve seen it on several snaps and can’t find any way of squashing it or even what the actual problem is…