Menu

#1512 Forced std=c++11 and failed to build against system astyle-3.6.1 since r13577

Undefined
fixed
nobody
None
Undefined
2025-04-01
2025-01-25
No

The changes introduced in r13577 results in fail to build astyle plugin with system astyle-3.6.1 because of forced CXX flag -std-c++11 with the numerous errors like:

...
checking whether x86_64-pc-linux-gnu-g++ supports C++11 features with -std=c++11... yes
...
*************************************************
* Code::Blocks source tree has been configured. *
*************************************************

You can now build Code::Blocks by issuing 'make'.
When the build is complete, become root and install
it by issuing 'make install'.

   CFLAGS:     -march=native -O2 -pipe -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -fno-strict-aliasing -fPIC -std=c90
   CXXFLAGS:   -march=native -O2 -pipe -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -fno-strict-aliasing -fPIC -fexceptions
   CPPFLAGS:   -DCB_AUTOCONF  -DNDEBUG -DPIC -DTIXML_USE_STL=YES
   LDFLAGS:    -Wl,--no-undefined -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,--defsym=__gentoo_check_ldflags__=0
   CXX:        x86_64-pc-linux-gnu-g++ -std=c++11
   CC:         x86_64-pc-linux-gnu-gcc
...
make[4]: Entering directory '/var/tmp/portage/dev-util/codeblocks-9999/work/codeblocks-9999/src/plugins/astyle/resources'
PWD=`pwd` cd . && zip /var/tmp/portage/dev-util/codeblocks-9999/work/codeblocks-9999/src/plugins/astyle/resources/Astyle.zip manifest.xml *.xrc > /dev/null
make[4]: Leaving directory '/var/tmp/portage/dev-util/codeblocks-9999/work/codeblocks-9999/src/plugins/astyle/resources'
make[4]: Entering directory '/var/tmp/portage/dev-util/codeblocks-9999/work/codeblocks-9999/src/plugins/astyle'
/bin/sh ../../../libtool  --tag=CXX   --mode=compile x86_64-pc-linux-gnu-g++ -std=c++11 -DHAVE_CONFIG_H -I. -I../../../src/include  -I/usr/lib64/wx/include/gtk3-unicode-3.2-gtk3 -I/usr/include/wx-3.2-gtk3 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -I../../../src/include -I../../../src/sdk/wxscintilla/include  -DCB_AUTOCONF  -DNDEBUG -DPIC -DTIXML_USE_STL=YES  -march=native -O2 -pipe -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -fno-strict-aliasing -fPIC -fexceptions -c -o asstreamiterator.lo asstreamiterator.cpp
/bin/sh ../../../libtool  --tag=CXX   --mode=compile x86_64-pc-linux-gnu-g++ -std=c++11 -DHAVE_CONFIG_H -I. -I../../../src/include  -I/usr/lib64/wx/include/gtk3-unicode-3.2-gtk3 -I/usr/include/wx-3.2-gtk3 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -I../../../src/include -I../../../src/sdk/wxscintilla/include  -DCB_AUTOCONF  -DNDEBUG -DPIC -DTIXML_USE_STL=YES  -march=native -O2 -pipe -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -fno-strict-aliasing -fPIC -fexceptions -c -o astyleconfigdlg.lo astyleconfigdlg.cpp
/bin/sh ../../../libtool  --tag=CXX   --mode=compile x86_64-pc-linux-gnu-g++ -std=c++11 -DHAVE_CONFIG_H -I. -I../../../src/include  -I/usr/lib64/wx/include/gtk3-unicode-3.2-gtk3 -I/usr/include/wx-3.2-gtk3 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -I../../../src/include -I../../../src/sdk/wxscintilla/include  -DCB_AUTOCONF  -DNDEBUG -DPIC -DTIXML_USE_STL=YES  -march=native -O2 -pipe -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -fno-strict-aliasing -fPIC -fexceptions -c -o astyleplugin.lo astyleplugin.cpp
/bin/sh ../../../libtool  --tag=CXX   --mode=compile x86_64-pc-linux-gnu-g++ -std=c++11 -DHAVE_CONFIG_H -I. -I../../../src/include  -I/usr/lib64/wx/include/gtk3-unicode-3.2-gtk3 -I/usr/include/wx-3.2-gtk3 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -I../../../src/include -I../../../src/sdk/wxscintilla/include  -DCB_AUTOCONF  -DNDEBUG -DPIC -DTIXML_USE_STL=YES  -march=native -O2 -pipe -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -fno-strict-aliasing -fPIC -fexceptions -c -o dlgformattersettings.lo dlgformattersettings.cpp
libtool: compile:  x86_64-pc-linux-gnu-g++ -std=c++11 -DHAVE_CONFIG_H -I. -I../../../src/include -I/usr/lib64/wx/include/gtk3-unicode-3.2-gtk3 -I/usr/include/wx-3.2-gtk3 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -I../../../src/include -I../../../src/sdk/wxscintilla/include -DCB_AUTOCONF -DNDEBUG -DPIC -DTIXML_USE_STL=YES -march=native -O2 -pipe -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -fno-strict-aliasing -fPIC -fexceptions -c asstreamiterator.cpp  -fPIC -DPIC -o .libs/asstreamiterator.o
libtool: compile:  x86_64-pc-linux-gnu-g++ -std=c++11 -DHAVE_CONFIG_H -I. -I../../../src/include -I/usr/lib64/wx/include/gtk3-unicode-3.2-gtk3 -I/usr/include/wx-3.2-gtk3 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -I../../../src/include -I../../../src/sdk/wxscintilla/include -DCB_AUTOCONF -DNDEBUG -DPIC -DTIXML_USE_STL=YES -march=native -O2 -pipe -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -fno-strict-aliasing -fPIC -fexceptions -c astyleplugin.cpp  -fPIC -DPIC -o .libs/astyleplugin.o
libtool: compile:  x86_64-pc-linux-gnu-g++ -std=c++11 -DHAVE_CONFIG_H -I. -I../../../src/include -I/usr/lib64/wx/include/gtk3-unicode-3.2-gtk3 -I/usr/include/wx-3.2-gtk3 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -I../../../src/include -I../../../src/sdk/wxscintilla/include -DCB_AUTOCONF -DNDEBUG -DPIC -DTIXML_USE_STL=YES -march=native -O2 -pipe -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -fno-strict-aliasing -fPIC -fexceptions -c astyleconfigdlg.cpp  -fPIC -DPIC -o .libs/astyleconfigdlg.o
libtool: compile:  x86_64-pc-linux-gnu-g++ -std=c++11 -DHAVE_CONFIG_H -I. -I../../../src/include -I/usr/lib64/wx/include/gtk3-unicode-3.2-gtk3 -I/usr/include/wx-3.2-gtk3 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -I../../../src/include -I../../../src/sdk/wxscintilla/include -DCB_AUTOCONF -DNDEBUG -DPIC -DTIXML_USE_STL=YES -march=native -O2 -pipe -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -fno-strict-aliasing -fPIC -fexceptions -c dlgformattersettings.cpp  -fPIC -DPIC -o .libs/dlgformattersettings.o
In file included from dlgformattersettings.h:13,
                 from dlgformattersettings.cpp:10:
/usr/include/astyle.h:297:44: error: 'std::string_view' has not been declared
  297 |         const std::string* findHeader(std::string_view line, int i,
      |                                            ^~~~~~~~~~~
/usr/include/astyle.h:299:31: error: 'std::string_view' has not been declared
  299 |         bool findKeyword(std::string_view  line, int i, std::string_view  keyword) const;
      |                               ^~~~~~~~~~~
/usr/include/astyle.h:299:62: error: 'std::string_view' has not been declared
  299 |         bool findKeyword(std::string_view  line, int i, std::string_view  keyword) const;
      |                                                              ^~~~~~~~~~~
/usr/include/astyle.h:300:46: error: 'std::string_view' has not been declared
  300 |         const std::string* findOperator(std::string_view  line, int i,
      |                                              ^~~~~~~~~~~
/usr/include/astyle.h:302:14: error: 'string_view' in namespace 'std' does not name a type
  302 |         std::string_view getCurrentWord(std::string_view, size_t index) const;
      |              ^~~~~~~~~~~
/usr/include/astyle.h:302:9: note: 'std::string_view' is only available from C++17 onwards
  302 |         std::string_view getCurrentWord(std::string_view, size_t index) const;
      |         ^~~
    ....

While for r13576 additional CXX flag-std=c++11 is not forced:

...
checking whether x86_64-pc-linux-gnu-g++ supports C++11 features by default... yes
...
*************************************************
* Code::Blocks source tree has been configured. *
*************************************************

You can now build Code::Blocks by issuing 'make'.
When the build is complete, become root and install
it by issuing 'make install'.

   CFLAGS:     -march=native -O2 -pipe -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -fno-strict-aliasing -fPIC -std=c90
   CXXFLAGS:   -march=native -O2 -pipe -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -fno-strict-aliasing -fPIC -fexceptions
   CPPFLAGS:   -DCB_AUTOCONF  -DNDEBUG -DPIC -DTIXML_USE_STL=YES
   LDFLAGS:    -Wl,--no-undefined -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,--defsym=__gentoo_check_ldflags__=0
   CXX:        x86_64-pc-linux-gnu-g++
   CC:         x86_64-pc-linux-gnu-gcc

and r13576 is successfully built.

Currently I pass 17 instead of 11 into AX_CXX_COMPILE_STDCXX macros of configure.ac to fix build process or by forcing additionally -std=c++17.

Discussion

  • Miguel Gimenez

    Miguel Gimenez - 2025-01-29

    C::B requires currently C++11, so if compilation of C++17 code worked it is a glitch.

    Can AStyle's am file be tweaked to require C++17? I know very little about autotools.

     
    • band-a-prend

      band-a-prend - 2025-02-01

      The problem isn't with codeblocks soursecode itself. It's related to system used astyle-3.6.1: the appropriate plugin includes system astyle headers and astyle-3.6.1 uses C++17 features (i.e. string_view). But changes of r13577 results in addition of -std=c++11 to CXX env variable: CXX: x86_64-pc-linux-gnu-g++ -std=c++11 instead of CXX: x86_64-pc-linux-gnu-g++). Is it expected behaviour?

       
  • Miguel Gimenez

    Miguel Gimenez - 2025-02-03

    Changing this

    AM_CPPFLAGS = $(WX_CXXFLAGS) \
               -I$(top_srcdir)/src/include \
               -I$(top_srcdir)/src/sdk/wxscintilla/include
    

    to this (in the Makefile.am)

    AM_CPPFLAGS = $(WX_CXXFLAGS) \
              -std=c++17 \
               -I$(top_srcdir)/src/include \
               -I$(top_srcdir)/src/sdk/wxscintilla/include
    

    is enough?

     
  • hamam hussein hasin alli

    ello, what does this warning mean when completing the installation? One or more plugins were not loaded.

    This usually happens when a plugin is built for a different version of the Code::Blocks SDK.

    Check the application log for more info.

    List of failed plugins:

    libSpell Checker.dylib

     
    • Miguel Gimenez

      Miguel Gimenez - 2025-04-01

      I do not see how this ticket relates to your question, and this is not the place for it. Go to the forum and post your question there, attaching the application log.

       
  • Miguel Gimenez

    Miguel Gimenez - 2025-04-01
    • status: open --> fixed
     
  • Miguel Gimenez

    Miguel Gimenez - 2025-04-01

    Fixed in [r13639].

     

    Related

    Commit: [r13639]


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.