Note that there are some explanatory texts on larger screens.

plurals
  1. POAutomake not including object files in built static library
    primarykey
    data
    text
    <p>I currently have a largish project including multiple applications and am trying to build a static library along with one of my applications for inclusion in several of the other applications. </p> <p>I followed the tutorial provided at <a href="http://www.gnu.org/software/automake/manual/html_node/A-Library.html" rel="nofollow">http://www.gnu.org/software/automake/manual/html_node/A-Library.html</a> and have set up the appropriate Makefile.am as follows:</p> <pre><code>include Makefile.shared noinst_LIBRARIES = libas2transition.a bin_PROGRAMS = as2transition BUILT_SOURCES = \ TransitionFormatter.cpp libas2transition_a_SOURCES = TransitionFormatter.re2c \ TransitionPath.cpp \ Timestep.cpp \ Predicate.cpp \ StringUtils.cpp as2transition_SOURCES = \ main.cpp as2transition_LDADD = libas2transition.a </code></pre> <p>Makefile.shared contains shared configuration for all my subprojects and contains:</p> <pre><code>if DEBUG AM_CFLAGS = -g3 -O0 -DDEBUG AM_CXXFLAGS = -g3 -O0 -DDEBUG --std=c++0x else AM_CFLAGS = -O3 -DNDEBUG AM_CXXFLAGS = -O3 -DNDEBUG --std=c++0x endif if MAINTAINER_MODE if HAVE_RE2C .re2c.cpp: $(RE2C) -o $@ $^ else .re2c.cpp: @- echo "ERROR: Configured to build in maintainer mode but re2c is not installed on the computer." @- echo "ERROR: Modified re2c files cannot be compiled into the corresponding .cpp file." @- echo "ERROR: Please install re2c before continuing." @- exit 1 endif else .re2c.cpp: @- echo "WARNING: The system must be configured to build in maintainer mode in order to rebuild re2c files." @- echo "WARNING: These files will not be rebuilt unless you rerun the configure script with the '--enable-maintainer-mode' flag." endif </code></pre> <p>As far as I can tell everything is set up properly to first build the static library libas2transition.a and then compile a binary linking against it. However, when I attempt to run make I get the following output (note that this was a fresh build after a make clean).</p> <pre><code>make all-am make[1]: Entering directory `/home/jbabb1/workspace/as2transition/src' rm -f libas2transition.a ar cru libas2transition.a ranlib libas2transition.a g++ -DHAVE_CONFIG_H -I. -I.. -O3 -DNDEBUG --std=c++0x -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.cpp mv -f .deps/main.Tpo .deps/main.Po g++ -O3 -DNDEBUG --std=c++0x -g -O2 -o as2transition main.o libas2transition.a main.o: In function `as2transition::TransitionFormatter::format(std::basic_istream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, bool) const': /home/jbabb1/workspace/as2transition/src/TransitionFormatter.h:123: undefined reference to `as2transition::TransitionFormatter::format(std::basic_istream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, bool) const' /home/jbabb1/workspace/as2transition/src/TransitionFormatter.h:124: undefined reference to `as2transition::TransitionPath::output(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;) const' main.o: In function `main': /home/jbabb1/workspace/as2transition/src/main.cpp:136: undefined reference to `as2transition::TransitionFormatter::parseOption(char const*, bool)' /home/jbabb1/workspace/as2transition/src/main.cpp:193: undefined reference to `as2transition::TransitionFormatter::help(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, bool)' collect2: ld returned 1 exit status make[1]: *** [as2transition] Error 1 make[1]: Leaving directory `/home/jbabb1/workspace/as2transition/src' make: *** [all] Error 2 </code></pre> <p>The important lines seem to be </p> <pre><code>rm -f libas2transition.a ar cru libas2transition.a ranlib libas2transition.a </code></pre> <p>which seem indicate that Automake is not attaching any object files to the built library (this is further confirmed by the file size of libas2transition.a being 8 bytes following the compilation).</p> <p>What am I doing wrong? </p> <p>Also as a follow-up question, how would I make this library available to other projects in a larger build (which use nested configure.ac files).</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload