automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using convenience libraries with non-recursive make


From: Del Merritt
Subject: Re: Using convenience libraries with non-recursive make
Date: Wed, 22 Aug 2012 12:00:03 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

On 08/15/2012 04:46 PM, Diego Elio Pettenò wrote:
On 15/08/2012 12:49, Del Merritt wrote:
All good questions; mostly because I am not completely sure yet that a)
I won't want to be able to install the sub-libraries later, b) my
hand-built makefiles do it this way already, so I was minimizing
change,  and c) this is my first run creating an autoconfiscated project.
SO I would suggest you try the other solution first (have one huge
_SOURCES variable). If 'make dist' is erroring out there might be
something else to be fixed.

[Reponding on-list to what was Diego's private response to me; I hope he doesn't mind.]

I just finished an experiment with a single libfoo.a and all many-thousands of sources for libfoo_a_SOURCES. The compilation worked, but I got the dreaded "make[1]: execvp: /bin/bash: Argument list too long" message when it tried to do the "ar". To the shell's credit, the command line appears to be 134K bytes/characters in length, so I can understand why it would choke. This doesn't bode well for the various "dist" targets.

As it is, without seeing your code, I'd say there might be a simple typo
somewhere, given the kind of complexity you seem to be dealing with when
importing this, I'd try first removing the complexity and then building
up from there, even if it means reporting another problem, this time
with make dist.

One reason I've not posted my complete Makefile.am source is that it's a monster, size-wise.

I managed - with the use of LDADD and "AM_LIBTOOLFLAGS = --preserve-dup-deps" with the multiple-library version. Thus:

   # Automake rules to build application.
   AM_CXXFLAGS = -I${includedir}
   ACLOCAL_AMFLAGS = -I m4

   AM_LIBTOOLFLAGS = --preserve-dup-deps

   AM_LDFLAGS = -L. -L../lib  \
      -Wl,--start-group \
      ${LDADD} \
      -Wl,--end-group \
       -lother -l3rdparty -llibs -lasneeded -lhere

   bin_PROGRAMS = foo

   foo_SOURCES = a/deep/tree/here/foo__main.cpp

   LDADD = \
      lib_initialize.a \
      nearly 50 more libraries here...

   lib_LIBRARIES =  \
      lib_initialize.a \
      nearly 50 more libraries (same as in LDADD) here...

   lib_initialize_a_SOURCES =  \
      initializeStatics.cpp initializeStaticsStatements.h

   and 50ish more "libblah_a_SOURCES = follow", with lots of source
   references

I still don't have things set up to allow me to create a single shared (or static) library from the collection of 48 sub-libraries. I.e, I'd really still like to link up all 50ish sub-libraries into a single libfoo.a (or libfoo.so).

I don't like the Linux-specific "--start-group...--end-group", and empirically those matter less than the fact that I've repeated my library list with the addition of "${LDADD}" in "AM_LD_FLAGS". I've done a web search and I don't see a Correct Way to tell libtool, "hey, the following list of libraries have circular dependencies, so please iterate no matter what platform you are on". Since I am targeting Linux and Darwin of various flavors, I'd like to make this work better. More pointers are certainly welcome and appreciated.

In case it helps, my complete (sans most comments and blank lines) configure.ac looks like this:

   AC_PREREQ([2.59])
   AC_INIT([libfoo], [1.0], address@hidden)
   AM_INIT_AUTOMAKE([foreign subdir-objects])
   AC_CONFIG_SRCDIR([initializeStatics.cpp])
   AC_CONFIG_HEADERS([libfooconfig.h]) # Currently not used! (a ToDo)
   AC_CONFIG_MACRO_DIR([m4])
   AC_PROG_MKDIR_P
   AC_PROG_CXX
   LT_INIT
   AC_CONFIG_FILES([Makefile])
   AC_OUTPUT

Thanks again for any suggestions,
-Del


reply via email to

[Prev in Thread] Current Thread [Next in Thread]