Autoreconf: 'configure.ac' or 'configure.in' is required

Hi I am trying to create a snap for a basic .C file which is local to my system.

file name: printhello.c

#include<stdio.h>

int main() { printf(“Hello! Snap created successfully\n”); return 0; }

filename : Makefile

Hello : printhello.c

    cc printhello.c -o Hello

filename : snapcraft.yaml

name: hello

base: core18

version: ‘0.1’

summary: print the message

description: | This snap will print the Hello message.

grade: devel # must be ‘stable’ to release into candidate/stable channels confinement: devmode # use ‘strict’ once you have the right plugs and slots

parts: hello: # See ‘snapcraft plugins’ plugin: autotools

error facing :

Pulling hello
Building hello
autoreconf -i autoreconf: ‘configure.ac’ or ‘configure.in’ is required

Failed to run ‘autoreconf -i’ for ‘hello’: Exited with code 1.

Verify that the part is using the correct parameters and try again.

I have followed this commands.

  1. mkdir Hello
  2. cd Hello
  3. created the printhello.c file.
  4. snapcraft init
  5. cd snap
  6. snapcraft

Is there any way to create configure.ac and Makefile.am using any commands.

Hi. Snapcraft is not a build system, but it executes build systems like Autotools/Automake via its different plugins: https://snapcraft.io/docs/supported-plugins For any software, developers must (should) pick a build system first. This is independent of any packaging (like snaps, debs, or even Windows installers). Common build systems for C would be CMake, Meson or your bespoke Autotools.

What this means: You have to set up your project so that it can be compiled with the usual command invocations. For autotools projects that would be something like `./configure && make && make install. Only then can you use the autotools plugin.

What you need to do:

  1. Pick a build system. Nowadays I’d recommend something more modern compared to Autotools. Try Meson if you don’t have a clue yet.
  2. Create the necessary files. You have to look at examples or tutorials. A very simple meson project could be created as such:

meson.build:

project('printhello', 'c')
src = 'printhello.c'

executable('printhello', src, install : true)
  1. Select the correct snapcraft plugin, which will then execute the right commands to first build your tool and then package it.

If you want to stick to your plain Makefile (I would not recommend that), consider using the nil plugin and write the whole compilation & installation sequence as a script: https://snapcraft.io/docs/nil-plugin

Thank you for your suggestion. I’ll try it out all option. Basically my requirement is not only for a basic .c file related, I want to implement it in my C,C++,Qt project. To learn about snapcraft I have started with the basics. I’ll go through all suggested pages.