[Scons-users] Possible bug with versioned libraries and cache enabled

Ken Bellock ken at bellock.net
Tue Feb 14 07:26:20 EST 2017



Original StackOverflow Question: http://stackoverflow.com/questions/422
11926/what-is-the-proper-usage-of-scons-with-versioned-libraries-and-
the-cache-enabled

When I activate the scons cache on the following minimum working
example, on linux, if I build, clean, and then build, the second build
will break. Without the cache, this example works every time.

I have also noticed with the cache turned on, and building just one
shared versioned library with the cache turned on, if I delete one of
the symlinks, and then re-run scons, it does not re-create the link, as
I would expect it to do.

If this is a bug, is there a workaround till a fix is integrated into a
release?

The following MWE was executed on a Fedora 25, with all updates as of
2/11/2017.


>> scons --version      
SCons by Steven Knight et al.:
    script: v2.5.1.rel_2.5.1:3735:9dc6cee5c168[MODIFIED], 2016/11/03
14:02:02, by bdbaddog on mongodog
    engine: v2.5.1.rel_2.5.1:3735:9dc6cee5c168[MODIFIED], 2016/11/03
14:02:02, by bdbaddog on mongodog
    engine path: ['/usr/lib/scons/SCons']
Copyright (c) 2001 - 2016 The SCons Foundation

>> tree                 
.
├── bar.cpp
├── foo.cpp
└── SConstruct

0 directories, 3 files

>> cat bar.cpp
void bar() {}

>> cat foo.cpp
void foo() {}

>> cat SConstruct 
CacheDir('cache')
SharedLibrary('foo.cpp', SHLIBVERSION='1.0.0')
SharedLibrary('bar.cpp', SHLIBVERSION='1.0.0', LIBS=['foo'],
LIBPATH=['.'])

>> scons --cache-debug=-
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
CacheRetrieve(bar.os):  f51aa60a1d1f47f50a872599e2d0039c not in cache
g++ -o bar.os -c -fPIC bar.cpp
CachePush(bar.os):  pushing to f51aa60a1d1f47f50a872599e2d0039c
CacheRetrieve(foo.os):  77ed043971b55f5e85a799d399e1e01a not in cache
g++ -o foo.os -c -fPIC foo.cpp
CachePush(foo.os):  pushing to 77ed043971b55f5e85a799d399e1e01a
CacheRetrieve(libfoo.so.1.0.0):  9d28d253e1e1adfb32090d08cd7cef90 not
in cache
g++ -o libfoo.so.1.0.0 -shared -Wl,-Bsymbolic -Wl,-soname=libfoo.so.1
foo.os
Create symlinks for: 'libfoo.so.1.0.0': 'libfoo.so.1'-
>'libfoo.so.1.0.0', 'libfoo.so'->'libfoo.so.1.0.0'
CachePush(libfoo.so.1.0.0):  pushing to
9d28d253e1e1adfb32090d08cd7cef90
CacheRetrieve(libbar.so.1.0.0):  4cd497b57418be29d85006d10e13e5e8 not
in cache
g++ -o libbar.so.1.0.0 -shared -Wl,-Bsymbolic -Wl,-soname=libbar.so.1
bar.os -L. -lfoo
Create symlinks for: 'libbar.so.1.0.0': 'libbar.so.1'-
>'libbar.so.1.0.0', 'libbar.so'->'libbar.so.1.0.0'
CachePush(libbar.so.1.0.0):  pushing to
4cd497b57418be29d85006d10e13e5e8
scons: done building targets.

>> tree
.
├── bar.cpp
├── bar.os
├── cache
│   ├── 4C
│   │   └── 4cd497b57418be29d85006d10e13e5e8
│   ├── 77
│   │   └── 77ed043971b55f5e85a799d399e1e01a
│   ├── 9D
│   │   └── 9d28d253e1e1adfb32090d08cd7cef90
│   ├── config
│   └── F5
│       └── f51aa60a1d1f47f50a872599e2d0039c
├── foo.cpp
├── foo.os
├── libbar.so -> libbar.so.1.0.0
├── libbar.so.1 -> libbar.so.1.0.0
├── libbar.so.1.0.0
├── libfoo.so -> libfoo.so.1.0.0
├── libfoo.so.1 -> libfoo.so.1.0.0
├── libfoo.so.1.0.0
└── SConstruct

5 directories, 16 files

>> scons -c
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Cleaning targets ...
Removed bar.os
Removed foo.os
Removed libfoo.so.1.0.0
Removed libfoo.so
Removed libfoo.so.1
Removed libbar.so.1.0.0
Removed libbar.so
Removed libbar.so.1
scons: done cleaning targets.

>> tree
.
├── bar.cpp
├── cache
│   ├── 4C
│   │   └── 4cd497b57418be29d85006d10e13e5e8
│   ├── 77
│   │   └── 77ed043971b55f5e85a799d399e1e01a
│   ├── 9D
│   │   └── 9d28d253e1e1adfb32090d08cd7cef90
│   ├── config
│   └── F5
│       └── f51aa60a1d1f47f50a872599e2d0039c
├── foo.cpp
└── SConstruct

5 directories, 8 files

>> scons --cache-debug=-
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
Retrieved `bar.os' from cache
CacheRetrieve(bar.os):  retrieving from
f51aa60a1d1f47f50a872599e2d0039c
Retrieved `foo.os' from cache
CacheRetrieve(foo.os):  retrieving from
77ed043971b55f5e85a799d399e1e01a
Retrieved `libfoo.so.1.0.0' from cache
CacheRetrieve(libfoo.so.1.0.0):  retrieving from
9d28d253e1e1adfb32090d08cd7cef90
CacheRetrieve(libbar.so.1.0.0):  58ec677dbfc7c655a0cef296b479b485 not
in cache
g++ -o libbar.so.1.0.0 -shared -Wl,-Bsymbolic -Wl,-soname=libbar.so.1
bar.os -L. -lfoo
/bin/ld: cannot find -lfoo
collect2: error: ld returned 1 exit status
scons: *** [libbar.so.1.0.0] Error 1
scons: building terminated because of errors.

>> tree
.
├── bar.cpp
├── bar.os
├── cache
│   ├── 4C
│   │   └── 4cd497b57418be29d85006d10e13e5e8
│   ├── 77
│   │   └── 77ed043971b55f5e85a799d399e1e01a
│   ├── 9D
│   │   └── 9d28d253e1e1adfb32090d08cd7cef90
│   ├── config
│   └── F5
│       └── f51aa60a1d1f47f50a872599e2d0039c
├── foo.cpp
├── foo.os
├── libfoo.so.1.0.0
└── SConstruct

5 directories, 11 files

Thanks,
Ken Bellock
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20170214/5a952595/attachment.html>


More information about the Scons-users mailing list