Beginner - I need help using snapcraft

Hello
First of all, I’m an absolute beginner, and this is my first time with Snapcraft. I also don’t know if this is the right place to look for help.

I’m trying to build my first project, basically so I can learn, but I’m having a mistake with scons. When you finish compiling and have to install it shows me the following message:

Checking for C++ header file bullet/btBulletDynamicsCommon.h... (cached) yes
sh: 1: svnversion: not found
TypeError: exceptions must be old-style classes or derived from BaseException, not str:
  File "/root/parts/my-part/build/SConstruct", line 515:
    raise 'VDrift data not found. Please make sure data is placed in vdrift directory. See README.md and http://wiki.vdrift.net.'
Failed to run 'scons install' for 'my-part': Exited with code 2.
Verify that the part is using the correct parameters and try again.
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
An error occurred when trying to execute 'sudo -i snapcraft snap' with 'multipass': returned exit code 2.

When I compile this project normally, not for snap, I need to use this options:

scons arch=a64 release=1 extbullet=1 prefix=[/installation/directory/]

I try to add it with “scons-options” but I think I’m not doing it right because I get a syntax error.

Can someone help me please?

Can you share you snapcraft.yaml? (and repo if you can)

No problem

This is my first snap, and of course my first .yalm. There are a lot of things that are probably unfilled, but I’m using it to learn. I appreciate all the help you wanted to give me to get it:

name: vdrift # you probably want to 'snapcraft register <name>'
base: core18 # the base snap is the execution environment for this snap
version: '2018.11.28' # just for humans, typically '1.2+git' or '1.3.2'
summary: A Car Racing Simulator for Multiple Platforms # 79 char long summary
description: VDrift is a cross-platform, open source driving simulation made with drift racing in mind. It is released under the [GNU General Public License (GPL) v3](http://www.gnu.org/licenses/gpl-3.0.en.html).It is currently available for FreeBSD, Linux, Mac OS X and Windows.

parts:
  my-part:
    # See 'snapcraft plugins'
    plugin: scons
    source-type: 7z
    source: https://netcologne.dl.sourceforge.net/project/vdrift/vdrift/nightly%20builds/vdrift-2015-11-28.7z
    build-packages:
      - g++
      - scons
      - libbullet-dev
      - libcurl4-gnutls-dev
      - libvorbis-dev
      - libsdl2-dev
      - libsdl2-image-dev

Does it help to add subversion to the build-packages section, since this provides the svnversion command? (Not sure what is or is not installed automagically by the scons plugin.)

I included svnversion and I hink that the error is the same:
scons install
scons: Reading SConscript files …
Checking for C++ header file GL/gl.h… (cached) yes
Checking for C++ header file SDL2/SDL.h… (cached) yes
Checking for C++ header file SDL2/SDL_image.h… (cached) yes
Checking for C++ header file vorbis/vorbisfile.h… (cached) yes
Checking for C++ header file curl/curl.h… (cached) yes
Checking for C++ header file bullet/btBulletCollisionCommon.h… (cached) yes
Checking for C++ header file bullet/btBulletDynamicsCommon.h… (cached) yes
sh: 1: svnversion: not found
TypeError: exceptions must be old-style classes or derived from BaseException, not str:
File “/root/parts/my-part/build/SConstruct”, line 515:
raise ‘VDrift data not found. Please make sure data is placed in vdrift directory. See README.md and http://wiki.vdrift.net.’
Failed to run ‘scons install’ for ‘my-part’: Exited with code 2.
Verify that the part is using the correct parameters and try again.
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
An error occurred when trying to execute ‘sudo -i snapcraft snap’ with ‘multipass’: returned exit code 2.

Not svnversion, but subversion. Try this:

    build-packages:
      - g++
      - scons
      - subversion
      - libbullet-dev
      - libcurl4-gnutls-dev
      - libvorbis-dev
      - libsdl2-dev
      - libsdl2-image-dev

svnversion is the missing command, but subversion is the deb package that includes it.

1 Like

Thanks a lot for this correction. I made some additions on .yalm:

name: vdrift # you probably want to 'snapcraft register <name>'
base: core18 # the base snap is the execution environment for this snap
version: '2015.11.28' # just for humans, typically '1.2+git' or '1.3.2'
summary: A Car Racing Simulator for Multiple Platforms # 79 char long summary
description: VDrift is a cross-platform, open source driving simulation made with drift racing in mind. It is released under the [GNU General Public License (GPL) v3](http://www.gnu.org/licenses/gpl-3.0.en.html).It is currently available for FreeBSD, Linux, Mac OS X and Windows.

parts:
  my-part:
    # See 'snapcraft plugins'
    plugin: scons
    scons-options:
      - arch=a64
      - release=1
      - extbullet=1
    source-type: 7z
    source: https://netcologne.dl.sourceforge.net/project/vdrift/vdrift/nightly%20builds/vdrift-2015-11-28.7z
    build-packages:
      - g++
      - scons
      - subversion
      - libbullet-dev
      - libcurl4-gnutls-dev
      - libvorbis-dev
      - libsdl2-dev
      - libsdl2-image-dev

But now I have another errors…:

Launching a VM.
Skipping pull my-part (already ran)                                             
Building my-part 
scons arch=a64 release=1 extbullet=1
scons: *** No SConstruct file found.
File "/usr/lib/scons/SCons/Script/Main.py", line 924, in _main
Failed to run 'scons arch=a64 release=1 extbullet=1' for 'my-part': Exited with code 2.
Verify that the part is using the correct parameters and try again.
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
An error occurred when trying to execute 'sudo -i snapcraft snap' with 'multipass': returned exit code 2.

In the source package there is a Sconstruct file…

Using source-type: git
source: https://github.com/VDrift/vdrift.git

I have the first error again:

Checking for C++ header file curl/curl.h... (cached) yes
Checking for C++ header file bullet/btBulletCollisionCommon.h... (cached) yes
Checking for C++ header file bullet/btBulletDynamicsCommon.h... (cached) yes
TypeError: exceptions must be old-style classes or derived from BaseException, not str:
  File "/root/parts/my-part/build/SConstruct", line 515:
    raise 'VDrift data not found. Please make sure data is placed in vdrift directory. See README.md and http://wiki.vdrift.net.'
Failed to run 'scons install arch=a64 release=1 extbullet=1' for 'my-part': Exited with code 2.
Verify that the part is using the correct parameters and try again.
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
An error occurred when trying to execute 'sudo -i snapcraft snap' with 'multipass': returned exit code 2.

I’m not experienced with scons so can’t advise you directly, but IIRC it should be executed from within the parts/my-part/build dir. So best way forward is to look inside that directory and try to see what is different from what would be there if you were building this software manually.

One speculative thought. You’re downloading a 7z archive of the source code. Is this a project using git submodules? If so, maybe they are not being included in the compressed archive.

Otherwise, it looks to me like you need to work out what the vdrift data is and where to get it from. If it’s there and scons is just not finding it, maybe you need to set an appropriate config flag to specify the vdrift directory to search for.

It’s included in the 7zip archive