code duplication in ccan (was: Re: snprintf on SunOS)

Rusty Russell rusty at rustcorp.com.au
Fri Jun 22 17:37:21 MDT 2012


On Thu, 21 Jun 2012 14:22:37 +0200, Jelmer Vernooij <jelmer at samba.org> wrote:
> On Mon, Jun 18, 2012 at 11:04:48AM +0930, Rusty Russell wrote:
> > On Sat, 16 Jun 2012 10:28:46 +0200, Jelmer Vernooij <jelmer at samba.org> wrote:
> > > Hi Rusty!
> 
> > Hi Jelmer!
> 
> > > > Because you'd have to maintain an ABI.  And that would stop us from
> > > > fixing bugs or removing functions; you really don't want a bag of utils
> > > > to be a shared library!
> 
> > > > Or we could keep changing the ABI, making it useless for anyone outside
> > > > Samba anyway.
> > > The problem is that in its current form, we already rely on the ccan
> > > ABI not changing.
> 
> > > If you have an older version of tdb installed on your system which includes a
> > > copy of ccan and you build a newer version of Samba, then you end up
> > > with ABI incompatibilities.
> > ?????!! WTF?
> 
> > No, this is *completely* wrong!
> 
> > Why do you think this?  How would that work?
> ntdb ships a copy of ccan, which gets built as a shared library.

Argh, yes the *top-level* build does that.  configure and build inside
lib/ntdb, and waf gets it right and doesn't try to make ccan a shared
library or any such stupidity.  Fix below.

(I wrote an analsyis of -ffunction-sections and --gc-sections here,
which is perfect for CCAN, but unfortunately that causes ld to segfault
if we use it for a top-level build!).

Subject: ccan: we're a subsystem, not a library.

Don't expose a libccan; it would produce clashes if someone else does the
same thing.  Just build in the bits we need.

Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

diff --git a/lib/ccan/wscript b/lib/ccan/wscript
index c1dae41..882f5d8 100644
--- a/lib/ccan/wscript
+++ b/lib/ccan/wscript
@@ -128,12 +128,10 @@ def build(bld):
                             source=bld.path.ant_glob('%s/*.c' % ccan_dir))
 
     if bld.env.DEVELOPER_MODE:
-        bld.SAMBA_LIBRARY('ccan-failtest',
+        bld.SAMBA_SUBSYSTEM('ccan-failtest',
                           source=bld.path.ant_glob('failtest/*.c'),
-                          deps='execinfo ccan ccan-htable ccan-list ccan-read_write_all ccan-time',
-                          private_library=True)
+                          deps='execinfo ccan ccan-htable ccan-list ccan-read_write_all ccan-time')
 
-    bld.SAMBA_LIBRARY('ccan',
+    bld.SAMBA_SUBSYSTEM('ccan',
                       source='',
-                      deps='ccan-err ccan-hash ccan-ilog ccan-likely ccan-tally',
-                      private_library=True)
+                      deps='ccan-err ccan-hash ccan-ilog ccan-likely ccan-tally')


More information about the samba-technical mailing list