mainAutoconf - Support: sr #109676, only one "checking whether...

 
 

sr #109676: only one "checking whether the AC_LANG compiler works"

Submitter:  None
Submitted:  Sat 04 May 2019 07:44:13 PM UTC
   
 
Priority:  * 3 - Release N+1 Severity:  3 - Normal
Status:  Confirmed Privacy:  Public
Assigned to:  None Originator Email:  -email is unavailable-
Open/Closed:  Open Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 10 Jul 2020 06:28:38 PM UTC, comment #1: 

Confirmed.  Thank you for the clear bug report.

This is a long-standing issue and we're trying to put the 2.70 release together right now, so I'm marking this to be addressed "later", after the release.  However, if it can be addressed easily, I might try to squeeze it into 2.70.

Zack Weinberg <zackw>
Group administrator
Sat 04 May 2019 07:44:13 PM UTC, original submission:  

Consider this simple configure.ac file.
AC_INIT
AC_PROG_CC
AC_PROG_CXX

AC_LANG(C)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
int i = 0;
])],
    [AC_MSG_RESULT([yes])],
    [AC_MSG_ERROR([int not supported])])
AC_LANG(C++)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
int i = 0;
])],
    [AC_MSG_RESULT([yes])],
    [AC_MSG_ERROR([int not supported])])

If I run autoconf 2.69 to create a configure script, and then run it with a broken C compiler, I get a useful error.
rohan:2097$ CC=/bin/broken ./configure
checking for gcc... /bin/broken
checking whether the C compiler works... no
configure: error: in `/home/jimw/tmp':
configure: error: C compiler cannot create executables
See `config.log' for more details
rohan:2098$

If I run it with a broken C++ compiler, I get a confusing error.
rohan:2098$ CXX=/bin/broken ./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether we are using the GNU C++ compiler... no
checking whether /bin/broken accepts -g... no
yes
configure: error: int not supported
rohan:2099$

The problem here is that the check to verity whether a compiler works is buried in _AC_COMPILER_EXEEXT_DEFAULT in lang.m4 which is used in c.m4 via
m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
so only the very first AC_PROG_C* call gets checked.  Most linux distros will let you install a C compiler without installing a C++ compiler.  This has resulted in some user confusion with the GCC configure script.  See for instance
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63509
and
https://github.com/riscv/riscv-gnu-toolchain/issues/431

We could work around the problem in GCC by calling AC_PROG_CXX before AC_PROG_CC, but it would be nice if autoconf created a configure script that verified that both compilers work instead of just the first one.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-12-08 zackw Priority1 - Blocked 3 - Release N+1
    2020-07-10 zackw Priority5 - Unprioritized 1 - Blocked
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code