Author Topic: Building CodeBlocks source  (Read 41350 times)

Offline sorinev

  • Multiple posting newcomer
  • *
  • Posts: 61
Building CodeBlocks source
« on: July 20, 2013, 09:59:34 pm »
In an effort to learn more interesting things, have something noteworthy on my resume instead of just an AA, and to give back to a project I enjoy, appreciate, and have used for about 4 years; I'm trying to follow the directions to build CB from the source so I can start trying to help in some way. I'm not off to a promising start however. This seems like something that should be simple for me (especially if I'm aiming to contribute...), but frustratingly, it's not.

I've followed the directions in the wiki, double and triple checked everything, but still failing to build.

First it failed to build wxwidgets with a memory exhausted error (I have 8GB). I tried the flags thing mentioned in the wiki, but it still failed. I switched to monolithic=0, and that worked (though obviously I need to solve that properly).

Second, CB itself won't build. I made sure the wx variable was set with the base portion for the unpacked wxwidgets path, but the compile instantly fails on the first file with (invalid) and tinyxml/tinystr.cpp. I googled but that didnt really return anything relevant.

What am I missing? I'm not exactly inspiring confidence in myself, given my goal here. Your assistance is greatly appreciated. Windows 7 Pro 64-bit.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Building CodeBlocks source
« Reply #1 on: July 20, 2013, 10:06:39 pm »
Where did you get the source from?
What is the exact error?
(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 sorinev

  • Multiple posting newcomer
  • *
  • Posts: 61
Re: Building CodeBlocks source
« Reply #2 on: July 20, 2013, 10:12:42 pm »
Sorry I'm not at home right now, I'll post the exact error when I get home.

I originally got the source from the berilos svn linked in the wiki article, but then noticed somewhere else that it was moved to a svn at sourceforge, so I got it from there.

Offline golgepapaz

  • Multiple posting newcomer
  • *
  • Posts: 44
Re: Building CodeBlocks source
« Reply #3 on: July 20, 2013, 11:50:22 pm »
for the memory exhausted problem you can pass the compiler -fno-keep-inline-dllexport
on the command line when building wxWidgets. I think you need the build wxWidgets as
monolithic since project for mingw CB link to that one.
Something like this;
mingw32-make -f makefile.gcc BUILD=release UNICODE=1 SHARED=1 MONOLITHIC=1 CXXFLAGS="-fno-keep-inline-dllexport"
This builds wxwidgets fine on my 4gb rig.

(invalid) usually means that some global variable expanded to an invalid value.You know you need to set
cb global variable also, right? if you haven't, set it to (assuming you checked out the CB to c:\codeblocks_svn)

base  = c:\codeblocks_svn\src\
lib = c:\codeblocks_svn\src\devel

After this you should be able to compile CB with no problems.
P.S : for cb_release_type you can use -g for debug builds or any optimization flags for release builds (usually-O2)


Offline sorinev

  • Multiple posting newcomer
  • *
  • Posts: 61
Re: Building CodeBlocks source
« Reply #4 on: July 21, 2013, 01:49:34 am »
for the memory exhausted problem you can pass the compiler -fno-keep-inline-dllexport
on the command line when building wxWidgets. I think you need the build wxWidgets as
monolithic since project for mingw CB link to that one.
Something like this;
mingw32-make -f makefile.gcc BUILD=release UNICODE=1 SHARED=1 MONOLITHIC=1 CXXFLAGS="-fno-keep-inline-dllexport"
This builds wxwidgets fine on my 4gb rig.

(invalid) usually means that some global variable expanded to an invalid value.You know you need to set
cb global variable also, right? if you haven't, set it to (assuming you checked out the CB to c:\codeblocks_svn)

base  = c:\codeblocks_svn\src\
lib = c:\codeblocks_svn\src\devel

After this you should be able to compile CB with no problems.
P.S : for cb_release_type you can use -g for debug builds or any optimization flags for release builds (usually-O2)



I followed the instructions word for word and picture for picture as outlined here. Since the repository location is out of date in that article (I found the new one referenced somewhere else; I think in a thread here), is it possible some other elements of the build process outlined there are out of date as well?

I did try adding these two lines:

Code
CFLAGS ?= -fno-keep-inline-dllexport

CXXFLAGS ?= -fno-keep-inline-dllexport

to the config.gcc file as the page outlined last night. I am retrying with the "-fno-keep-inline-dllexport" part added to the command line instead, like you posted here. I'll post back when it's done.

I'll have to wait for this to finish before getting to that error for the actual CodeBlocks build attempt.

I also already did the global variable part as outlined on the page. If wx build successfully this time around, I'll recheck everything, including the global variable.

Offline sorinev

  • Multiple posting newcomer
  • *
  • Posts: 61
Re: Building CodeBlocks source
« Reply #5 on: July 21, 2013, 02:00:44 am »
wxWidgets seems to have built successfully this time.

Building codeblocks failed again. The error is the same as before. The page says just open codeblocks.cbp and hit compile, so I did that. The error is:

Code

-------------- Build: tinyXML in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall (invalid) -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE   -Wall -fno-strict-aliasing -Wno-write-strings   -iquote.objs\include -I.objs\include -I. -IC:\Users\Sorinev\Desktop\wxMSW-2.8.12\include -IC:\Users\Sorinev\Desktop\wxMSW-2.8.12\lib\gcc_dll\mswu -Isdk\wxscintilla\include -Isdk\wxpropgrid\include -Iinclude\tinyxml -Iinclude\tinyxml  -c C:\CodeBlocksSVNSource\src\base\tinyxml\tinystr.cpp -o .objs\base\tinyxml\tinystr.o
mingw32-g++.exe: error: (invalid): No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings (0 minutes, 0 seconds)
 

Every build target fails instantly. This is the error when having "all" selected. Other build targets fail immediately with different specific, but generally similar errors.

Is there more to it than just hitting build, as the page says to do?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Building CodeBlocks source
« Reply #6 on: July 21, 2013, 02:04:29 am »
A important thing to keep in mind is using the same exact version of MinGW GCC to build both wxWidgets and CB.

I suggest posting the source (MinGW Std, TDM) and version number of the MinGW GCC you are using?

Also, re-post the exact wxWidgets build command you used? And post wxWidgets version?

And, remember if doing a second make of wxWidgets, that you MUST clean the prior build every time you change the build options.

Ans, remember when you change from Monolithic to non-Monolithic  you MUST clean out all the object and library files because the objects and library are NOT safe to be built in the same folder.

List Folders I delete before doing a major wxWidgets build option change (Should be done when changing Monolithic setting).
  • build/msw
  • lib/gcc_dll*
  • lib/gcc_lib*

Tim S.
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 stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Building CodeBlocks source
« Reply #7 on: July 21, 2013, 02:08:05 am »
You are missing or wrong setting for the cb_release_type.

Tim S.
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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Building CodeBlocks source
« Reply #8 on: July 21, 2013, 02:09:40 am »
You need at least a global variable cb, where the base points to the root-folder of the sources and global variable cb_release_type, where the base is e.g. -g for debug-build or -O2 (or whatever) for release-build.
By the way C::B should have asked for the content of both variables on first run and asked you for confirmation whether you want to save an invalid content.
If you don't want to put anything in cb_release_type you need at least to put a space here.

Offline sorinev

  • Multiple posting newcomer
  • *
  • Posts: 61
Re: Building CodeBlocks source
« Reply #9 on: July 21, 2013, 04:17:08 am »
Jesus, I've never seen such fast replies to my forum posts in all of the years I've been tooling around on the internet. Haha. Thanks for the very fast and very helpful replies.

My command line for the [successful] wxWidgets build this time was exactly as in golgepapaz's post:
Code
mingw32-make -f makefile.gcc BUILD=release UNICODE=1 SHARED=1 MONOLITHIC=1 CXXFLAGS="-fno-keep-inline-dllexport"

I seem to have mingw 4.6.2. It uses the same one for both the command line wxwidgets build and the codeblocks ide [attempted] build.

It seems like it's obviously more than just a

Code
Open the project file CodeBlocks.cbp. You will be prompted to define the global variable $(#wx). Enter the location where you unpacked wxWidgets. Hit the blue gear and lean back.

needing to go on here. So how about we just skip that wiki page altogether and just start me fresh here with an idiots guide, from steps 0 to n. Every detail, no matter how small and trivial. I have mingw installed, it's in C:\MinGW. Is my repository right? TortoiseSVN shows that I'm at 9214. And what's the most recent download for the wxWidgets material? Any other materials I need to download?

Again, I really appreciate the speedy and helpful replies. I'll update to the latest nightly in the meantime. Currently running 12.11.
« Last Edit: July 21, 2013, 04:27:18 am by sorinev »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Building CodeBlocks source
« Reply #10 on: July 21, 2013, 05:25:44 am »
I just looked over http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows#Compile_Code::Blocks

And, it is out of date.

I will try to give you the basic info needed. Feel free to update the Wiki page.

I will add notes to this post as I go over what I do to build CB.

Please read Wiki Pages linked below
http://wiki.codeblocks.org/index.php?title=Global_compiler_variables

You Need to correct the Global Variable called "cb_release_type"; something MUST be entered in the base field.
I use "-g" without the quotes.

Attached image; please download image and tell me you got it.
Your copy should say default where mine says test_cb_build.

I need to delete the image as soon as possible because this sites has very little space for images.

The warning shown below can be ignore the first time you build CB; it should not happen after the pre-compiled header is created during the SDK build.
Code
cc1plus.exe: warning: .objs\include: No such file or directory [enabled by default]

Tim S.
« Last Edit: July 21, 2013, 01:07:56 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 sorinev

  • Multiple posting newcomer
  • *
  • Posts: 61
Re: Building CodeBlocks source
« Reply #11 on: July 21, 2013, 07:56:15 am »
I downloaded the image, thanks.

Offline sorinev

  • Multiple posting newcomer
  • *
  • Posts: 61
Re: Building CodeBlocks source
« Reply #12 on: July 21, 2013, 09:27:25 am »
I've now gotten as far as actually being able to build something this time. I set the cb_release_type (first to -g, then to -O2). I made a cb variable and set it to c:\cb_svn. I'm assuming that's what's meant by root folder. Or should it be c:\cb_svn\src? (well technically it's CodeBlocksSVNSource and not cb_svn).

I did not get the above warning. My build messages are the following:

Code
||=== Build: tinyXML in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler) ===|
||=== Build: AutoRevision in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler) ===|
||=== Build: ConsoleRunner in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler) ===|
||=== Build: Squirrel in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler) ===|
||=== Build: Squirrel std lib in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler) ===|
||=== Build: SqPlus in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler) ===|
||=== Build: scintilla in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler) ===|
||=== Build: wxpropgrid in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler) ===|
||=== Build: sdk in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler) ===|
C:\CodeBlocksSVNSource\src\sdk\globals.cpp||In function 'void PlaceWindow(wxTopLevelWindow*, cbPlaceDialogMode, bool)':|
C:\CodeBlocksSVNSource\src\sdk\globals.cpp|1050|warning: 'r.tagRECT::bottom' may be used uninitialized in this function [-Wuninitialized]|
C:\CodeBlocksSVNSource\src\sdk\globals.cpp|1050|warning: 'r.tagRECT::right' may be used uninitialized in this function [-Wuninitialized]|
||Execution of 'zip -jq9 devel\share\CodeBlocks\manager_resources.zip sdk\resources\*.xrc' in 'C:\CodeBlocksSVNSource\src' failed.|

and my build log is this:

Code
...
tons and tons of stuff
...


Creating library file: devel\libcodeblocks.a
Output file is devel\codeblocks.dll with size 7.57 MB
Running target post-build steps
cmd /c if not exist devel\share\CodeBlocks mkdir devel\share\CodeBlocks
zip -jq9 devel\share\CodeBlocks\manager_resources.zip sdk\resources\*.xrc
Execution of 'zip -jq9 devel\share\CodeBlocks\manager_resources.zip sdk\resources\*.xrc' in 'C:\CodeBlocksSVNSource\src' failed.

The contents of src\output are:

share folder, with various subfolders and files
cb_console_runner.exe
codeblocks.dll
wxmsw28u_gcc_custom.dll
wxpropgrid.dll



And the contents of src\devel are:

share folder, with various subfolders and files
cb_console_runner.exe
cb_share_config.exe
codeblocks.dll
libcodeblocks.a
libwxpropgrid.a
libwxscintilla_cb.a
wxmsw28u_gcc_custom.dll
wxpropgrid.dll

Clearly, I'm missing a few things. I ran update.bat anyway, but it didn't do anything, since I think I need to set up the whole zip windows path variable thing (I need info on that).

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Building CodeBlocks source
« Reply #13 on: July 21, 2013, 10:04:38 am »
The error about the call to zip that failed means you did not follow the steps exactly.
You need a compatible zip in your systems-path, see http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows#zip.exe for a place to download it. The svn-client is not necessarily needed for building sources (if you not use svn-sources) and newer tortoise-svn has it included, so there is no longer the need to download it seperately.

Offline sorinev

  • Multiple posting newcomer
  • *
  • Posts: 61
Re: Building CodeBlocks source
« Reply #14 on: July 21, 2013, 11:33:08 am »
I downloaded the zip 2.3.3 linked on that page. I tried settings the environment variable in codeblocks to ZIPCMD with value of C:\zip-2.3.3 and also tried changing ZIPCMD to just zip instead. That didn't work.

I also added C:\zip-2.3.3 to the windows "Path" area under advanced system properties -> environment variables, still no go.

Finally I just edited update.bat to change

Code
set ZIPCMD=zip

to

Code
set ZIPCMD="C:\zip-2.3.3\bin\zip.exe"

and now I no longer get "zip" not recognized, etc. messages spammed in the console window if I run update.bat myself; it actually does a few things now. But if I try to build codeblocks again, it still gives me the zip error.

If I'm doing something wrong, I'm not kidding when I say I need an idiot's guide. "Right click this, select this, type this exact thing, press ok. Now do this next thing by opening this menu, then..." etc. I've never built such a complicated application before. Everything I've done to date has ranged from single source file compiles, to projects with at most a couple dozen source files, with no extra settings, dependencies, dlls, etc. This whole thing is very new to me, so remember that what you take for granted is currently rocket science to me and akin to playing darts blindfolded and facing the wrong direction. Or like trying to hit a bullet with a smaller bullet while riding a horse, blindfolded. :)