Re: building without $(top_builddir) in LDADD (was Re: libtool libraries, dependencies and parallel builds)
On 02/11/2012 16:16, Václav Zeman wrote: > How can I make this work as you have suggested without $(top_builddir)? Okay here's my rule of thumb (Stefano can give you the informed, developer opinion): - if it's declared in the same makefile, don't use $(top_builddir); - if it's declared on a different makefile, use $(top_builddir) and make sure SUBDIRS come first; - if possible, don't use recursive make at all. -- Diego Elio Pettenò — Flameeyes flamee...@flameeyes.eu — http://blog.flameeyes.eu/ signature.asc Description: OpenPGP digital signature
building without $(top_builddir) in LDADD (was Re: libtool libraries, dependencies and parallel builds)
On 11/02/2012 09:43 AM, Stefano Lattarini wrote: > On 11/02/2012 09:18 AM, Václav Zeman wrote: >> On 1 November 2012 17:42, Diego Elio Pettenò wrote: >>> On 01/11/2012 09:18, Vincent Torri wrote: lib_eo_libeo_la_LIBADD = $(top_builddir)/src/lib/eina/libeina.la >>> >>> Don't use $(top_builddir) and it should work just fine. >> Is there a rationale behind this? I am not saying it is wrong, I just >> want to better understand how things work. >> > My guess is that, albeit having a rule to build 'lib/eina/libeina.la' > -- rule generated by Automake from the > > lib_LTLIBRARIES = lib/eina/libeina.la lib/eo/libeo.la > > assignment -- make is not "smart enough" to recognize that, in > this Makefile (where '$(top_builddir)' expands to '..'), > '$(top_builddir)/src/lib/eina/libeina.la' points in fact to > 'lib/eina/libeina.la'. > > So, when asked to build '$(top_builddir)/src/lib/eina/libeina.la' > as a dependency for 'lib/eo/libeo.la' -- dependency derived from > the > > lib_eo_libeo_la_LIBADD = $(top_builddir)/src/lib/eina/libeina.la > > assignment -- make doesn't know how to proceed, and bails out. > > So better to just remove the useless extra '$(top_builddir)/src' > indirection. Not only this fixes the error, but is also clearer > to human readers IMNSHO. I have tried to change my Makefile.am for a test executable by removing the $(top_builddir). But I am getting errors in libtool invocation: --8<8<8<8<8<8<8<8<8<8<8<-- amber2::wilx:~/log4cplus-bzr/work-trunk/objdir/tests/appender_test> make /bin/bash ../../libtool --tag=CXX --mode=link g++ -save-temps -fverbose-asm -march=native -g3 -ggdb -Wall -Wextra -pedantic -Wstrict-aliasing -Wstrict-overflow -Woverloaded-virtual -Wold-style-cast -Wc++0x-compat -Wc++11-compat -Wundef -Wshadow -Wformat -Wsuggest-attribute=noreturn -Wno-variadic-macros -fkeep-inline-functions -fstack-check -fstack-protector -ftrapv -fvisibility=hidden -pthread -o appender_test main.o src/liblog4cplus.la -lrt libtool: link: cannot find the library `src/liblog4cplus.la' or unhandled argument `src/liblog4cplus.la' make: *** [appender_test] Error 1 --8<8<8<8<8<8<8<8<8<8<8<-- The resulting Makefile.am looks (almost, becuse I use include to factor out common stuff for multiple tests) like this: --8<8<8<8<8<8<8<8<8<8<8<-- AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include AM_LDFLAGS=@LOG4CPLUS_PROFILING_LDFLAGS@ AM_CXXFLAGS=@LOG4CPLUS_PROFILING_CXXFLAGS@ VPATH=@srcdir@:@top_builddir@ noinst_PROGRAMS = appender_test appender_test_SOURCES = main.cxx appender_test_LDADD = src/liblog4cplus.la --8<8<8<8<8<8<8<8<8<8<8<-- The VPATH bit is there because I have tried to fix the error using it. How can I make this work as you have suggested without $(top_builddir)? -- VZ signature.asc Description: OpenPGP digital signature
Re: libtool libraries, dependencies and parallel builds
On 11/02/2012 09:18 AM, Václav Zeman wrote: > On 1 November 2012 17:42, Diego Elio Pettenò wrote: >> On 01/11/2012 09:18, Vincent Torri wrote: >>> lib_eo_libeo_la_LIBADD = $(top_builddir)/src/lib/eina/libeina.la >> >> Don't use $(top_builddir) and it should work just fine. > Is there a rationale behind this? I am not saying it is wrong, I just > want to better understand how things work. > My guess is that, albeit having a rule to build 'lib/eina/libeina.la' -- rule generated by Automake from the lib_LTLIBRARIES = lib/eina/libeina.la lib/eo/libeo.la assignment -- make is not "smart enough" to recognize that, in this Makefile (where '$(top_builddir)' expands to '..'), '$(top_builddir)/src/lib/eina/libeina.la' points in fact to 'lib/eina/libeina.la'. So, when asked to build '$(top_builddir)/src/lib/eina/libeina.la' as a dependency for 'lib/eo/libeo.la' -- dependency derived from the lib_eo_libeo_la_LIBADD = $(top_builddir)/src/lib/eina/libeina.la assignment -- make doesn't know how to proceed, and bails out. So better to just remove the useless extra '$(top_builddir)/src' indirection. Not only this fixes the error, but is also clearer to human readers IMNSHO. HTH, Stefano
Re: libtool libraries, dependencies and parallel builds
On 1 November 2012 17:42, Diego Elio Pettenò wrote: > On 01/11/2012 09:18, Vincent Torri wrote: >> lib_eo_libeo_la_LIBADD = $(top_builddir)/src/lib/eina/libeina.la > > Don't use $(top_builddir) and it should work just fine. Is there a rationale behind this? I am not saying it is wrong, I just want to better understand how things work. -- VZ
Re: libtool libraries, dependencies and parallel builds
On 01/11/2012 09:18, Vincent Torri wrote: > lib_eo_libeo_la_LIBADD = $(top_builddir)/src/lib/eina/libeina.la Don't use $(top_builddir) and it should work just fine. -- Diego Elio Pettenò — Flameeyes flamee...@flameeyes.eu — http://blog.flameeyes.eu/
libtool libraries, dependencies and parallel builds
Hey I want to build to libraries names eina and eo within a single Makefile.am. They are in the following tree structure: src/Makefile.am src/lib/eina/ src/lib/eo eo depends on eina. The Makefile.am file is (i've stripped the unneeded parts) AUTOMAKE_OPTIONS = subdir-objects lib_LTLIBRARIES = lib/eina/libeina.la lib/eo/libeo.la lib_eo_libeo_la_LIBADD = $(top_builddir)/src/lib/eina/libeina.la when I compile with 'make', no problem. With a parallel build (make -j3 for example), I get that error: CC lib/eo/lib_eo_libeo_la-eo_base_class.lo make[3]: *** No rule to make target `../src/lib/eina/libeina.la', needed by `lib/eo/libeo.la'. Stop. make[3]: *** Waiting for unfinished jobs I thought that adding in the LIBADD primary libeina.la was sufficient to deal with dependencies, but it seems that it is not. What should I add to correctly manage dependencies with parallel builds in my case ? thank you Vincent Torri