[Coin-discuss] Finding libs at run time and Cbc/Dylp

Lou Hafer lou at cs.sfu.ca
Mon Mar 27 15:13:05 EST 2006


Francois,

> I don't understand how the different makefiles interact.

	Welcome to the club  :-).
	
	More seriously --- It looks like there's a convention in the makefiles
	to have a top-level Makefile, which coordinates the various builds for a
	component, and then a subsidiary file, Makefile.xxx, which does the
	heavy lifting.  So, for example, in Osi you see Makefile, and
	Makefile.Osi.  Makefile does various bits of setup, then has a selection
	of targets.  libOsi calls `make -f Makefile.Osi' to actually build
	libOsi.  unitTest calls `make -f Test/Makefile' (paraphrased), which
	will in turn call make with Test/Makefile.test.  But there's an
	inconsistency, in that Makefile.Osi defines LibType as well as OptLevel,
	while Makefile.test defines only OptLevel.
	
	Cbc has a similar structure, though I've managed to obscure it a bit.
	
	Not sure how this came about. This sort of thing tends to creep in as
	code evolves. Occasionally there's a major reorganisation, and all is
	consistent again, for a month or two :-). I think the TLC is working
	up to this (major reorganisation of build structure).
	
	Laci's change to Makefile.Linux nicely deals with the problem. As an
	unofficial maintainer of Makefile.SunOS, I'll tweak it to behave in
	the same way.
	
> Printing the value of SHLINKPREFIX just before the linking command
> yields an empty string. So, apparently, SHLINKPREFIX is not set to 
> -Wl,-rpath, as I would expect it to be from line 87 in 
> Coin/Makefiles/Makefile.Linux. What is even more
> strange is that if I put junk inside Coin/Makefiles/Makefile.Linux, 
> around line 87, i.e. something like

> ifeq (${LibType},SHARED)
> zz
>     LD  := $(CXX) -o
>     LIBLDFLAGS := -shared
>     LIBEXT := $(SHARED_LIBEXT)
>     CXXFLAGS += -fPIC
>     SHLINKPREFIX := -Wl,-rpath,
> else

> and then I try to compile BAC, I get:

> (cd /home/prov/COIN/Osi/OsiClp && make install)
> make[1]: Entering directory `/home/prov/COIN/Osi/OsiClp'
> /home/prov/COIN/Makefiles/Makefile.Linux:83: *** missing separator.  Stop.
> make[1]: Leaving directory `/home/prov/COIN/Osi/OsiClp'
> make: *** [libdepend] Error 2

> So, apparently, SHINKPREFIX is set properly in Makefile.Linux, but then
> it is unset somewhere.

	Actually, I think not. I'm pretty sure all you're seeing here is
	make's parser complaining, before make actually tries to answer the
	question posed by `ifeq (${LibType},SHARED)'. You can see similar
	effects in shell parsers when dealing with potentially undefined
	variables.
	
							Lou




More information about the Coin-discuss mailing list