scons icon indicating copy to clipboard operation
scons copied to clipboard

scons fails to append .so if the library name has a period in it

Open bdbaddog opened this issue 7 years ago • 2 comments

This issue was originally created at: 2008-01-03 23:54:25. This issue was reported by: bdbaddog.

bdbaddog said at 2008-01-03 23:54:26

This issue, in my case, is causing scons not to find and install libtcl8.4g.so into a directory where it will be found by the link step. Instead of searching for libtcl8.4g.so, it looks for libtcl8.4g. The not splitext(fname)[1] looks to be the culpret here.

I believe its being called by scan() in Prog.py. I don't see a way to propagate a flag of ensure_suffix=True through Prog.py. I'm not sure that makes sense in a general case.

Here's some code to demonstrate the issue using adjustixes from SCons.Util

import os.path
from os.path import splitext

def adjustixes(fname, pre, suf, ensure_suffix=False):
    if pre:
        path, fn = os.path.split(os.path.normpath(fname))
        if fn[: len(pre)] != pre:
            fname = os.path.join(path, pre + fn)
    # Only append a suffix if the suffix we're going to add isn't already
    # there, and if either we've been asked to ensure the specific suffix
    # is present or there's no suffix on it at all.
    if suf and fname[-len(suf) :] != suf and (ensure_suffix or not splitext(fname)[1]):
        fname = fname + suf
    return fname


print(adjustixes("tcl8.4g", "lib", ".so"))
print(adjustixes("tcl8.4", "lib", ".so"))
print(adjustixes("tcl84", "lib", ".so"))

gregnoel said at 2008-04-14 11:21:10

Bug party: Bill will bring this topic up in the mailing list for more discussion.

stevenknight said at 2008-05-22 09:30:48

Reassigning to Bill to research how to document this, probably how to use the File() function to set the name and suffix explicitly. It doesn't seem like we can fix it in code w/out breaking someone's existing use case.

bdbaddog said at 2009-03-02 22:39:23

I believe this is just something which needs docs. So it could be an anytime bug. Unless for some reason the function changes and the issue is no longer there.

gregnoel said at 2009-03-05 09:43:59

Bug party triage.

coppro said at 2009-12-01 15:40:37

*** Issue 2528 has been marked as a duplicate of this issue. ***

coppro said this issue is duplicated by #2528 at 2009-12-01 15:40:37.

bdbaddog avatar Jan 02 '18 11:01 bdbaddog

Is this affected by PR #3848? Or does this remain an elusive goal?

mwichmann avatar Jan 09 '21 15:01 mwichmann

Answering my own question, it's not affected by #3848. Seems kind of ugly that it's stripping "extensions" that aren't, that are instead part of the library name - and tcl continues to be a good example of a library that uses a dot, because it includes the version in the library name. But I'm not seeing how to do better short of only trying to strip "recognized" suffices. splitext isn't going to do that...

mwichmann avatar Feb 27 '21 22:02 mwichmann