mainAutoconf - Support: sr #110359, PATH ignored searching for g++

 
 

sr #110359: PATH ignored searching for g++

Submitter:  None
Submitted:  Mon 02 Nov 2020 01:24:22 PM UTC
   
 
Priority:  * 5 - Unprioritized Severity:  3 - Normal
Status:  Not Autoconf Privacy:  Public
Assigned to:  None Originator Email:  -email is unavailable-
Open/Closed:  Closed Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 15 Nov 2020 08:54:44 PM UTC, comment #1: 

I cannot reproduce this problem using only code from autoconf proper, e.g.


AC_INIT([foo], [1])
AC_PROG_CXX
AC_OUTPUT


reliably selects the first g++ to be found in $PATH.

I can reproduce this problem with your configure script, but only if I don't give a --with-tools or --with-toolbin option.

I believe the bug is in your NMS_TOOLS macro, specifically this bit


if test -d $tools/bin ; then
  toolbin=$tools/bin
fi


If control reaches this point with $tools empty, which is what happens when neither --with-tools or --with-toolbin is used, it will set $toolbin to "/bin" on any system where /bin exists, and then that directory will be prepended to $PATH.

I tried this rewrite of NMS_TOOLS and it works for me:


AC_DEFUN([NMS_TOOLS],
[AC_SUBST([tools], [])
AC_SUBST([toolbin], [])
AC_ARG_WITH([tools],
  AS_HELP_STRING([--with-tools=DIR],[tool directory]),
  [AS_CASE([$withval],
    [yes], [AC_MSG_ERROR([--with-tools requires an argument])],
    [no], [:],
    [tools="${withval%/bin}"])])

AC_ARG_WITH([toolbin],
  AS_HELP_STRING([--with-toolbin=DIR],[tool bin directory]),
  [AS_CASE([$withval],
    [yes], [AC_MSG_ERROR([--with-toolbin requires an argument])],
    [no], [:],
    [toolbin="${withval%/bin}/bin"])])

if test -n "$tools" && test -n "$toolbin"; then
  AC_MSG_ERROR([--with-tools and --with-toolbin are mutually exclusive])
fi
if test -n "$tools"; then
  toolbin="$tools/bin"
fi
if test -n "$toolbin"; then
  if test -d "$toolbin"; then
    PATH="$toolbin:$PATH"
    tools="${toolbin%/bin}"
    AC_MSG_NOTICE([Using tools in $tools])
  else
    AC_MSG_ERROR([tool location does not exist])
  fi
fi])


I'm going to go ahead and close this bug report.  Please feel free to reopen if you can find a problem stemming from code in Autoconf itself.

Zack Weinberg <zackw>
Group administrator
Mon 02 Nov 2020 01:24:22 PM UTC, original submission:  

I have built and installed an uptodate g++ in a local directory, and pointed my PATH at that set of tools.  The system g++ is too old (and no, I can;t update it).

the autoconf 2.69c beta seems to ignore that and finds the g++ in /bin.

here's the PATH as printed in the config.log


PATH: /data/users/nathans/tools/bin/
PATH: /home/nathans/my/bin/
PATH: /data/users/nathans/tools/bin/
PATH: /usr/local/bin/
PATH: /bin/
PATH: /usr/bin/
PATH: /usr/local/sbin/
PATH: /usr/sbin/
PATH: /usr/facebook/ops/scripts/
PATH: /usr/facebook/scripts/
PATH: /usr/facebook/scripts/db/

Notice that has /data/users/nathans/tools/bin in there twice.  the second one is from the shell's PATH var:

devvm293:368>echo $PATH
/home/nathans/my/bin:/data/users/nathans/tools/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/facebook/ops/scripts:/usr/facebook/scripts:/usr/facebook/scripts/db

the first is because the configure script is explicitly putting it there (via a --with-tools= option)


here's what it says of g++

configure:2348: checking for g++
configure:2369: found /bin/g++
configure:2380: result: g++
configure:2407: checking for C++ compiler version
configure:2416: g++ --version >&5
g++ (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5)

Here's my actual g++

devvm293:362>whence -p g++
/data/users/nathans/tools/bin/g++

devvm293:371>g++ --version
g++ (GCC) 10.1.1 20200604


I've not dug further into this.  The project containing all this is gihub.com/urnathan/joust, I attach the configure.ac and config.m4, shout if you need more.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #50190:  configure.ac added by None (1KiB - application/vnd.nokia.n-gage.ac+xml - configure scripts)
file #50191:  config.m4 added by None (8KiB - application/x-m4 - configure scripts)
file #50192:  configure added by None (139KiB - application/octet-stream - configure scripts)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by zackw (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-11-15 zackw StatusNone Not Autoconf
        Open/ClosedOpen Closed
    2020-11-02 None Attached File- Added configure.ac, #50190
        Attached File- Added config.m4, #50191
        Attached File- Added configure, #50192

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code