Building library that depends on another library.

Pawel Jakub Dawidek pjd at FreeBSD.org
Sun May 5 20:12:32 UTC 2013


Hi.

I'm trying to connect two libraries to the build without hacks and it
doesn't work...

My two libraries are libcapsicum and libnv. libcapsicum depends on libnv.
I want to specify this dependency explicitely in libcapsicum's Makefile:

	DPADD=	${LIBNV}
	LDADD=	-lnv

(LIBNV was added to bsd.libnames.mk, in case you wonder.)

From conversation with kan@ (Alexander Kabaev) declaring dependency
directly in library's Makefile is required for symbol versioning to
work. It just sounds right, too.

If this is done, libcapsicum doesn't compile:

	===> lib/libcapsicum (all)
	cc [...]
	cc [...]
	building static capsicum library
	ranlib libcapsicum.a
	cc [...]
	cc [...]
	make: don't know how to make
	/usr/home/pjd/obj/usr/home/pjd/p4/capsicum/tmp/usr/lib/libnv.a. Stop
	*** [all] Error code 2

	Stop in /usr/home/pjd/p4/capsicum/lib.
	*** [lib__L] Error code 1

Note that when build fails libnv.{a,so} exist in <OBJDIR>/lib/libnv/,
but of course not in <OBJDIR>/tmp/usr/lib/.

It looks like to make such dependency work one HAS TO add libnv to
_prebuild_libs in src/Makefile.inc1, which seems wrong. Libraries
specified there from my understanding are just used by build tools:

	LD_LIBRARY_PATH=${INSTALLTMP}	# This is from src/Makefile.inc1.

My understanding was that all I need to do is to add my two libraries in
proper order to SUBDIR_ORDERED variable in src/lib/Makefile.
This means that currently SUBDIR_ORDERED is totally useless.
No matter how libraries are ordered there, to compile, they need
libraries they depend on in Makefile.inc1's _prebuild_libs.

I can of course just add libnv to _prebuild_libs and make it compile
twice for no reason, but maybe there is a better way or maybe I'm just
missing something?

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://mobter.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20130505/7f9262d9/attachment.sig>


More information about the freebsd-arch mailing list