Author Topic: Errors building wxWidgets for Code::Blocks  (Read 9833 times)

Offline jeffg

  • Single posting newcomer
  • *
  • Posts: 7
Errors building wxWidgets for Code::Blocks
« on: March 02, 2011, 08:38:13 pm »
OS is Windows 7, CB version 10.05 (just installed, updated from 8.02), wxWidgets version 2.9.1.

After downloading and running wxMSW-2.9.1-Setup.exe, I tried to build wxWidgets for Code::Blocks using MinGW by following the instructions in the Wiki here. Although it's a wxWidgets Wiki, in the last line it says to ask in the CB forum if there are problems - so here I am, hopefully in the right place.  :)

After editing config.gcc as specified, after the 'clean' step, I built with the command line
Code
c:\wxWidgets-2.9.1\build\msw>mingw32-make.exe -f makefile.gcc > c:\users\jeff\temp\wx.log
to capture the output. I didn't capture the error output directly (I think there's a trick using numbers to redirect stderr as well which I need to look up), but copied this from the command window and pasted into another file (wx_error.txt), so I have everything.

After a quite a few what looked like minor warnings, I then started to get serious problems. There were a couple of dozen lines with the form
Code
c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe: <unknown-file>:0: syntax error
Warning: .drectve `-export:T.973 ' unrecognized

Then a whole host of undefined references in libwxscintilla.a similar to
Code
..\..\lib\gcc_dll\libwxscintilla.a(wxscintilla_Editor.o):Editor.cxx:(.text+0x7219): undefined reference to `_imp__wxTheAssertHandler'

And finally
Code
collect2: ld returned 1 exit status
mingw32-make.exe: *** [..\..\lib\gcc_dll\wxmsw291_gcc_custom.dll] Error 1

In the gcc_dll folder I ended up with 8 libraries (.a) and no dll. Please can you help! If you need any more, I have all the output from the build.

Offline daniloz

  • Regular
  • ***
  • Posts: 268
Re: Errors building wxWidgets for Code::Blocks
« Reply #1 on: March 02, 2011, 09:42:07 pm »
I'm having the same problem with Vista 32 bit and MinGW32.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Errors building wxWidgets for Code::Blocks
« Reply #2 on: March 02, 2011, 10:00:15 pm »
@jeffg: Those directions are for wxWidgets 2.8; they are not correct for wxWidgets 2.9!
Old wxWidgets 2.9.0 directions http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.9.0_to_develop_Code::Blocks_%28MSW%29

The exact version of MinGW GCC used by both users?
32 or 64 bit version of build and machine/computer?

The errors look like compiler errors to me.

Tim S.
« Last Edit: March 02, 2011, 10:12:26 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 daniloz

  • Regular
  • ***
  • Posts: 268
Re: Errors building wxWidgets for Code::Blocks
« Reply #3 on: March 03, 2011, 09:32:33 am »
@jeffg: Those directions are for wxWidgets 2.8; they are not correct for wxWidgets 2.9!
Old wxWidgets 2.9.0 directions http://wiki.codeblocks.org/index.php?title=Compiling_wxWidgets_2.9.0_to_develop_Code::Blocks_%28MSW%29
I can confirm that I can compile v2.9.1 using the instruction from the link above on Vista 32bit (See below), trying right now to do it using MinGW64...

The result using MINGW64 is an error in dlmsw.cpp:
Code
../../src/msw/dlmsw.cpp: In static member function 'static wxDynamicLibraryDetailsArray wxDynamicLibrary::ListLoaded()':
../../src/msw/dlmsw.cpp:288:29: error: invalid conversion from 'BOOL (*)(CHAR*, wxDynamicLibraryDetailsCreator::DWORD_32_64, ULONG, void*)' to 'WINBOOL (*)(const CHAR*, DWORD64, ULONG, void*)'
mingw32-make: *** [gcc_mswudll\monodll_dlmsw.o] Error 1

The exact version of MinGW GCC used by both users?
32 or 64 bit version of build and machine/computer?
I'm trying two setups:
- Vista 32bit with gcc version 4.5.1 (tdm-1)
- Windows 7 64bit with gcc version 4.5.1 (tdm64-1)

@Tim:
My ultimate goal is to have C::B entirely compile for 64bit on Windows 7. Any experience on that?
« Last Edit: March 03, 2011, 09:41:54 am by daniloz »

Offline daniloz

  • Regular
  • ***
  • Posts: 268
Re: Errors building wxWidgets for Code::Blocks
« Reply #4 on: March 03, 2011, 09:42:39 am »
On step furhter. The error in dlmsw.cpp can be solved by this patch:
http://trac.wxwidgets.org/ticket/12465

Compiling further...

wxWidgets 2.9.1 successfully built with MinGW64...
« Last Edit: March 03, 2011, 10:59:57 am by daniloz »

Offline jeffg

  • Single posting newcomer
  • *
  • Posts: 7
Re: Errors building wxWidgets for Code::Blocks
« Reply #5 on: March 03, 2011, 10:55:58 am »
My version of mingw32-g++ is the version bundled with CB 10.05, i.e 4.4.1 (TDM-2 mingw32).

I will try rebuilding using the instructions in your link. Presumably the reason it says that it's not a stable version is because it's old text.

I'm a bit puzzled though: since the wxWidgets stuff is all self-contained (makefiles, sources), I don't see why there should be any errors or warnings however you build it. How does it depend on the version of mingw32? Probably I'm being naive here :)

EDIT: Rebuilt using new instructions and now I have 2 DLLs!! wxmsw291u_gcc_custom.dll and wxmsw291u_gl_gcc_custom.dll.
I have no errors, but still a lot of warnings similar to:
Code
Creating library file: ..\..\lib\gcc_dll\libwxmsw29u.a
c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe: <unknown-file>:0: syntax error
Warning: .drectve `-export:T.1000 ' unrecognized
c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe: <unknown-file>:0: syntax error
Warning: .drectve `-export:T.1225 ' unrecognized

That's the Unicode/Release version. Should I now go ahead to create all four sets of DLLs: unicode/non-unicode release/debug ? If I want to build a wxWidgets project, can I build the main project with debug using the release version of wxWidgets? I assume I can. How about unicode/non-unicode?

Sorry for so many questions.

EDIT #2: I think I have answered my own question. When I created a new wxWidgets project in CB, I could only choose Release and Unicode to get a clean build - if I didn't check the Unicode box I got undefined reference errors, and it wouldn't build a Debug version. Therefore I need to build all four sets. Still, getting one clean build which runs is a big leap forward for me! :)

EDIT #3: I have managed to build both Release and Debug versions with Unicode, but I get the similar errors in Scintilla that I got before when building with UNICODE=0.
« Last Edit: March 03, 2011, 02:38:57 pm by jeffg »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Errors building wxWidgets for Code::Blocks
« Reply #6 on: March 03, 2011, 04:21:51 pm »
@Tim:
My ultimate goal is to have C::B entirely compile for 64bit on Windows 7. Any experience on that?

Yes, I failed every time I tried it.

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

steve64beginner

  • Guest
Re: Errors building wxWidgets for Code::Blocks
« Reply #7 on: June 10, 2011, 11:04:44 pm »
I had some issues with the build of wxWidgets according to these instructions.

My fixes:
 'set PATH=<MINGW>\bin;%PATH%' instead of 'set PATH=<MINGW>\bin'
compiled failed until I moved <MINGW> from c:\Program Files\CodeBlocks to c:\
I had to reissue the command 'cd /d <WXWIN>\build\msw' after the clean.

The 'make' just finished and I did not capture the log but I am just happy that it ran. Just now beginning to attempt a project in Code::Blocks

Hope this helps someone.
Steve S.