Skip to content

srinivamd/sharedlib

Repository files navigation

g++ --std=c++11 -fPIC -fvisibility=hidden -c fooapi/foo.cpp -o fooapi/foo.o
g++ -fPIC -fvisibility=hidden -shared -Wl,-soname,libfoo.so.1.0.0 -o lib/libfoo.so.1.0.0 fooapi/foo.o
ldd lib/libfoo.so.1.0.0 
	linux-vdso.so.1 =>  (0x00007ffe0e12c000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fcf7f9dc000)
	libm.so.6 => /lib64/libm.so.6 (0x00007fcf7f6da000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fcf7f4c4000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fcf7f0f7000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fcf7fee7000)
g++ --std=c++11 -fPIC -fvisibility=hidden -c fooapir2/foo.cpp -o fooapir2/foo.o
g++ -fPIC -fvisibility=hidden -shared -Wl,-soname,libfoo.so.1.0.2 -o lib/libfoo.so.1.0.2 fooapir2/foo.o
ldd lib/libfoo.so.1.0.*
lib/libfoo.so.1.0.0:
	linux-vdso.so.1 =>  (0x00007fffc7d5d000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f467a3fc000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f467a0fa000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f4679ee4000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f4679b17000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f467a907000)
lib/libfoo.so.1.0.2:
	linux-vdso.so.1 =>  (0x00007ffcc05fd000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f7968bfe000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f79688fc000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f79686e6000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f7968319000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f7969109000)
cd lib; ln -s libfoo.so.1.0.0 libfoo.so.1; ln -s libfoo.so.1 libfoo.so; cd ..
total 40
lrwxrwxrwx. 1 amd amd    11 Sep  4 11:30 libfoo.so -> libfoo.so.1
lrwxrwxrwx. 1 amd amd    15 Sep  4 11:30 libfoo.so.1 -> libfoo.so.1.0.0
-rwxrwxr-x. 1 amd amd 20120 Sep  4 11:16 libfoo.so.1.0.0
-rwxrwxr-x. 1 amd amd 20120 Sep  4 11:23 libfoo.so.1.0.2
g++ --std=c++11 -Ifooapi -fPIC -fvisibility=hidden -c barapi/bar.cpp -o barapi/bar.o
g++ -fPIC -fvisibility=hidden -shared -Wl,-soname,libbar.so.1.0.0 -o lib/libbar.so.1.0.0 barapi/bar.o
cd lib; ln -s libbar.so.1.0.0 libbar.so.1; ln -s libbar.so.1 libbar.so; cd ..
total 60
lrwxrwxrwx. 1 amd amd    11 Sep  4 11:37 libbar.so -> libbar.so.1
lrwxrwxrwx. 1 amd amd    15 Sep  4 11:37 libbar.so.1 -> libbar.so.1.0.0
-rwxrwxr-x. 1 amd amd 20160 Sep  4 11:34 libbar.so.1.0.0
lrwxrwxrwx. 1 amd amd    11 Sep  4 11:30 libfoo.so -> libfoo.so.1
lrwxrwxrwx. 1 amd amd    15 Sep  4 11:30 libfoo.so.1 -> libfoo.so.1.0.0
-rwxrwxr-x. 1 amd amd 20120 Sep  4 11:16 libfoo.so.1.0.0
-rwxrwxr-x. 1 amd amd 20120 Sep  4 11:23 libfoo.so.1.0.2
g++ --std=c++11 -Ifooapi -Ibarapi main.cpp -o main -Llib -lfoo -lbar
LD_LIBRARY_PATH=lib ldd ./main
	linux-vdso.so.1 =>  (0x00007ffca29e4000)
	libfoo.so.1.0.0 => lib/libfoo.so.1.0.0 (0x00007f5a8572a000)
	libbar.so.1.0.0 => lib/libbar.so.1.0.0 (0x00007f5a85526000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f5a8521f000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f5a84f1d000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f5a84d07000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f5a8493a000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f5a8592e000)
Make libbar depend on libfoo - recompile libbar and main app
g++ -fPIC -fvisibility=hidden -shared -Wl,-soname,libbar.so.1.0.0 -o lib/libbar.so.1.0.0 barapi/bar.o -Llib -lfoo
ldd lib/libbar.so
	linux-vdso.so.1 =>  (0x00007ffc5db8e000)
	libfoo.so.1.0.0 => not found
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f82064d2000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f82061d0000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f8205fba000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f8205bed000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f82069dd000)
LD_LIBRARY_PATH=lib ldd lib/libbar.so
	linux-vdso.so.1 =>  (0x00007fff7f1f5000)
	libfoo.so.1.0.0 => lib/libfoo.so.1.0.0 (0x00007f3566b82000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f356687b000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f3566579000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f3566363000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f3565f96000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f3566f8a000)
g++ --std=c++11 -Ifooapi -Ibarapi main.cpp -o main -Llib -lbar
/usr/bin/ld: warning: libfoo.so.1.0.0, needed by lib/libbar.so, not found (try using -rpath or -rpath-link)
/tmp/ccPtxeEW.o: In function `main':
main.cpp:(.text+0xa): undefined reference to `foo'
collect2: error: ld returned 1 exit status

Use rpath to the rescue - recompile libbar telling loader to look in  for dep libs

g++ -fPIC -fvisibility=hidden -shared -Wl,-soname,libbar.so.1.0.0 -Wl,-rpath,$ORIGIN -o lib/libbar.so.1.0.0 barapi/bar.o -Llib -lfoo

Dynamic section at offset 0x2d98 contains 30 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libfoo.so.1.0.0]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000e (SONAME)             Library soname: [libbar.so.1.0.0]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN]
 0x000000000000000c (INIT)               0x1560
 0x000000000000000d (FINI)               0x2010
 0x0000000000000019 (INIT_ARRAY)         0x202d68
 0x000000000000001b (INIT_ARRAYSZ)       16 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x202d78
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x1f0
 0x0000000000000005 (STRTAB)             0x830
 0x0000000000000006 (SYMTAB)             0x2a8
 0x000000000000000a (STRSZ)              1790 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000003 (PLTGOT)             0x203000
 0x0000000000000002 (PLTRELSZ)           960 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x11a0
 0x0000000000000007 (RELA)               0x1038
 0x0000000000000008 (RELASZ)             360 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffe (VERNEED)            0xfa8
 0x000000006fffffff (VERNEEDNUM)         3
 0x000000006ffffff0 (VERSYM)             0xf2e
 0x000000006ffffff9 (RELACOUNT)          4
 0x0000000000000000 (NULL)               0x0
readelf -d main 

Dynamic section at offset 0xdd8 contains 29 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libbar.so.1.0.0]
 0x0000000000000001 (NEEDED)             Shared library: [libfoo.so.1.0.0]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000c (INIT)               0x400500
 0x000000000000000d (FINI)               0x4006f4
 0x0000000000000019 (INIT_ARRAY)         0x600dc0
 0x000000000000001b (INIT_ARRAYSZ)       8 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x600dc8
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x400298
 0x0000000000000005 (STRTAB)             0x4003c0
 0x0000000000000006 (SYMTAB)             0x4002d0
 0x000000000000000a (STRSZ)              171 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x601000
 0x0000000000000002 (PLTRELSZ)           72 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x4004b8
 0x0000000000000007 (RELA)               0x4004a0
 0x0000000000000008 (RELASZ)             24 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffe (VERNEED)            0x400480
 0x000000006fffffff (VERNEEDNUM)         1
 0x000000006ffffff0 (VERSYM)             0x40046c
 0x0000000000000000 (NULL)               0x0
g++ --std=c++11 -Ifooapi -Ibarapi main.cpp -o main -Llib -lbar -lfoo
ldd main
	linux-vdso.so.1 =>  (0x00007ffc4efc7000)
	libbar.so.1.0.0 => not found
	libfoo.so.1.0.0 => not found
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fb8a221f000)
	libm.so.6 => /lib64/libm.so.6 (0x00007fb8a1f1d000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fb8a1d07000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fb8a193a000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fb8a2526000)
LD_LIBRARY_PATH=lib ./main
foo doimpl 10 version 1 foo 
foo doimpl 20 version 1 foo 
bar doimpl 20 version 1 bar 
Upgrade libfoo
cd lib; rm libfoo.so.1; rm libfoo.so; ln -s libfoo.so.1.0.2 libfoo.so.1; ln -s libfoo.so.1 libfoo.so; cd ..
total 60
lrwxrwxrwx. 1 amd amd    11 Sep  4 11:37 libbar.so -> libbar.so.1
lrwxrwxrwx. 1 amd amd    15 Sep  4 11:37 libbar.so.1 -> libbar.so.1.0.0
-rwxrwxr-x. 1 amd amd 20160 Sep  4 11:47 libbar.so.1.0.0
lrwxrwxrwx. 1 amd amd    11 Sep  4 13:06 libfoo.so -> libfoo.so.1
lrwxrwxrwx. 1 amd amd    15 Sep  4 13:06 libfoo.so.1 -> libfoo.so.1.0.2
-rwxrwxr-x. 1 amd amd 20120 Sep  4 11:16 libfoo.so.1.0.0
-rwxrwxr-x. 1 amd amd 20120 Sep  4 11:23 libfoo.so.1.0.2
LD_LIBRARY_PATH=lib ./main 
foo doimpl 10 version 1 foo 
foo doimpl 20 version 1 foo 
bar doimpl 20 version 1 bar 
main app works as libfoo.so.1.0.0 - old version still exists
mv lib/libfoo.so.1.0.0 lib/hide_libfoo.so.1.0.0
total 60
-rwxrwxr-x. 1 amd amd 20120 Sep  4 11:16 hide_libfoo.so.1.0.0
lrwxrwxrwx. 1 amd amd    11 Sep  4 11:37 libbar.so -> libbar.so.1
lrwxrwxrwx. 1 amd amd    15 Sep  4 11:37 libbar.so.1 -> libbar.so.1.0.0
-rwxrwxr-x. 1 amd amd 20160 Sep  4 11:47 libbar.so.1.0.0
lrwxrwxrwx. 1 amd amd    11 Sep  4 13:06 libfoo.so -> libfoo.so.1
lrwxrwxrwx. 1 amd amd    15 Sep  4 13:06 libfoo.so.1 -> libfoo.so.1.0.2
-rwxrwxr-x. 1 amd amd 20120 Sep  4 11:23 libfoo.so.1.0.2
LD_LIBRARY_PATH=lib ./main
./main: error while loading shared libraries: libfoo.so.1.0.0: cannot open shared object file: No such file or directory
Recompile libbar to use upgraded libfoo
readelf -d lib/libbar.so | head -15

Dynamic section at offset 0x2d98 contains 30 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libfoo.so.1.0.0]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000e (SONAME)             Library soname: [libbar.so.1.0.0]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN]
 0x000000000000000c (INIT)               0x1560
 0x000000000000000d (FINI)               0x2010
 0x0000000000000019 (INIT_ARRAY)         0x202d68
 0x000000000000001b (INIT_ARRAYSZ)       16 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x202d78
g++ -fPIC -fvisibility=hidden -shared -Wl,-soname,libbar.so.1.0.1 -Wl,-rpath,$ORIGIN -o lib/libbar.so.1.0.1 barapi/bar.o -Llib -lfoo
total 80
-rwxrwxr-x. 1 amd amd 20120 Sep  4 11:16 hide_libfoo.so.1.0.0
lrwxrwxrwx. 1 amd amd    11 Sep  4 11:37 libbar.so -> libbar.so.1
lrwxrwxrwx. 1 amd amd    15 Sep  4 11:37 libbar.so.1 -> libbar.so.1.0.0
-rwxrwxr-x. 1 amd amd 20160 Sep  4 11:47 libbar.so.1.0.0
-rwxrwxr-x. 1 amd amd 20160 Sep  4 13:15 libbar.so.1.0.1
lrwxrwxrwx. 1 amd amd    11 Sep  4 13:06 libfoo.so -> libfoo.so.1
lrwxrwxrwx. 1 amd amd    15 Sep  4 13:06 libfoo.so.1 -> libfoo.so.1.0.2
-rwxrwxr-x. 1 amd amd 20120 Sep  4 11:23 libfoo.so.1.0.2
libbar.so.1.0.1 is new
./main: error while loading shared libraries: libfoo.so.1.0.0: cannot open shared object file: No such file or directory
readelf -d main | head -10

Dynamic section at offset 0xdd8 contains 29 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libbar.so.1.0.0]
 0x0000000000000001 (NEEDED)             Shared library: [libfoo.so.1.0.0]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000c (INIT)               0x400500
main app still linked with old libbar, fails
readelf -d lib/libbar.so.1.0.1 | head -10

Dynamic section at offset 0x2d98 contains 30 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libfoo.so.1.0.2]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000e (SONAME)             Library soname: [libbar.so.1.0.1]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN]
new libbar.so.1.0.1 needs libfoo.so.1.0.2
rebuild main app
g++ --std=c++11 -Ifooapi -Ibarapi main.cpp -o main -Llib -lbar -lfoo
/usr/bin/ld: warning: libfoo.so.1.0.0, needed by lib/libbar.so, not found (try using -rpath or -rpath-link)
Update libbar so links
cd lib; rm libbar.so.1; rm libbar.so; ln -s libbar.so.1.0.1 libbar.so.1; ln -s libbar.so.1 libbar.so; cd ..
total 80
-rwxrwxr-x. 1 amd amd 20120 Sep  4 11:16 hide_libfoo.so.1.0.0
lrwxrwxrwx. 1 amd amd    11 Sep  4 13:20 libbar.so -> libbar.so.1
lrwxrwxrwx. 1 amd amd    15 Sep  4 13:20 libbar.so.1 -> libbar.so.1.0.1
-rwxrwxr-x. 1 amd amd 20160 Sep  4 11:47 libbar.so.1.0.0
-rwxrwxr-x. 1 amd amd 20160 Sep  4 13:15 libbar.so.1.0.1
lrwxrwxrwx. 1 amd amd    11 Sep  4 13:06 libfoo.so -> libfoo.so.1
lrwxrwxrwx. 1 amd amd    15 Sep  4 13:06 libfoo.so.1 -> libfoo.so.1.0.2
-rwxrwxr-x. 1 amd amd 20120 Sep  4 11:23 libfoo.so.1.0.2
libbar.so points to the latest, libfoo.so points to what libbar needs
rebuild main app
g++ --std=c++11 -Ifooapi -Ibarapi main.cpp -o main -Llib -lbar -lfoo
It worked
ldd main
	linux-vdso.so.1 =>  (0x00007ffc04bfb000)
	libbar.so.1.0.1 => not found
	libfoo.so.1.0.2 => not found
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f7803266000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f7802f64000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f7802d4e000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f7802981000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f780356d000)
LD_LIBRARY_PATH=lib ldd main
	linux-vdso.so.1 =>  (0x00007ffe838c8000)
	libbar.so.1.0.1 => lib/libbar.so.1.0.1 (0x00007f9141780000)
	libfoo.so.1.0.2 => lib/libfoo.so.1.0.2 (0x00007f914157c000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f9141275000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f9140f73000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f9140d5d000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f9140990000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f9141984000)
Shows main using correct versions of libs
LD_LIBRARY_PATH=lib ./main
foo 2 doimpl 10 version 2 foo 
foo 2 doimpl 20 version 2 foo 
bar doimpl 20 version 1 bar 
Note libfoo version 2 got called by bar
How to make updates to foo so libbar doesn't need to be recompiled
use correct soname spec
build libfoo
change just libfile names
g++ -fPIC -fvisibility=hidden -shared -Wl,-soname,libfoo.so.1 -o lib.so/libfoo.so.1.0.0 fooapi/foo.o
cd lib.so; ln -s libfoo.so.1.0.0 libfoo.so.1; ln -s libfoo.so.1 libfoo.so; cd ..
g++ -fPIC -fvisibility=hidden -shared -Wl,-soname,libbar.so.1 -Wl,-rpath,$ORIGIN -o lib.so/libbar.so.1.0.0 barapi/bar.o -Llib.so -lfoo 
ldd lib.so/libbar.so.1.0.0 
	linux-vdso.so.1 =>  (0x00007ffc2a17c000)
	libfoo.so.1 => /datadisk/git-repos/sharedlib/lib.so/libfoo.so.1 (0x00007f46b803e000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f46b7d37000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f46b7a35000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f46b781f000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f46b7452000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f46b8446000)
Note libbar only depends on libfoo.so.1 not libfoo.so.1.0.0, last 2 digits dont care
Build main
/usr/bin/ld: cannot find -lbar
collect2: error: ld returned 1 exit status
cd lib.so; ln -s libbar.so.1.0.0 libbar.so.1; ln -s libbar.so.1 libbar.so; cd ..
g++ --std=c++11 -Ifooapi -Ibarapi main.cpp -o main -Llib.so -lbar -lfoo 
ldd main
	linux-vdso.so.1 =>  (0x00007ffec730a000)
	libbar.so.1 => not found
	libfoo.so.1 => not found
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f2547558000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f2547256000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f2547040000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f2546c73000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f254785f000)
note the lib versions conform to soname spec
LD_LIBRARY_PATH=lib.so ./main
foo doimpl 10 version 1 foo 
foo doimpl 20 version 1 foo 
bar doimpl 20 version 1 bar 
Now update libfoo
g++ -fPIC -fvisibility=hidden -shared -Wl,-soname,libfoo.so.1 -o lib.so/libfoo.so.1.0.2 fooapir2/foo.o
keep soname_spec compatible but filename changed
ls -l lib.so
total 60
lrwxrwxrwx. 1 amd amd    11 Sep  4 13:34 libbar.so -> libbar.so.1
lrwxrwxrwx. 1 amd amd    15 Sep  4 13:34 libbar.so.1 -> libbar.so.1.0.0
-rwxrwxr-x. 1 amd amd 20160 Sep  4 13:31 libbar.so.1.0.0
lrwxrwxrwx. 1 amd amd    11 Sep  4 13:30 libfoo.so -> libfoo.so.1
lrwxrwxrwx. 1 amd amd    15 Sep  4 13:30 libfoo.so.1 -> libfoo.so.1.0.0
-rwxrwxr-x. 1 amd amd 20120 Sep  4 13:29 libfoo.so.1.0.0
-rwxrwxr-x. 1 amd amd 20120 Sep  4 13:37 libfoo.so.1.0.2
rerun main
foo doimpl 10 version 1 foo 
foo doimpl 20 version 1 foo 
bar doimpl 20 version 1 bar 
it worked but did not use updated libfoo version 2
update libfoo.so.1 soname link to point to lated
cd lib.so; rm libfoo.so.1; ln -s libfoo.so.1.0.2 libfoo.so.1; cd ..
ls -l lib.so
total 60
lrwxrwxrwx. 1 amd amd    11 Sep  4 13:34 libbar.so -> libbar.so.1
lrwxrwxrwx. 1 amd amd    15 Sep  4 13:34 libbar.so.1 -> libbar.so.1.0.0
-rwxrwxr-x. 1 amd amd 20160 Sep  4 13:31 libbar.so.1.0.0
lrwxrwxrwx. 1 amd amd    11 Sep  4 13:30 libfoo.so -> libfoo.so.1
lrwxrwxrwx. 1 amd amd    15 Sep  4 13:39 libfoo.so.1 -> libfoo.so.1.0.2
-rwxrwxr-x. 1 amd amd 20120 Sep  4 13:29 libfoo.so.1.0.0
-rwxrwxr-x. 1 amd amd 20120 Sep  4 13:37 libfoo.so.1.0.2
rerun main - does it pick new libfoo
LD_LIBRARY_PATH=lib.so ./main 
foo 2 doimpl 10 version 2 foo 
foo 2 doimpl 20 version 2 foo 
bar doimpl 20 version 1 bar 
yes foo 2
no need to rebuild libbar or main with updated libfoo as it was compatible

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published