Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 May 2013 22:14:36 +0200
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        freebsd-arch@FreeBSD.org
Subject:   Building library that depends on another library.
Message-ID:  <20130505201436.GJ1374@garage.freebsd.pl>

next in thread | raw e-mail | index | archive | help

--d6iqOn7HZPWKXx18
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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=3D	${LIBNV}
	LDADD=3D	-lnv

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

=46rom 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:

	=3D=3D=3D> 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=3D${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?

--=20
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://mobter.com

--d6iqOn7HZPWKXx18
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (FreeBSD)

iEYEARECAAYFAlGGvawACgkQForvXbEpPzRsWgCg8nPMvZGjbs2JBIcTS9nq9WNH
zAAAoIikolVH5v0UMCN5bwzG62GPyc+M
=Z+C5
-----END PGP SIGNATURE-----

--d6iqOn7HZPWKXx18--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130505201436.GJ1374>