Search code examples
autoconfcheck-framework

Check framework integration on project failed to build


I'm integrating C check framework for my project and I was able to run

autoreconf --install

successfully without any errors.

But when I integrate the C check framework, I'm getting an error and warnings that doesn't make sense.

Here is the error I'm getting

src/Makefile.am:7: warning: variable 'main_LDADD' is defined but no program or 
src/Makefile.am:7: library has 'main' as canonical name (possible typo)
tests/Makefile.am:2: error: 'SHELLTESTS_PROGRAMS' is used but 'SHELLTESTSdir' is undefined
tests/Makefile.am:3: warning:variable 'ShellTests_SOURCES' is defined but no program or
tests/Makefile.am:3: library has 'ShellTests' as canonical name (possible typo)  
tests/Makefile.am:5: warning: variable ShellTests_LDADD' is defined but no program or 
tests/Makefile.am:5:library has 'ShellTests' as canonical name (possible typo) 
                   autoreconf:automake failed with exit status: 1

I've followed the C check example source code, the difference between that and my project is that my class uses other class' methods.

Anyways, this is the Makefile.am under my tests/ that is causing 'havoc' on building the project

TESTS = shelltests
SHELLTESTS_PROGRAMS = shelltests

ShellTests_SOURCES = ShellTests.c $(top_builddir)/src/Shell.h $(top_builddir)/src/Parser.h $(top_builddir)/src/JobControl.h
ShellTests_CFLAGS = @CHECK_CFLAGS@
ShellTests_LDADD = $(top_builddir)/src/libshell.la @CHECK_LIBS@

This is the file structure for my project
src - Parser.h, Parser.c, Shell.h, Shell.c, Job.h, Job.c, Makefile.am
tests - ShellTests.c Makefile.am

And this is the code in Makefile.am under src.

lib_LTLIBRARIES = libshell.la 
libshell_la_SOURCES = Shell.c Shell.h Parser.h Parser.c JobControl.h JobControl.c
bin_programs = main 
main_sources = Main.c  
main_LDADD = libshell.la

I followed this user's advice to see if it removes the error: What directory should I use for "error: 'extra_PROGRAMS' is used but 'extradir' is undefined"? Alas, it does not.

I've tried building the example project - the one that you get when you download under examples, to see if I'm missing anything. But it's not able to build on my machine.

I'm on Mac OS X Mavericks (10.9)

  • Autoconf 2.69
  • Automake 1.15
  • Libtool 2.4.6
  • Check 0.9.14

Solution

  • I did a couple of things to build this project successfully. I first followed what I outlined here: Check framework example giving me error when running './configure'

    Then I followed c check frameworks' naming conventions for the tests source files.

    Thanks for the help guys, it gave me some ideas on what the cause of compilation errors.