Hello Tim,

we just tried the trunk. It's better but there are still multiple
problems:
- LDFLAGS is not used when you link the executables (it's only used when
  you link libregfi)
- the default value for LDFLAGS is wrong, "-z relro" is an option for "ld" but
  when you pass it through gcc you need "-Wl,-z,relro" 
- I saw you tried to hack up some code to setup the SONAME... it does set
  the SONAME on the library but the library is still installed under the
  wrong name (libregfi.so instead of the name set in the SONAME)
- the SONAME must not encode the full version... it's only a simple
  counter of API/ABI compatibility. Please use "libregfi.so.0" as
  the first SONAME (and then bump to libregfi.so.1 when you break
  the ABI/API, etc.) (and 99.99.99.X looks really wrong as a version number :))

While lookinto in Scons support for versioned shared library I found this:
http://stackoverflow.com/questions/2997001/how-to-get-shared-library-names-like-libhello-so-0-0-1-with-scons

http://www.scons.org/doc/production/HTML/scons-user/apb.html#b-SharedLibrary

So it looks like it's supported since version 2.3.0... I just tried this
and got good results:

--- a/SConstruct
+++ b/SConstruct
@@ -9,10 +9,9 @@ cflags = '-std=gnu99 -pedantic -Wall -D_
 cflags += ' -DREGFI_VERSION=\'"%s"\' ' % REGFI_VERSION
 cflags += os.environ.get('CFLAGS','-fPIE -pie -fstack-protector 
-D_FORTIFY_SOURCE=2')
 
-linkflags = "-shared -fPIC -Wl,-soname,libregfi.so.%s " % REGFI_VERSION
+linkflags = "-shared -fPIC "
 linkflags += os.environ.get('LDFLAGS','-z relro -z now')
 
 lib_src = ['lib/regfi.c',
@@ -31,7 +30,7 @@ env = Environment(ENV=os.environ,
 # Libraries
 libregfi_static = env.Library(lib_src)
 libregfi = env.SharedLibrary(lib_src, LIBS=['m','pthread', 'talloc'], 
-                             LINKFLAGS=linkflags)
+                             SHLIBVERSION='0.0.0', LINKFLAGS=linkflags)
 
 
 # Executables
@@ -64,7 +63,7 @@ install_bin = [destdir + bindir, destdir
 install_lib = [destdir + libdir, destdir + includedir + '/regfi']
 
 env.Install(destdir+bindir, [reglookup, reglookup_recover, 
'bin/reglookup-timeline'])
-libinstall = env.Install(destdir+libdir, [libregfi, libregfi_static])
+libinstall = env.InstallVersionedLib(destdir+libdir, [libregfi, 
libregfi_static], SHLIBVERSION='0.0.0')
 env.Install(destdir+includedir+'/regfi', Glob('include/*.h'))
 env.Install(destdir+mandir+'/man1', [man_reglookup, man_reglookup_recover,
                                      man_reglookup_timeline])




but does not seem
to make any difference between the version used in the filename (ideally
libfoo.so.X.Y.Z) and the SONAME which is usually simpler (libfoo.so.X and
which is the reason why the symlinks libfoo.so.X are needed when you
install the library as libfoo.so.X.Y.Z). I would thus suggest to pass a
single integer to SHLIBVERSION and not care about having a filename
encoding the full version.

full version filename and the SONAME

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Support Debian LTS: http://www.freexian.com/services/debian-lts.html
Learn to master Debian: http://debian-handbook.info/get/


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to