mainAutoconf - Support: sr #110532, AC_CHECK_LIB no longer works with...

 
 

sr #110532: AC_CHECK_LIB no longer works with a C++ compiler

Submitter:  Vincent Lefèvre <vinc17>
Submitted:  Wed 25 Aug 2021 11:47:51 PM UTC
   
 
Priority:  * 5 - Unprioritized Severity:  3 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 31 Aug 2021 11:52:41 PM UTC, comment #3: 

Thanks for explaining, Vincent. I installed the patch with some commentary, and am closing the bug report.

Zack, if I jumped the gun on this please let me know and I'll revert.

Paul Eggert <eggert>
Group administrator
Fri 27 Aug 2021 12:34:59 AM UTC, comment #2: 

MPFR is written in C, and it is generally compiled with a C compiler, so that we expect the compiler to be given by $CC. This means that we need AC_LANG(C), not AC_LANG(C++).

But we also allow C++ compilers (some compilers seem to support only C++, and testing with a C++ compiler also allows us to detect some issues with the header files). And since the compiler is given by $CC, g++ (for instance) is used via CC=g++.

Vincent Lefèvre <vinc17>
Thu 26 Aug 2021 08:14:53 PM UTC, comment #1: 

This (and the matching set of changes to AC_LANG_CALL(C++)) is in fact the main thing I was thinking of when I wrote in the 2.70 release notes that "setting CC to a C++ compiler is no longer supported."

That said, I'm not rejecting your patch out of hand, but I would like more detail on exactly what you did that caused code generated by AC_LANG_CALL(C) to get processed by a C++ compiler.  If, for instance, there is some obstacle you're encountering that prevents you from using AC_LANG(C++) in all the right places, perhaps we should fix that instead.

Zack Weinberg <zackw>
Group administrator
Wed 25 Aug 2021 11:47:51 PM UTC, original submission:  

With Autoconf 2.71 (and the current git version), when I want to build MPFR with g++, I get an error in the AC_CHECK_LIB test (undefined reference) because the 3 lines

#ifdef __cplusplus
extern "C"
#endif

are now missing at the beginning of the generated test program. The cause is commit 326c9a547423d25c621bc5c0ef76edbf6eda8c92, which removed these 3 lines (among other things). This commit says: "(AC_LANG_CALL(C)): Remove #ifdef __cplusplus, this macro is no longer used to generate C++ code." But this is actually C code compiled with a C++ compiler, not C++ code.

I've submitted a patch that re-adds these 3 lines:

https://lists.gnu.org/archive/html/autoconf-patches/2021-08/msg00005.html

This makes the error disappear for me.

Vincent Lefèvre <vinc17>

 

(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 eggert (Posted a comment)
  • -email is unavailable- added by zackw (Posted a comment)
  • -email is unavailable- added by vinc17 (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-08-31 eggert StatusNone Done
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code