Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HP-UX] ld: Unrecognized argument: +s -L<dir> #50413

Closed
srid mannequin opened this issue Jun 1, 2009 · 13 comments
Closed

[HP-UX] ld: Unrecognized argument: +s -L<dir> #50413

srid mannequin opened this issue Jun 1, 2009 · 13 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@srid
Copy link
Mannequin

srid mannequin commented Jun 1, 2009

BPO 6163
Nosy @tarekziade, @haubi
Files
  • distutils_hpux_libdir_option.patch
  • distutils_hpux_libdir_option-gcc.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/tarekziade'
    closed_at = <Date 2009-09-09.09:09:50.746>
    created_at = <Date 2009-06-01.17:20:58.393>
    labels = ['type-bug', 'library']
    title = '[HP-UX] ld: Unrecognized argument: +s -L<dir>'
    updated_at = <Date 2009-09-09.13:42:35.856>
    user = 'https://bugs.python.org/srid'

    bugs.python.org fields:

    activity = <Date 2009-09-09.13:42:35.856>
    actor = 'tarek'
    assignee = 'tarek'
    closed = True
    closed_date = <Date 2009-09-09.09:09:50.746>
    closer = 'tarek'
    components = ['Distutils']
    creation = <Date 2009-06-01.17:20:58.393>
    creator = 'srid'
    dependencies = []
    files = ['14144', '14514']
    hgrepos = []
    issue_num = 6163
    keywords = ['patch']
    message_count = 13.0
    messages = ['88657', '90625', '90722', '90727', '92351', '92354', '92355', '92359', '92429', '92443', '92446', '92450', '92451']
    nosy_count = 4.0
    nosy_names = ['tarek', 'trentm', 'srid', 'haubi']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue6163'
    versions = ['Python 2.6']

    @srid
    Copy link
    Mannequin Author

    srid mannequin commented Jun 1, 2009

    this is also applicable to 3.1 (albeit the source is slightly changed)

    Return a *list* of options otherwise these may be improperly interpreted as
    one option with an embedded space. On /usr/bin/ld on a HP-UX/IA64 box this
    results in:
    ld: Unrecognized argument: +s -L<dir>

    @srid srid mannequin assigned tarekziade Jun 1, 2009
    @srid srid mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Jun 1, 2009
    @haubi
    Copy link
    Mannequin

    haubi mannequin commented Jul 17, 2009

    While at it: gcc does not understand '+s', it does need '-Wl,+s'.

    @tarekziade
    Copy link
    Mannequin

    tarekziade mannequin commented Jul 20, 2009

    Michael, I am not sure how you patch applies, is "elif" meant to be "if" ?
    e.g. a gcc compiler under hp-us case ?

    @haubi
    Copy link
    Mannequin

    haubi mannequin commented Jul 20, 2009

    Ohw, indeed, this line was copied from 3 lines below, sorry!
    The actual patch I'm using does not do { compiler[:3] == 'gcc' }, but {
    compiler.find("gcc") }, to also work when CC=gcc-version, but this is a
    different problem independent of hp-ux.

    But exactly, his should be 'if', being gcc on hp-ux.

    @tarekziade
    Copy link
    Mannequin

    tarekziade mannequin commented Sep 7, 2009

    Ok so, just to make sure, the final patch for both changes should be:

    {{{
    ...
    elif sys.platform[:5] == "hp-ux":
    if compiler.find('gcc'):
    return ["-Wl,+s", "-L" + dir]
    return ["+s", "-L" + dir]
    ...
    }}}

    @haubi
    Copy link
    Mannequin

    haubi mannequin commented Sep 7, 2009

    Basically yes, two minor ones:
    *) also look for 'g++',
    *) string.find() returns the index where found, -1 when not found,
    so:
    {{{
    ...
    elif sys.platform[:5] == "hp-ux":
    if compiler.find('gcc') >= 0 or compiler.find('g++') >= 0:
    return ["-Wl,+s", "-L" + dir]
    return ["+s", "-L" + dir]
    ...
    }}}

    Two lines below already is another search for 'gcc' or 'g++', which also
    should be changed from 'compiler[:3]' to 'compiler.find()':
    {{{
    ...
    elif compiler.find("gcc") >= 0 or compiler.find("g++") >= 0:
    return "-Wl,-R" + dir
    ...
    }}}

    Thank you!

    @tarekziade
    Copy link
    Mannequin

    tarekziade mannequin commented Sep 7, 2009

    Two lines below already is another search for 'gcc' or 'g++',
    which also should be changed from 'compiler[:3]' to 'compiler.find()'

    But compiler[:3] implies that the compiler string starts *with* 'gcc'.

    so are you sure we're looking for 'gcc' anywhere in the string,
    or at the beginning of it ?

    In any case, I find these string searches very weak in there. I am going
    to refactor a function in distutils that guesses the type of compiler,
    given a list of known compilers 'names' and a list of matching strings
    (or regular expressions) for them.

    I'll take all cases from unixcompiler and add a test for that, then use
    it in this code.

    Please don't hesitate to give me your list of

    compiler string -> compiler 'type'

    so I can add them in my test.

    Thanks !

    @haubi
    Copy link
    Mannequin

    haubi mannequin commented Sep 7, 2009

    But compiler[:3] implies that the compiler string starts *with* 'gcc'.

    so are you sure we're looking for 'gcc' anywhere in the string,
    or at the beginning of it ?

    It is very common to use the host triplet in the compiler name, like
    'i686-pc-linux-gnu-gcc', even for non-cross builds. Sometimes the
    compiler string also looks like 'ccache gcc' or 'distcc gcc'. Even
    '/path/to/some/gcc' is possible, in combination with '/path/to/ccache'
    and/or '/path/to/distcc'. And sometimes the version number is appended,
    like 'gcc-X.Y.Z'. Also ABI-specific flags might be set there, like 'gcc
    -m32'.

    In any case, I find these string searches very weak in there.

    Agreed, but AFAICT, native and other non-gcc compilers never do have
    something like 'gcc' in their installation path, especially not in their
    executable basename (on AIX, HP-UX, Solaris). So eventually it is save
    enough to search for gcc/g++ after the last path-separator, although
    this won't work for things like 'gcc -I/my/local/include'.

    I am going to refactor a function in distutils that guesses the type
    of compiler, given a list of known compilers 'names' and a list of
    matching strings (or regular expressions) for them.

    The most reliable way IMHO would be to preprocess '#ifdef __GNUC__', and
    avoid searching the compiler string for anything.

    Thank you!

    @srid
    Copy link
    Mannequin Author

    srid mannequin commented Sep 8, 2009

    compiler.find("gcc") >= 0 or compiler.find("g++") >= 0

    Why not ("gcc" in compiler or "g++" in compiler)? Just curious.

    @haubi
    Copy link
    Mannequin

    haubi mannequin commented Sep 9, 2009

    > compiler.find("gcc") >= 0 or compiler.find("g++") >= 0

    Why not ("gcc" in compiler or "g++" in compiler)? Just curious.

    Fine with me too.

    @tarekziade
    Copy link
    Mannequin

    tarekziade mannequin commented Sep 9, 2009

    done in r74728 (trunk), r74729 (2.6.x), r74730 (pyk3) and r74731 (3.1.x)

    Thanks guys !

    @tarekziade tarekziade mannequin closed this as completed Sep 9, 2009
    @srid
    Copy link
    Mannequin Author

    srid mannequin commented Sep 9, 2009

    From http://svn.python.org/view/python/trunk/Misc/NEWS?
    r1=74728&r2=74727&pathrev=74728

    "Initial patch by Sridhar Ratnakumar"

    The author of the initial patch - distutils_hpux_libdir_option.patch -
    is actually Trent Mick. I only pulled it from the ActivePython patches/
    directory and reported it here. I must have mentioned this before; and
    I will do so from now.

    @tarekziade
    Copy link
    Mannequin

    tarekziade mannequin commented Sep 9, 2009

    The rule I apply is as follow (any other rule would be too complicated
    for me):

    I add in Misc/NEWS the name of the user that initialy provides the patch
    in the tracker.

    If you want a different name, you need to provide a patch with the text
    you want to see in Misc/NEWS included.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    0 participants