classification
Title: [HP-UX] ld: Unrecognized argument: +s -L
Type: behavior Stage:
Components: Distutils Versions: Python 2.6
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: tarek Nosy List: haubi, srid, tarek, trentm
Priority: normal Keywords: patch

Created on 2009-06-01 17:20 by srid, last changed 2009-09-09 13:42 by tarek. This issue is now closed.

Files
File name Uploaded Description Edit
distutils_hpux_libdir_option.patch srid, 2009-06-01 17:20
distutils_hpux_libdir_option-gcc.patch haubi, 2009-07-17 13:29
Messages (13)
msg88657 - (view) Author: Sridhar Ratnakumar (srid) Date: 2009-06-01 17:20
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>
msg90625 - (view) Author: Michael Haubenwallner (haubi) * Date: 2009-07-17 13:29
While at it: gcc does not understand '+s', it does need '-Wl,+s'.
msg90722 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-07-20 05:16
Michael, I am not sure how you patch applies, is "elif" meant to be "if" ?
e.g. a gcc compiler under hp-us case ?
msg90727 - (view) Author: Michael Haubenwallner (haubi) * Date: 2009-07-20 09:29
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.
msg92351 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-09-07 08:00
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]
...
}}}
msg92354 - (view) Author: Michael Haubenwallner (haubi) * Date: 2009-09-07 09:16
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!
msg92355 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-09-07 09:36
> 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 !
msg92359 - (view) Author: Michael Haubenwallner (haubi) * Date: 2009-09-07 11:07
> 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!
msg92429 - (view) Author: Sridhar Ratnakumar (srid) Date: 2009-09-08 20:22
> compiler.find("gcc") >= 0 or compiler.find("g++") >= 0

Why not `("gcc" in compiler or "g++" in compiler)`? Just curious.
msg92443 - (view) Author: Michael Haubenwallner (haubi) * Date: 2009-09-09 05:26
> > compiler.find("gcc") >= 0 or compiler.find("g++") >= 0

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

Fine with me too.
msg92446 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-09-09 09:09
done in r74728 (trunk), r74729 (2.6.x), r74730 (pyk3) and r74731 (3.1.x)


Thanks guys !
msg92450 - (view) Author: Sridhar Ratnakumar (srid) Date: 2009-09-09 13:30
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.
msg92451 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-09-09 13:42
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.
History
Date User Action Args
2009-09-09 13:42:35tareksetmessages: + msg92451
2009-09-09 13:30:01sridsetmessages: + msg92450
2009-09-09 09:09:50tareksetstatus: open -> closed

messages: + msg92446
2009-09-09 05:26:05haubisetmessages: + msg92443
2009-09-08 20:22:21sridsetmessages: + msg92429
2009-09-07 11:07:09haubisetmessages: + msg92359
2009-09-07 09:36:00tareksetmessages: + msg92355
2009-09-07 09:16:49haubisetmessages: + msg92354
2009-09-07 08:00:17tareksetmessages: + msg92351
2009-07-20 09:29:06haubisetmessages: + msg90727
2009-07-20 05:16:57tareksetmessages: + msg90722
2009-07-17 13:29:03haubisetfiles: + distutils_hpux_libdir_option-gcc.patch
nosy: + haubi
messages: + msg90625

2009-06-01 17:20:58sridcreate