Author Topic: Compile Errors when building Code::Blocks source  (Read 8850 times)

Offline GameCodingNinja

  • Single posting newcomer
  • *
  • Posts: 4
Compile Errors when building Code::Blocks source
« on: February 10, 2017, 03:56:54 pm »
I'm one of those crazy people who compile their own Linux via "Linux From Scratch" so the only way I'm going to be able to try your IDE is if I compile the source code. Since I've recently built my current Linux I'm running on, I'm using the newest compiler available (gcc 6.2.0). That may or may not be contributing to the problem. I'm also using the newest wxWidgets (3.1.0).

Attached is the results of the configure.

The compile didn't get to far before it error-ed out.
Code
In file included from /usr/include/c++/6.2.0/type_traits:35:0,
                 from /usr/include/wx-3.1/wx/strvararg.h:22,
                 from /usr/include/wx-3.1/wx/string.h:37,
                 from /usr/include/wx-3.1/wx/memory.h:15,
                 from /usr/include/wx-3.1/wx/object.h:19,
                 from /usr/include/wx-3.1/wx/wx.h:15,
                 from /usr/include/wx-3.1/wx/wxprec.h:42,
                 from ./sdk_common.h:37,
                 from ./sdk_precomp.h:13:
/usr/include/c++/6.2.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
  ^~~~~
In file included from /usr/include/wx-3.1/wx/string.h:37:0,
                 from /usr/include/wx-3.1/wx/memory.h:15,
                 from /usr/include/wx-3.1/wx/object.h:19,
                 from /usr/include/wx-3.1/wx/wx.h:15,
                 from /usr/include/wx-3.1/wx/wxprec.h:42,
                 from ./sdk_common.h:37,
                 from ./sdk_precomp.h:13:
/usr/include/wx-3.1/wx/strvararg.h:345:18: error: ‘is_enum’ in namespace ‘std’ does not name a template type
     typedef std::is_enum<T> is_enum;
                  ^~~~~~~
/usr/include/wx-3.1/wx/strvararg.h:349:54: error: ‘is_enum’ was not declared in this scope
     enum { value = wxFormatStringSpecifierNonPodType<is_enum::value>::value };
                                                      ^~~~~~~
/usr/include/wx-3.1/wx/strvararg.h:349:68: error: template argument 1 is invalid
     enum { value = wxFormatStringSpecifierNonPodType<is_enum::value>::value };
                                                                    ^
make[2]: *** [Makefile:986: sdk_precomp.h.gch] Error 1
make[2]: Leaving directory '/root/Downloads/codeblocks-16.01.release/src/include'
make[1]: *** [Makefile:522: all-recursive] Error 1
make[1]: Leaving directory '/root/Downloads/codeblocks-16.01.release/src'
make: *** [Makefile:564: all-recursive] Error 1

Any help or patches would be appreciated.  ;D

Offline sodev

  • Regular
  • ***
  • Posts: 497
Re: Compile Errors when building Code::Blocks source
« Reply #1 on: February 10, 2017, 05:14:51 pm »

Code
/usr/include/c++/6.2.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

For some reason C++11 is not enabled, might be a problem with configure or something else. You could try the latest CodeBlocks version from svn, but i doubt you will have much luck with your configuration. At least on Windows CodeBlocks is still not usable with wxWidgets > 2.8.12, and with MinGW-w64 6.2.0 i can't compile wxWidgets 2.8.12 anymore, at least not in a way that it doesn't crash :).

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Compile Errors when building Code::Blocks source
« Reply #2 on: February 10, 2017, 08:38:23 pm »
GameCodingNinja: use the latest trunk sources or switch to wx3.0. wx3.1 is the development version. Or recompile your wx3.1 in a way that doesn't require enabled c++11 support.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: Compile Errors when building Code::Blocks source
« Reply #3 on: February 11, 2017, 12:23:52 pm »
You're not so crazy since I build codeblocks for myself too because I don't have root access on my professional development machine

You can do:
export CXXFLAGS="-std=c++11"
configure
make

which kinda forces C++11 support.

Yves
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline GameCodingNinja

  • Single posting newcomer
  • *
  • Posts: 4
Re: Compile Errors when building Code::Blocks source
« Reply #4 on: February 11, 2017, 04:09:57 pm »
Thanks for all your help!

export CXXFLAGS="-std=c++11" was the kicker. It compiled. I initially tried doing ./configure CXXFLAGS="-std=c++11" but that didn't work.

The IDE ran but crashed. I'm sure it's related to wxWidgets (3.1.0). I'm going to fall back to 2.8.12.

I'm now trying to figure out which plugins I want to build.

Offline GameCodingNinja

  • Single posting newcomer
  • *
  • Posts: 4
Re: Compile Errors when building Code::Blocks source
« Reply #5 on: February 11, 2017, 11:17:08 pm »
I was able to get wxWidgets 2.8.12 to compile by forcing it not to use C++11 or greater. Now Code::Blocks is throwing up an error as if a wxWidgets function call doesn't exist. This is all a moot point because the one app I do use requires wxWidgets 3.0 or greater. I'm unable to compile wxWidgets 3.0.2 due to an ambiguous overload call to abs. I'm able to compile wxWidgets 3.1.0 without a problem.

Any app I try to compile that uses wxWidgets is always a problem. Code::Blocks should move to Qt.

Using the tip of SVN I was able to compile it. It errors on start up but if I ignore it, the "Code Completion" and "Compiler" tool bars are blank. I can probably live without them. Hopefully Code::Blocks works with CMake.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Compile Errors when building Code::Blocks source
« Reply #6 on: February 12, 2017, 01:52:28 am »
Quote
Any app I try to compile that uses wxWidgets is always a problem. Code::Blocks should move to Qt.
Will never gonna happen... Do you know that 90% of the code is wx code?

Quote
Now Code::Blocks is throwing up an error as if a wxWidgets function call doesn't exist.
Without the exact error message we are not able to help you...

Quote
I'm unable to compile wxWidgets 3.0.2 due to an ambiguous overload call to abs
I don't understand this... What is/are "abs"? Do you mean the function abs() ?  Can you give the exact error message?

Quote
It errors on start up but if I ignore it
Again, what error message? The most things are fixable, and we are willing to help you, but we need the exact error messages...

Quote
the "Code Completion" and "Compiler" tool bars are blank
What does this mean? The symbols are missing? The plugin is not loading? Have you run the update script found in the src folder after compilation?

Quote
The IDE ran but crashed. I'm sure it's related to wxWidgets (3.1.0). I'm going to fall back to 2.8.12.
This is probably because of the symbol browser of code completion. This is a known bug. If you disable the symbol browser codeblocks should run fine also with wx3.1
To disable the symbol browser: Settings->Editor->Code completion(or code assistance?)->Symbol browser->disable symbol browser
If it still crash, can you give some backtraces? We all want to make codeblocks run with wx3.0 but without bug reports this is difficult...

Online Commaster

  • Almost regular
  • **
  • Posts: 171
Re: Compile Errors when building Code::Blocks source
« Reply #7 on: February 12, 2017, 02:07:54 am »
Any app I try to compile that uses wxWidgets is always a problem. Code::Blocks should move to Qt.
After carefully comparing the source code sizes, compilation times and the resulting library sizes of both wx and Qt I came to the conclusion: "No, thanks". Just because you are familiar with a Framework doesn't make it a better one. (Not to mention, that there is some effort in the wxQt branch...)

Offline GameCodingNinja

  • Single posting newcomer
  • *
  • Posts: 4
Re: Compile Errors when building Code::Blocks source
« Reply #8 on: February 12, 2017, 04:10:30 pm »
Quote
of both wx and Qt I came to the conclusion: "No, thanks".
Quote
Do you know that 90% of the code is wx code?
My apologies. My suggestion is purely out of frustration with trying to compile wxWidgets which is always a problem. I write games and game engines and don't use any GUI libraries so I have no biases.

Quote
Without the exact error message we are not able to help you...
Here is the Code::Blocks error message after I compile wxWidgets 2.8.12. I compile wxWidgets 2.8.12 with export CFLAGS=-std=c99 CXXFLAGS=-std=c++98. Without this, wxWidgets 2.8.12 throws up a bunch of repeating errors. (./src/gtk/bdiag.xbm:6:50: error: narrowing conversion of ‘128’ from ‘int’ to ‘char’ inside { } [-Wnarrowing])
Code
menuitemsmanager.Tpo -c menuitemsmanager.cpp  -fPIC -DPIC -o .libs/menuitemsmanager.o
macrosmanager.cpp: In member function ‘void MacrosManager::Reset()’:
macrosmanager.cpp:93:33: error: ‘wxRE_ADVANCED’ was not declared in this scope
                                 wxRE_ADVANCED);
                                 ^~~~~~~~~~~~~
As I stated in my last post, I need wxWidgets 3.0 or greater for this other app I use. SVN tip of Code::Blocks with wxWidgets 3.1.0 compiles without a problem.

Quote
What is/are "abs"? Do you mean the function abs()
Yes. Apparently they were using abs() for floats instead of using fabs(). Here's the error message when trying to compile wxWidgets 3.0.2.
Code
./src/stc/scintilla/src/Editor.cxx: In function ‘bool Close(Point, Point)’:
./src/stc/scintilla/src/Editor.cxx:5844:23: error: call of overloaded ‘abs(XYPOSITION)’ is ambiguous
  if (abs(pt1.x - pt2.x) > 3

Quote
Again, what error message? The most things are fixable, and we are willing to help you, but we need the exact error messages...
Here is the error seen when starting up Code::Blocks for the first time after being compiled with wxWidgets 3.1.0.



This shows the tool bars that are blank which happen to be the "Code Completion" and "Compiler" tool bars.



Quote
If you disable the symbol browser codeblocks should run fine also with wx3.1
How do you do this? Where is the symbol browser?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Compile Errors when building Code::Blocks source
« Reply #9 on: February 12, 2017, 05:20:51 pm »
After compilation you have to run the "update30" script in the src subfolder. This script will copy all needed resources (like images) to the right place. I think this is the reason for the missing symbols?  I can't find a error in your screenshot... They are all disabled, because no project is loaded?

Quote
Here is the error seen when starting up Code::Blocks for the first time after being compiled with wxWidgets 3.1.0.
probably the same as: https://sourceforge.net/p/codeblocks/tickets/387/
@obfuscated:Does this come from the symol browser?

You can disable the symbol browser by Settings->Editor->Code Completion->Symbol browser->Disable symbol browser (this is only from memory, the actual names can alter, but this should give you a hint where to look)

Quote
Code
menuitemsmanager.Tpo -c menuitemsmanager.cpp  -fPIC -DPIC -o .libs/menuitemsmanager.o
macrosmanager.cpp: In member function ‘void MacrosManager::Reset()’:
macrosmanager.cpp:93:33: error: ‘wxRE_ADVANCED’ was not declared in this scope
                                 wxRE_ADVANCED);
                                 ^~~~~~~~~~~~~


Code
./src/stc/scintilla/src/Editor.cxx: In function ‘bool Close(Point, Point)’:
./src/stc/scintilla/src/Editor.cxx:5844:23: error: call of overloaded ‘abs(XYPOSITION)’ is ambiguous
  if (abs(pt1.x - pt2.x) > 3
both errors come from codeblocks? So wxWidgets compiles fine? Funny, i never saw any errors like this on compiling codeblocks...
what is the command line you compiled wxWidgets with?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Compile Errors when building Code::Blocks source
« Reply #10 on: February 12, 2017, 05:42:13 pm »
After compilation you have to run the "update30" script in the src subfolder. This script will copy all needed resources (like images) to the right place. I think this is the reason for the missing symbols?  I can't find a error in your screenshot... They are all disabled, because no project is loaded?

Quote
Here is the error seen when starting up Code::Blocks for the first time after being compiled with wxWidgets 3.1.0.
probably the same as: https://sourceforge.net/p/codeblocks/tickets/387/
@obfuscated:Does this come from the symol browser?

You can disable the symbol browser by Settings->Editor->Code Completion->Symbol browser->Disable symbol browser (this is only from memory, the actual names can alter, but this should give you a hint where to look)

Quote
Code
menuitemsmanager.Tpo -c menuitemsmanager.cpp  -fPIC -DPIC -o .libs/menuitemsmanager.o
macrosmanager.cpp: In member function ‘void MacrosManager::Reset()’:
macrosmanager.cpp:93:33: error: ‘wxRE_ADVANCED’ was not declared in this scope
                                 wxRE_ADVANCED);
                                 ^~~~~~~~~~~~~


Code
./src/stc/scintilla/src/Editor.cxx: In function ‘bool Close(Point, Point)’:
./src/stc/scintilla/src/Editor.cxx:5844:23: error: call of overloaded ‘abs(XYPOSITION)’ is ambiguous
  if (abs(pt1.x - pt2.x) > 3
both errors come from codeblocks? So wxWidgets compiles fine? Funny, i never saw any errors like this on compiling codeblocks...
what is the command line you compiled wxWidgets with?


The wxRE_ADVANCED is because he failed to build wxWidgets using the builtin regex.
Add wxWidgets configure option
Code
--with-regex=builtin

Note: The CB dev team should fix this so the option is NOT needed; because in the past, Mac users tended to NOT use wxWidgets with builtin regex.

The abs is fixed by a small patch. IIRC, a newer compiler causes the error.

Patch for abs issue under GCC 6.
Code
diff -uNr wxWidgets-3.0.2.orig/src/stc/scintilla/src/Editor.cxx wxWidgets-3.0.2.mod/src/stc/scintilla/src/Editor.cxx
--- wxWidgets-3.0.2.orig/src/stc/scintilla/src/Editor.cxx 2016-07-22 11:35:57.000000000 +0500
+++ wxWidgets-3.0.2.mod/src/stc/scintilla/src/Editor.cxx 2016-07-22 11:30:51.000000000 +0500
@@ -11,6 +11,7 @@
 #include <ctype.h>
 #include <assert.h>
 
+#include <cmath>
 #include <string>
 #include <vector>
 #include <map>
@@ -5841,9 +5842,9 @@
 }
 
 static bool Close(Point pt1, Point pt2) {
- if (abs(pt1.x - pt2.x) > 3)
+ if (std::abs(pt1.x - pt2.x) > 3)
  return false;
- if (abs(pt1.y - pt2.y) > 3)
+ if (std::abs(pt1.y - pt2.y) > 3)
  return false;
  return true;
 }

Tim S.

« Last Edit: February 12, 2017, 05:48:16 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 225
Re: Compile Errors when building Code::Blocks source
« Reply #11 on: February 12, 2017, 06:44:13 pm »
As I stated in my last post, I need wxWidgets 3.0 or greater for this other app I use. SVN tip of Code::Blocks with wxWidgets 3.1.0 compiles without a problem.

FYI if you use the --prefix=/some/path/to/codeblocks    for configure of both wxwidgets and codeblocks, you can easily use codeblocks with wx28 and other apps with another version of wx.
That is what I currently do for testing code with both wx28 and wx30 : i simply use 2 separate directories for both codeblockses.

Yves
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib