Re: [PATCH] libtool.m4: Handle "/" as a sysroot more correctly

Roumen Petrov <[email protected]> Wed, 17 Jan 2024 09:32:56 +0200
Newsgroups gmane.comp.gnu.libtool.patches
Message-ID <[email protected]>
Hi All,

Mike Frysinger wrote:
> On 16 Jan 2024 21:47, Richard Purdie wrote:
>> If $CC has --sysroot=/, it is a valid configuration however libtool will
>> then set lt_sysroot to "/".
>>
>> This means references like $lt_sysroot$libdir become //usr/lib instead
>> of the more normally expected /usr/lib. This may or may not break something
>> but certainly is confusing to the user and gives confusing output. Making
>> "/" simply unset lt_sysroot is much cleaner.
> could the same argument be made if the returned value is "/opt/sysroot/"
> and not just "/opt/sysroot" ?  not sure if gcc forces normalization on its
> side.  but we could "simplify" this with:

I cannot see reason /path/ vs /path1 to be considered as critical.

But / vs empty is another story.
Prefix // means UNC name in some build environments.

> # Trim trailing / since we'll always append absolute paths and we want
> # to avoid //, if only for less confusing output for the user.
> lt_sysroot=`$CC --print-sysroot 2>/dev/null | $SED 's:/\+$::'`

May be issues is from cygwin build environment.

> -mike

Regards,
Roumen