bugGNU Octave - Bugs: bug #61642, Flags to enable C++11 are not...

 
 

bug #61642: Flags to enable C++11 are not correctly detected for all compilers

Submitter:  Markus Mützel <mmuetzel>
Submitted:  Wed 08 Dec 2021 03:30:58 PM UTC
   
 
Category:  Configuration and Build System Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Build Failure
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 09 Jan 2022 12:33:26 PM UTC, comment #13: 

I guess we can switch to a gnulib module (if/when it'll be available) also without keeping this bug open.

Closing as fixed.

Markus Mützel <mmuetzel>
Group administrator
Fri 24 Dec 2021 09:24:21 AM UTC, comment #12: 

This no longer blocks Octave 7. Updating release tag.

Markus Mützel <mmuetzel>
Group administrator
Thu 09 Dec 2021 05:51:25 PM UTC, comment #11: 

Thanks. Pushed here:
https://hg.savannah.gnu.org/hgweb/octave/rev/83dbee7c8f08

Do we want to leave this open for a future gnulib module?

Markus Mützel <mmuetzel>
Group administrator
Thu 09 Dec 2021 10:23:39 AM UTC, comment #10: 

OK, let's go ahead and apply a change like you suggest in comment #5.  Thanks for working on this issue.  Maybe later I can try to work with the gnulib developers to improve the modules for checking compiler features and the options to enable them.

John W. Eaton <jwe>
Group administrator
Wed 08 Dec 2021 05:16:16 PM UTC, comment #9: 

That macro can also be used to check for C++17 features.

Could we use the existing solution and switch back to a gnulib solution if it should be available some day?

Markus Mützel <mmuetzel>
Group administrator
Wed 08 Dec 2021 05:12:17 PM UTC, comment #8: 

I'd be more interested in detection of C++17 features since that is needed for the polymorphic allocator changes.  It seems reasonable to work with the gnulib maintainers to see if we can add that.  They are generally responsive.

John W. Eaton <jwe>
Group administrator
Wed 08 Dec 2021 04:37:14 PM UTC, comment #7: 

Another use-case for the autotools macro would be to check if and how a compiler supports C++14. The would be a necessary prerequisite if we'd like to allow (optionally) C++14 language features.
There is no gnulib module that would do that currently afaics.

Markus Mützel <mmuetzel>
Group administrator
Wed 08 Dec 2021 04:16:09 PM UTC, comment #6: 

Oops. Comment #3 showed a warning.

Some of the actual errors:

../liboctave/util/action-container.h:69:11: error: exception specification of overriding function is more lax than base version
    class fcn_elem : public elem
          ^
../liboctave/util/action-container.h:62:15: note: overridden virtual function is here
      virtual ~elem (void) = default;
              ^
../liboctave/util/action-container.h:78:23: error: no member named 'bind' in namespace 'std'; did you mean 'find'?
        : m_fcn (std::bind (fcn, args...))
                 ~~~~~^~~~
                      find
/Applications/Xcode_12.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:916:1: note: 'find' declared here
find(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
^


Markus Mützel <mmuetzel>
Group administrator
Wed 08 Dec 2021 04:04:05 PM UTC, comment #5: 

I'm attaching a possible patch.
As of now untested.


(file #52453)

Markus Mützel <mmuetzel>
Group administrator
Wed 08 Dec 2021 04:00:45 PM UTC, comment #4: 

One reason to prefer fixing gnulib is that if the fix is made in gnulib, we get updates when we update gnulib.  The AX_* macros from the autoconf archive are contributed and we have to check for updates.

John W. Eaton <jwe>
Group administrator
Wed 08 Dec 2021 03:43:36 PM UTC, comment #3: 


> Could we fix the gnulib module instead?

We might be able to. But why would that be better than using the working GNU solution?

One of the compilation errors:
https://github.com/mmuetzel/octave/runs/4448436664?check_suite_focus=true

../liboctave/util/action-container.h:58:28: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
      elem (const elem&) = delete;


Markus Mützel <mmuetzel>
Group administrator
Wed 08 Dec 2021 03:39:52 PM UTC, comment #2: 

Also, what C++11 features are failing without the -std=c++11 option?

John W. Eaton <jwe>
Group administrator
Wed 08 Dec 2021 03:35:39 PM UTC, comment #1: 

Could we fix the gnulib module instead?

John W. Eaton <jwe>
Group administrator
Wed 08 Dec 2021 03:30:58 PM UTC, original submission:  

We currently use the gnulib module "std-gnu11" to detect the compiler flags to enable C++11 features.
Apparently that doesn't work correctly with Apple clang. That module claims that no switches are needed for C++11. But the compilation fails later-on.

I worked around this on the GitHub runners by manually adding `-std=c++11` to the CXXFLAGS. That allowed to build Octave on that platform.
However, I forgot to set CXXCPP. That causes some configure tests to fail that would otherwise succeed (and maybe also the other way round?).
In the end, we were building incorrectly configured versions of Octave without noticing.

That shouldn't have happened. But imho that is an easy mistake to make. It would be better if the configure script would automatically detect the correct flags to activate C++11 features for more compilers.

There is the autoconf macro AX_CXX_COMPILE_STDCXX that we could use instead:
https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html

In first tests on the GitHub runners, it looks like it detects the correct flags also for Apple clang.

I'll add a patch here when I come around to preparing a changeset.

Would it still be ok to change that for Octave 7?

Markus Mützel <mmuetzel>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #52453:  bug61642-std-cxx11.patch added by mmuetzel (23KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by mmuetzel (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 group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-01-09 mmuetzel StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2021-12-24 mmuetzel Release7.0.90 dev
    2021-12-09 mmuetzel StatusNone Ready For Test
    2021-12-08 mmuetzel Attached File- Added bug61642-std-cxx11.patch, #52453

    Back to the top

    Powered by Savane 3.13-aa77.
    Corresponding source code