Code::Blocks

User forums => Help => Topic started by: PetrPetrov on November 05, 2013, 06:34:00 pm

Title: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 05, 2013, 06:34:00 pm
I want to build CB in Cygwin environment.

In particular I use latest x86_64 Cygwin.
I installed gcc, g++, make in Cygwin.
Also I installed x11 libraries and installed local X11 server on my Windows host.
So, many GUI X11 programs work fine in my Cygwin environment (like git gui, gitk, text editors etc.)

I want to run in the same manner CB.
First, CB requires wxWidgets.
Cygwin does not have wxWidgets from the box.
I downloaded the latest 2.8.12 version of wxWidgets sources and build it:
./configure --build=x86_64-pc-cygwin --without-msw --without-gtk --with-x11

which means that I want to build wxWidgets by using X11 libraries (instead of MSW by default).
Then I type, "make", "make install".
Here was a small compilation error, I fixed it, and wxWidgets libraries were installed successfully into my Cygwin env.

Second step is to build CB.
I downloaded "codeblocks-12.11release8629" sources.
./configure steps passed fine.

Then I type "make" and give the following error  (not just immediately after start, error becomes after some long time of compilation):

/bin/sh ../../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I.                                                        ./../../src/include -I/usr/local/lib/wx/include/x11univ-ansi-release-2.8 -I/usr/                                                        local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DWXUSINGDLL -D__WXUN                                                        IVERSAL__ -D__WXX11__  -I./include -I./src/scintilla/include -I./src/scintilla/l                                                        exlib -I./src/scintilla/src -DSCI_LEXER -DLINK_LEXERS -DGTK -D__WX__ -Ulinux -Uu                                                        nix  -O2 -ffast-math -DCB_AUTOCONF  -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexc                                                        eptions -w -MT wxscintilla.lo -MD -MP -MF .deps/wxscintilla.Tpo -c -o wxscintill                                                        a.lo `test -f 'src/wxscintilla.cpp' || echo './'`src/wxscintilla.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../../../src/include -I/usr/local/l                                                        ib/wx/include/x11univ-ansi-release-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSE                                                        T_BITS=64 -D_LARGE_FILES -DWXUSINGDLL -D__WXUNIVERSAL__ -D__WXX11__ -I./include                                                         -I./src/scintilla/include -I./src/scintilla/lexlib -I./src/scintilla/src -DSCI_L                                                        EXER -DLINK_LEXERS -DGTK -D__WX__ -Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -                                                        DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -w -MT wxscintilla.lo -MD -MP                                                         -MF .deps/wxscintilla.Tpo -c src/wxscintilla.cpp  -DDLL_EXPORT -DPIC -o .libs/w                                                        xscintilla.o
In file included from /usr/local/include/wx-2.8/wx/window.h:1537:0,
                 from /usr/local/include/wx-2.8/wx/wx.h:36,
                 from src/ScintillaWX.h:51,
                 from src/wxscintilla.cpp:44:
/usr/local/include/wx-2.8/wx/univ/window.h:19:19: note: attribute for 'class wxControlRenderer' must follow the 'class' keyword
 class WXDLLEXPORT wxControlRenderer;
                   ^
In file included from /usr/local/include/wx-2.8/wx/wx.h:25:0,
                 from src/ScintillaWX.h:51,
                 from src/wxscintilla.cpp:44:
src/wxscintilla.cpp:141:19: error: definition of static data member 'wxScintilla::sm_eventTable' of dllimport'd class
 BEGIN_EVENT_TABLE(wxScintilla, wxControl)
                   ^
/usr/local/include/wx-2.8/wx/event.h:2721:24: note: in definition of macro 'BEGIN_EVENT_TABLE'
     const wxEventTable theClass::sm_eventTable = \
                        ^
src/wxscintilla.cpp:141:19: error: definition of static data member 'wxScintilla::sm_eventHashTable' of dllimport'd class
 BEGIN_EVENT_TABLE(wxScintilla, wxControl)
                   ^

Could advise how to fix this compilation error?
Title: Re: Compile CodeBlocks by Cygwin
Post by: oBFusCATed on November 05, 2013, 06:44:15 pm
./configure --build=x86_64-pc-cygwin --without-msw --without-gtk --with-x11
C::B requires wxGTK and it cannot work with wxX11, sorry.
Also I'm sure you're the first trying to build C::B inside cygwin and also I'm not sure why you want to inflict this pain to yourself:)
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 05, 2013, 06:53:01 pm
Thank you for answer.

I will try to build wxWidgets version which is based on GTK library.
Title: Re: Compile CodeBlocks by Cygwin
Post by: stahta01 on November 05, 2013, 07:43:23 pm
./configure --build=x86_64-pc-cygwin --without-msw --without-gtk --with-x11
C::B requires wxGTK and it cannot work with wxX11, sorry.
Also I'm sure you're the first trying to build C::B inside cygwin and also I'm not sure why you want to inflict this pain to yourself:)

Not the first, I have tried it twice. But, its been about two years since last try.

Tim S.


Title: Re: Compile CodeBlocks by Cygwin
Post by: oBFusCATed on November 05, 2013, 08:13:51 pm
stahta01: Why? What is the benefit of running a cygwin version of C::B?
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 05, 2013, 08:16:59 pm
Now I have build wxWidgets-2.8.12 by using GTK+ 2.0 library.

Note that I used "all port" source package for wxWidgets (http://prdownloads.sourceforge.net/wxwindows/wxWidgets-2.8.12.tar.gz), wxGTK only had configuration/compilation problem.

I used
./configure --build=x86_64-pc-cygwin --with-gtk --without-msw --without-x11

line to configure wxWdigets.
After this, wxWidgets was build fine and installed successfully.
Note I was need to install additionally 'pkg-config' package for Cygwin, otherwise wxWidget configuration script did not find installed GTK 2.0 development libraries into my Cygwin.

However, I have the same error during compilation of C::B
src/wxscintilla.cpp:169:17: error: definition of static data member 'wxScintilla::ms_classInfo' of dllimport'd class
 IMPLEMENT_CLASS(wxScintilla, wxControl)
src/wxscintilla.cpp:170:25: error: definition of static data member 'wxScintillaEvent::ms_classInfo' of dllimport'd class
 IMPLEMENT_DYNAMIC_CLASS(wxScintillaEvent, wxCommandEvent)


Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 05, 2013, 08:31:58 pm
It seems that class that causes problem is wxScintilla.
This class defines some custom wxWidget control which is used insude C::B.

Source file of this class is here:
C:\cygwin64\usr\src\codeblocks-12.11release8629\src\sdk\wxscintilla\src\wxscintilla.cpp
and header file is here:
C:\cygwin64\usr\src\codeblocks-12.11release8629\src\sdk\wxscintilla\include\wx\wxscintilla.h

Code into header file:
class WXDLLIMPEXP_SCI wxScintilla : public wxControl {
public:
..... methods

It seems that wxScintilla or its parent class should define sm_eventTable member and some other members.
Also I see that problem is related to dllimport's class. I guess that wxControl is dll-imported class (this is because it is located into another library - wxWidget).
As workaround I can try to build wxWidget as a static library.

But I guess that problem is in WXMAKINGDLL_SCI macro.

wxscintilla.cpp is being compiled with -DWXUSINGDLL symbol which means to use wxWidget library as a shared library.
Also I see (in begin of wxscintilla.h):
#ifdef WXMAKINGDLL_SCI
    #define WXDLLIMPEXP_SCI WXEXPORT
#elif defined(WXUSINGDLL_SCI) || defined(WXUSINGDLL)
    #define WXDLLIMPEXP_SCI WXIMPORT
#else // not making nor using DLL
    #define WXDLLIMPEXP_SCI
#endif
And in such a case I think that  #define WXDLLIMPEXP_SCI WXIMPORT will be used!

wxscintilla class is part of C::B, not it is not part of wxWidget library, I think.
So, it uses wrong WXDLLIMPEXP_SCI macro.

Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 05, 2013, 08:43:22 pm
It seems that I have fixed above compilation error and build is going ahead now...
Title: Re: Compile CodeBlocks by Cygwin
Post by: oBFusCATed on November 05, 2013, 08:46:02 pm
Patches welcome...
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 05, 2013, 08:47:38 pm
Another compilation error:
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../../src/include -I/usr/local/lib/wx/include/gtk2univ-ansi-release-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DWXUSINGDLL -D__WXUNIVERSAL__ -D__WXGTK__ -I../../src/include -I../../src/sdk/wxscintilla/include -I../../src/sdk/wxpropgrid/include -I../../src/include/tinyxml -I../../src/include/scripting/include -I../../src/include/scripting/bindings -I../../src/include/scripting/sqplus -I../../src/include/mozilla_chardet -Ulinux -Uunix -O2 -ffast-math -DCB_AUTOCONF -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -w -MT cbauibook.lo -MD -MP -MF .deps/cbauibook.Tpo -c cbauibook.cpp  -DDLL_EXPORT -DPIC -o .libs/cbauibook.o
In file included from /usr/local/include/wx-2.8/wx/window.h:1537:0,
                 from /usr/local/include/wx-2.8/wx/wx.h:36,
                 from /usr/local/include/wx-2.8/wx/wxprec.h:68,
                 from ../../src/include/sdk_common.h:37,
                 from ../../src/include/sdk_precomp.h:13,
                 from cbauibook.cpp:11:
/usr/local/include/wx-2.8/wx/univ/window.h:19:19: note: attribute for 'class wxControlRenderer' must follow the 'class' keyword
 class WXDLLEXPORT wxControlRenderer;
                   ^
cbauibook.cpp: In member function 'void cbAuiNotebook::OnMotion(wxMouseEvent&)':
cbauibook.cpp:414:39: error: 'class wxAuiTabCtrl' has no member named 'GetToolTip'
         wxToolTip* tooltip = tabCtrl->GetToolTip();
                                       ^
cbauibook.cpp:415:32: error: invalid use of incomplete type 'class wxToolTip'         if (!tooltip || tooltip->GetTip() != text)
                                ^
In file included from /usr/local/include/wx-2.8/wx/wx.h:36:0,
                 from /usr/local/include/wx-2.8/wx/wxprec.h:68,
                 from ../../src/include/sdk_common.h:37,
                 from ../../src/include/sdk_precomp.h:13,
                 from cbauibook.cpp:11:
/usr/local/include/wx-2.8/wx/window.h:65:28: error: forward declaration of 'class wxToolTip' class WXDLLIMPEXP_FWD_CORE wxToolTip;


It seems that C::B tries to use GetToolTip() method which is absent. Missing included header file? Any ideas?
Title: Re: Compile CodeBlocks by Cygwin
Post by: jens on November 05, 2013, 09:02:12 pm
The wx/tooltip.h header is included at the top of the cbauibook.cpp file.

It's most likely a wxWidgets configuration problem.

Configuring and compiling wxWidgets in a way you get all defines correctly is surely a hard way. And without good knowledge of wxWidgets (and surely C::B) it will be really hard and I doubt there will be much help from the community.
Not because nobody wants to help, but because nobody ever did it.

And I personally see no reason not to use a standard windows build.
Title: Re: Compile CodeBlocks by Cygwin
Post by: stahta01 on November 05, 2013, 09:21:41 pm
stahta01: Why? What is the benefit of running a cygwin version of C::B?

When I was doing a lot of CB Patches; I thought building CB under CygWin would mostly test the Linux CB Build stuff.

I was also thinking of making a CB version to do better debugging of programs under CygWin;
that is the only reason I can think of to run a CygWin built CB.

Tim S.
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 05, 2013, 11:07:48 pm
It seems that wxWidgets library was configured incorrectly.
I.e. It is required that wxWidgets should be compiled with --enable-tooltips flag.
However, if I set --enable-tooltips option for ./configure script then setup.h will anyway #define wxUSE_TOOLTIPS 0 ,
i.e. something goes wrong.
I manually edited this file after configuration step to enable wxUSE_TOOLTIPS to 1:
C:\cygwin64\usr\src\wxWidgets-2.8.12\lib\wx\include\gtk2univ-ansi-release-static-2.8\wx\setup.h

Also I used static configuration to avoid problem with wxScintilla class.
My full configuration line is:
./configure --build=x86_64-pc-cygwin --without-msw --without-x11 --with-gtk --enable-tooltips --enable-monolithic --enable-dnd --disable-shared --enable-universal
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 05, 2013, 11:30:21 pm
Just have noticed from configure's log:
configure: WARNING: wxTooltip not supported yet in wxUniversal... disabled
Title: Re: Compile CodeBlocks by Cygwin
Post by: stahta01 on November 05, 2013, 11:55:32 pm
Quote
gtk2univ-ansi-release-static-2.8

I would NOT use Universal.
I might try Unicode instead of ANSI; but, you are likely right in trying ANSI because the last time I tried CygWin did NOT support Unicode.
I would NOT use static because I think CB requires wxWidgets be in a DLL.

Tim S.


Title: Re: Compile CodeBlocks by Cygwin
Post by: oBFusCATed on November 06, 2013, 12:01:41 am
As far as I know C::B requires unicode builds or at least no one has bothered to fix any ansi-related issues.
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 06, 2013, 12:06:16 am
Thank you for warning.

I am currently trying:
wxWidgets:
./configure --build=x86_64-pc-cygwin --without-msw  --with-gtk --enable-tooltips --enable-monolithic --enable-dnd --enable-shared --disable-universal

C::B:
./configure --build=x86_64-pc-cygwin

However, my wxWidgets static configuration did not have problem with wxscintilla class (from the box).

Title: Re: Compile CodeBlocks by Cygwin
Post by: stahta01 on November 06, 2013, 12:13:22 am
However, my wxWidgets static configuration did not have problem with wxscintilla class (from the box).

FYI: CB uses a plugin system; this means the plugin must be in DLL in the current design.
For a DLL to use wxWidgets requires wxWidgets be in a DLL, I am not sure this is a Compiler or WxWidgets caused constrain.

So, if you wish to use CB Plugins; do a shared build.

Tim S.
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 06, 2013, 12:19:35 am
Compiles fine, but I have linking error:

/bin/sh ../../libtool --tag=CXX   --mode=link g++  -O2 -ffast-math -DCB_AUTOCONF  -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions   -o codeblocks.exe app.o appglobals.o backtracedlg.o breakpointsdlg.o compilersettingsdlg.o cpuregistersdlg.o crashhandler.o debugger_interface_creator.o debuggermenu.o debuggersettingscommonpanel.o debuggersettingsdlg.o debuggersettingspanel.o disassemblydlg.o dlgabout.o dlgaboutplugin.o environmentsettingsdlg.o examinememorydlg.o infopane.o main.o notebookstyles.o prefix.o printdlg.o scriptconsole.o scriptingsettingsdlg.o splashscreen.o startherepage.o switcherdlg.o threadsdlg.o watchesdlg.o -L../sdk -lcodeblocks -L/usr/local/lib    -lwx_gtk2-2.8  -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangocairo-1.0 -lXinerama -lXi -lXrandr -lXcursor -lXcomposite -lXdamage -lgdk_pixbuf-2.0 -lpangoft2-1.0 -lgio-2.0 -lXfixes -lcairo -lpixman-1 -lxcb-shm -lxcb-render -lXrender -lXext -lX11 -lxcb -lXau -lXdmcp -lpng15 -lharfbuzz -lpango-1.0 -lm -lfontconfig -lexpat -lfreetype -lz -lbz2 -lgmodule-2.0 -lgobject-2.0 -lffi -lglib-2.0 -lintl -liconv -lpcre   -lpthread -ldl
libtool: link: g++ -O2 -ffast-math -DCB_AUTOCONF -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -o .libs/codeblocks.exe app.o appglobals.o backtracedlg.o breakpointsdlg.o compilersettingsdlg.o cpuregistersdlg.o crashhandler.o debugger_interface_creator.o debuggermenu.o debuggersettingscommonpanel.o debuggersettingsdlg.o debuggersettingspanel.o disassemblydlg.o dlgabout.o dlgaboutplugin.o environmentsettingsdlg.o examinememorydlg.o infopane.o main.o notebookstyles.o prefix.o printdlg.o scriptconsole.o scriptingsettingsdlg.o splashscreen.o startherepage.o switcherdlg.o threadsdlg.o watchesdlg.o  -L../sdk /usr/src/codeblocks-12.11release8629/src/sdk/.libs/libcodeblocks.a -L/usr/local/lib -lwx_gtk2-2.8 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangocairo-1.0 -lXinerama -lXi -lXrandr -lXcursor -lXcomposite -lXdamage -lgdk_pixbuf-2.0 -lpangoft2-1.0 -lgio-2.0 -lXfixes -lcairo -lpixman-1 -lxcb-shm -lxcb-render -lXrender -lXext -lX11 -lxcb -lXau -lXdmcp -lpng15 -lharfbuzz -lpango-1.0 -lfontconfig -lexpat -lfreetype -lz -lbz2 -lgmodule-2.0 -lgobject-2.0 -lffi -lglib-2.0 -lintl -liconv -lpcre -lpthread -ldl
dlgaboutplugin.o: duplicate section `.rdata$_ZTI16wxTopLevelWindow[_ZTI16wxTopLevelWindow]' has different size
/usr/src/codeblocks-12.11release8629/src/sdk/.libs/libcodeblocks.a(infowindow.o): duplicate section `.rdata$_ZTI9wxControl[_ZTI9wxControl]' has different size
/usr/src/codeblocks-12.11release8629/src/sdk/.libs/libcodeblocks.a(cbtreectrl.o): duplicate section `.rdata$_ZTI9wxControl[_ZTI9wxControl]' has different size
/usr/src/codeblocks-12.11release8629/src/sdk/.libs/libcodeblocks.a(projectdepsdlg.o): duplicate section `.rdata$_ZTI16wxTopLevelWindow[_ZTI16wxTopLevelWindow]' has different size/usr/src/codeblocks-12.11release8629/src/sdk/.libs/libcodeblocks.a(configuretoolsdlg.o): duplicate section `.rdata$_ZTI16wxTopLevelWindow[_ZTI16wxTopLevelWindow]' has different size
/usr/src/codeblocks-12.11release8629/src/sdk/.libs/libcodeblocks.a(autodetectcompilers.o): duplicate section `.rdata$_ZTI16wxTopLevelWindow[_ZTI16wxTopLevelWindow]' has different size
/usr/src/codeblocks-12.11release8629/src/sdk/.libs/libcodeblocks.a(editkeywordsdlg.o): duplicate section `.rdata$_ZTI16wxTopLevelWindow[_ZTI16wxTopLevelWindow]' has different size
debugger_interface_creator.o:debugger_interface_creator.cpp:(.text+0x1a2): undefined reference to `__imp__ZN11wxScintilla13CallTipActiveEv'
debugger_interface_creator.o:debugger_interface_creator.cpp:(.text+0x1a2): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp__ZN11wxScintilla13CallTipActiveEv'
/usr/lib/gcc/x86_64-pc-cygwin/4.8.2/../../../../x86_64-pc-cygwin/bin/ld: debugger_interface_creator.o: bad reloc address 0x14 in section `.xdata'
collect2: error: ld returned 1 exit status

Any idea?
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 06, 2013, 01:23:14 am
Current error:

libtool: link: g++ -O2 -ffast-math -DCB_AUTOCONF -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -w -o .libs/codeblocks.exe app.o appglobals.o backtracedlg.o breakpointsdlg.o compilersettingsdlg.o cpuregistersdlg.o crashhandler.o debugger_interface_creator.o debuggermenu.o debuggersettingscommonpanel.o debuggersettingsdlg.o debuggersettingspanel.o disassemblydlg.o dlgabout.o dlgaboutplugin.o environmentsettingsdlg.o examinememorydlg.o infopane.o main.o notebookstyles.o prefix.o printdlg.o scriptconsole.o scriptingsettingsdlg.o splashscreen.o startherepage.o switcherdlg.o threadsdlg.o watchesdlg.o  -L../sdk /usr/src/codeblocks-12.11release8629/src/sdk/.libs/libcodeblocks.a -L/usr/local/lib -L../sdk/wxscintilla /usr/src/codeblocks-12.11release8629/src/sdk/wxscintilla/.libs/libwxscintilla.a -lwx_gtk2-2.8 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangocairo-1.0 -lXinerama -lXi -lXrandr -lXcursor -lXcomposite -lXdamage -lgdk_pixbuf-2.0 -lpangoft2-1.0 -lgio-2.0 -lXfixes -lcairo -lpixman-1 -lxcb-shm -lxcb-render -lXrender -lXext -lX11 -lxcb -lXau -lXdmcp -lpng15 -lharfbuzz -lpango-1.0 -lfontconfig -lexpat -lfreetype -lz -lbz2 -lgmodule-2.0 -lgobject-2.0 -lffi -lglib-2.0 -lintl -liconv -lpcre -lpthread -ldl
debuggermenu.o:debuggermenu.cpp:(.text+0x1245): undefined reference to `__imp__ZN11wxScintilla14GetCurrentLineEv'
debuggermenu.o:debuggermenu.cpp:(.text+0x1245): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp__ZN11wxScintilla14GetCurrentLineEv'
debuggermenu.o:debuggermenu.cpp:(.text+0x477e): undefined reference to `__imp__ZN11wxScintilla14GetCurrentLineEv'
debuggermenu.o:debuggermenu.cpp:(.text+0x477e): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp__ZN11wxScintilla14GetCurrentLineEv'
debuggermenu.o:debuggermenu.cpp:(.text+0x479c): undefined reference to `__imp__ZNK11wxScintilla7GetLineEi'
debuggermenu.o:debuggermenu.cpp:(.text+0x479c): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp__ZNK11wxScintilla7GetLineEi'
/usr/lib/gcc/x86_64-pc-cygwin/4.8.2/../../../../x86_64-pc-cygwin/bin/ld: debuggermenu.o: bad reloc address 0x8 in section `.data'
collect2: error: ld returned 1 exit status
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 06, 2013, 03:01:16 am
I have build successfully C::B under Cygwin!

Also I have just run it from Cygwin + Xming server on Windows!

 ;D
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 06, 2013, 03:16:34 am
However, I can not create any new project - here are not categories.

Also I do not see any loaded plugin.
I only see in log during C::B startup:
Scanning for lexers in ./share/codeblocks/lexers/...
Found 45 lexers
Loading lexer_A68k
Loading lexer_ada
Loading lexer_angelscript
Loading lexer_bash
Loading lexer_batch
Loading lexer_bibtex
Loading lexer_caml
Loading lexer_cg
Loading lexer_cmake
Loading lexer_cpp
Loading lexer_css
Loading lexer_d
Loading lexer_diff
Loading lexer_f77
Loading lexer_fortran
Loading lexer_glsl
Loading lexer_gm
Loading lexer_haskell
Loading lexer_hitasm
Loading lexer_html
Loading lexer_java
Loading lexer_latex
Loading lexer_lisp
Loading lexer_lua
Loading lexer_make
Loading lexer_masm
Loading lexer_matlab
Loading lexer_nsis
Loading lexer_OgreCompositor
Loading lexer_OgreMaterial
Loading lexer_pascal
Loading lexer_perl
Loading lexer_postscript
Loading lexer_prg
Loading lexer_properties
Loading lexer_python
Loading lexer_rc
Loading lexer_ruby
Loading lexer_smalltalk
Loading lexer_sql
Loading lexer_squirrel
Loading lexer_vbscript
Loading lexer_verilog
Loading lexer_vhdl
Loading lexer_xml
Configured 0 tools
Scanning for plugins in /home/Petr/.codeblocks/share/codeblocks/plugins
Loaded 0 plugins
Scanning for plugins in /usr/local/lib/codeblocks/plugins
Loaded 0 plugins
Running startup script
Script plugin registered: Find Broken Files plugin
Script/function 'edit_startup_script.script' registered under menu '&Settings/-Edit startup script'

Could advise anybody how to setup (and probably build) plugins?
Title: Re: Compile CodeBlocks by Cygwin
Post by: stahta01 on November 06, 2013, 05:39:53 am
I have build successfully C::B under Cygwin!

Also I have just run it from Cygwin + Xming server on Windows!

 ;D

Please post the configure options used for wxWidgets and Code::Blocks.

Tim S.
Title: Re: Compile CodeBlocks by Cygwin
Post by: oBFusCATed on November 06, 2013, 08:24:22 am
Quote
Scanning for plugins in /home/Petr/.codeblocks/share/codeblocks/plugins
Loaded 0 plugins
Scanning for plugins in /usr/local/lib/codeblocks/plugins
Loaded 0 plugins

For some reason there are no plugins installed.
Title: Re: Compile CodeBlocks by Cygwin
Post by: ollydbg on November 06, 2013, 09:31:59 am
I have build successfully C::B under Cygwin!

Also I have just run it from Cygwin + Xming server on Windows!

 ;D
Great work! Hopefully you can add a wiki page about how to build it in Wiki (http://wiki.codeblocks.org/)
Title: Re: Compile CodeBlocks by Cygwin
Post by: jens on November 06, 2013, 09:52:59 am
You need to run C::B's configure script with --with-contrib-plugins=[the,plugins,you,want or all], see the --help parameter
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 06, 2013, 11:00:25 am
My steps to compile wxWidgets:
./configure --build=x86_64-pc-cygwin --without-msw --with-gtk --disable-universal --enable-tooltips --enable-dnd

--disable-universal is important key, it allows to enable tool tips by using --enable-tooltips
(if you will just specify --enable-tooltips then this option will be disabled, such as default configuration is --enable-universal)

--enable-dnd is also required I guess.

In fact here is no matter static\shared or monolithic\non-monolithic configuration.

Also I fixed small compilation error in /usr/src/wxWidgets-2.8.12/include/wx/string.h  line 822:
    /*wxChar& operator[](int n)
      { return wxStringBase::at(n); }*/

I have just commented-out these two strings.

Then make, make install.

My steps to compile C::B:
./configure --build=x86_64-pc-cygwin --enable-shared

Before typing 'make' in console please look at the following file /usr/src/codeblocks-12.11release8629/src/sdk/wxscintilla/include/wx/wxscintilla.h  line 37-43.
Please comment this block:
/*#ifdef WXMAKINGDLL_SCI
    #define WXDLLIMPEXP_SCI WXEXPORT
#elif defined(WXUSINGDLL_SCI) || defined(WXUSINGDLL)
    #define WXDLLIMPEXP_SCI WXIMPORT
#else // not making nor using DLL
    #define WXDLLIMPEXP_SCI
#endif*/

and add the following line a little:
#define WSDLLIMPEXP_SCI

then use Replace command (Ctrl+H) to replaces all entries of WXDLLIMPEXP_SCI word by WSDLLIMPEXP_SCI world for only this file (/usr/src/codeblocks-12.11release8629/src/sdk/wxscintilla/include/wx/wxscintilla.h)!

Now you can type 'make' in console.

However, a few compilation errors will occur.
1.
/usr/src/codeblocks-12.11release8629/src/sdk/macrosmanager.cpp   lines 89-105:

my modifications are:
//#ifndef __WXMAC__
//                                wxRE_ADVANCED);
//#else
                                wxRE_EXTENDED);
//#endif
    m_RE_To83Path.Compile(_T("\\$TO_83_PATH{([^}]*)}"),
//#ifndef __WXMAC__
//                                wxRE_ADVANCED);
//#else
                                wxRE_EXTENDED);
//#endif
    m_RE_RemoveQuotes.Compile(_T("\\$REMOVE_QUOTES{([^}]*)}"),
//#ifndef __WXMAC__
//                                wxRE_ADVANCED);
//#else
                                wxRE_EXTENDED);
//#endif

2.
/usr/src/codeblocks-12.11release8629/src/plugins/debuggergdb/gdb_commands.h lines 204-223:
//#ifndef __WXMAC__
//                       wxRE_ADVANCED);
//#else
                       wxRE_EXTENDED);
//#endif
static wxRegEx reStepI2(_T("\\A(0x[A-Fa-f0-9]+)\\s+(\\d+)\\s+in (.*)"),
//#ifndef __WXMAC__
//                       wxRE_ADVANCED);
//#else
                       wxRE_EXTENDED);
//#endif
static wxRegEx reStepI3(_T("^(0x[A-Fa-f0-9]+) in (.*)? from (.*)"));
static wxRegEx reStepI4(_T("^(0x[A-Fa-f0-9]+) in (.*)? at (.*)"));

static wxRegEx reNextI(_T("\x1a\x1a(([a-zA-Z]:)?.*?):([0-9]*):([0-9]*):(middle|beg):(.*)"),
//#ifndef __WXMAC__
//                       wxRE_ADVANCED);
//#else
                       wxRE_EXTENDED);
//#endif

and also line 642 in this file:         
   m_regExp(wxT("^Catchpoint[ \\t]([0-9]+)[ \\t]\\(") + type + wxT("\\)$"), wxRE_EXTENDED/*wxRE_ADVANCED*/)

3.
/usr/src/codeblocks-12.11release8629/src/plugins/debuggergdb/parsewatchvalue.cpp lines 67-71:
//#ifndef __WXMAC__
//                           wxRE_ADVANCED);
//#else
                           wxRE_EXTENDED);
//#endif

and last compilation error:
/usr/src/codeblocks-12.11release8629/src/plugins/xpmanifest/windowsxplooknfeel.h  line 11-13:

#ifndef __WXMSW__
    #error This plugin is for use under Win32 only!
#endif

So, this plugin should be not compiled under GTK\Linux.

Just disable xpmanifest plugin compilation from generated Makefile:
/usr/src/codeblocks-12.11release8629/src/plugins/Makefile

strings like this:

MAYBE_ABBREVIATIONS = abbreviations
#MAYBE_MANIFEST = xpmanifest
SUBDIRS = $(MAYBE_ASTYLE) \
      $(MAYBE_AUTOSAVE) \
      $(MAYBE_CLASSWIZARD) \
      $(MAYBE_CODECOMPLETION) \
      $(MAYBE_COMPILER) \
      $(MAYBE_DEBUGGER) \
      $(MAYBE_MIMEHANDLER) \
      $(MAYBE_SCRIPTEDWIZARD) \
      $(MAYBE_PROJECTSIMPORTER) \
      $(MAYBE_OPENFILESLIST) \
      $(MAYBE_TODO) \
      $(MAYBE_ABBREVIATIONS) \
      #$(MAYBE_MANIFEST) \
      contrib

then compilation goes fine......
You can 'make install' after conpilation and run C::B under Cygwin + remote X11 display, such as
export DISPLAY=localhost:0.0
(you should have local X11 server installed and running on Windows host, such as Xming - http://www.straightrunning.com/XmingNotes/)

however, I see problem: all plugins (I mean only standard plugins for C::B) are being built to static library configuration.
But we need to have them in shared library configuration. So, 0 plugins are loaded.
However, I specified --enable-shared during C::B configuration.

Could anyone help, or make an idea?




Title: Re: Compile CodeBlocks by Cygwin
Post by: stahta01 on November 07, 2013, 02:22:10 am
Found some of my old Cygwin Patches.
Not likely safe to apply to CB SVN; but, they might help someone build CB.

Edit: Removed patch I decided the patch would just make more work; will post my progress and commands used, later.

Edit: Step that checks for gtk version 2 installed, Correctly.
Code: [Select]
pkg-config --cflags --libs gtk+-2.0

Mine was NOT installed right; (I had prior non CygWin GTK installed)
I had to delete the Windows System Variables GTK_BASEPATH and PKG_CONFIG_PATH to get the Cygwin GTK to be seen.
(I also had to install CygWin pkg-config; it was using the one Installed by the old GTK Package, above.)

Code: [Select]
-D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/harfbuzz  -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangocairo-1.0 -lXinerama -lXi -lXrandr -lXcursor -lXcomposite Xdamage -lgdk_pixbuf-2.0 -lpangoft2-1.0 -lgio-2.0 -lXfixes -lcairo -lpixman-1 -lxcb-shm -lxcb-render -lXrender -lXext -lX11 -lxcb -lXau -lXdmcp lpng15 -lharfbuzz -lpango-1.0 -lm -lfontconfig -lexpat -lfreetype -lz -lbz2 -lgmodule-2.0 -lgobject-2.0 -lffi -lglib-2.0 -lintl -liconv -lpcre


Tim S.
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 07, 2013, 08:15:39 am
Step that checks for gtk version 2 installed.
Code: [Select]
pkg-config gtk+-2.0 --libs
Thank you. My output is:

[email protected] ~
$ pkg-config gtk+-2.0 --libs
-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangocairo-1.0 -lXinerama -lXi -lXrandr                                                                                                                                                                              -lXcursor -lXcomposite -lXdamage -lgdk_pixbuf-2.0 -lpangoft2-1.0 -lgio-2.0 -lXfi                                                                                                                                                                             xes -lcairo -lpixman-1 -lxcb-shm -lxcb-render -lXrender -lXext -lX11 -lxcb -lXau                                                                                                                                                                              -lXdmcp -lpng15 -lharfbuzz -lpango-1.0 -lm -lfontconfig -lexpat -lfreetype -lz                                                                                                                                                                              -lbz2 -lgmodule-2.0 -lgobject-2.0 -lffi -lglib-2.0 -lintl -liconv -lpcre
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 07, 2013, 08:35:20 am
My C::B running on Cygwin showing About dialog:

(http://files.rsdn.ru/65166/code-blocks-cygwin.png)

I selected new project: all categories are empty - 0 plugins are loaded
(http://files.rsdn.ru/65166/code-blocks-cygwin2.png)
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 07, 2013, 08:37:16 am
Also I have standard Windows distribution of C::B, it shows Windows OS in About dialog.
Note that C::B compiled by Cygwin shows 'Linux' OS in About dialog.

(http://files.rsdn.ru/65166/code-blocks-std-windows.png)
Title: Re: Compile CodeBlocks by Cygwin
Post by: stahta01 on November 07, 2013, 04:34:13 pm
I am trying this Configure Command for wxWidgets (wxGTK) (I am using wx 2.8 SVN Branch)
Code: [Select]
../configure --enable-unicode --with-libjpeg=builtin --with-regex=builtin --without-msw --with-gtk --prefix=/opt/wx/2.8 --enable-monolithic  --disable-universal --without-gtkprint --without-gnomeprint --enable-tooltips --enable-dnd --enable-shared

These options --without-gtkprint --without-gnomeprint helped build in the past using wxWidgets SVN trunk (2.9) .

I am nearly certain "--enable-shared" is required for a wxWidgets able to be used by Code::Blocks.
I decided to try "--enable-unicode" this option because this will reduce the patches needed by Code::Blocks it has about 3 places ANSI code needs fixed the last time I did an ANSI build (about 1 year ago.)
I used "--with-libjpeg=builtin" because two years ago; the version of libjpeg in CygWin caused issues.
I used "--with-regex=builtin" because the other poster in this thread commented out code that using this option might NOT need done.

I got the below displayed before I did make; it is still running make.
Code: [Select]
Configured wxWidgets 2.8.12 for `i686-pc-cygwin'

  Which GUI toolkit should wxWidgets use?                 GTK+ 2
  Should wxWidgets be compiled into single library?       yes
  Should wxWidgets be compiled in debug mode?             no
  Should wxWidgets be linked as a shared library?         yes
  Should wxWidgets be compiled in Unicode mode?           yes
  What level of wxWidgets compatibility should be enabled?
                                       wxWidgets 2.4      no
                                       wxWidgets 2.6      yes
  Which libraries should wxWidgets use?
                                       jpeg               builtin
                                       png                sys
                                       regex              builtin
                                       tiff               builtin
                                       zlib               sys
                                       odbc               no
                                       expat              sys
                                       libmspack          no
                                       sdl                no

I set CXXFLAGS="-Wno-attributes" before running make to reduce the warnings in hope it speeds up the build. Edit: It made no difference in building. Will try next time setting it before the configure command.

wxWidgets is still building.

The command I plan to try on Code::Blocks boot/configure
Code: [Select]
./bootstrap
export CXXFLAGS="-DWXMAKINGDLL_SCI -Wno-attributes"
 ./configure


Tim S.
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 07, 2013, 06:13:12 pm
Sorry, I did not run ./bootstrap never....

Code: [Select]
[email protected] /usr/src/codeblocks-12.11release8629
$ ./bootstrap
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.in and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
aclocal:configure.in:79: warning: macro `AM_OPTIONS_WXCONFIG' not found in library
aclocal:configure.in:80: warning: macro `AM_PATH_WXCONFIG' not found in library
Useless use of /d modifier in transliteration operator at /usr/share/automake-1.9/Automake/Wrap.pm line 60.
configure.in:79: error: possibly undefined macro: AM_OPTIONS_WXCONFIG
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.in:80: error: possibly undefined macro: AM_PATH_WXCONFIG

wxWidgets is not installed property?
Title: Re: Compile CodeBlocks by Cygwin
Post by: oBFusCATed on November 07, 2013, 06:33:00 pm
wxWidgets is not installed property?
What is the output of "wx-config --cflags --libs" in your console?
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 07, 2013, 06:45:06 pm
my output is:

Code: [Select]
[email protected] ~
$ wx-config --cflags --libs
-I/usr/local/lib/wx/include/gtk2-ansi-release-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DWXUSINGDLL -D__WXGTK__
-L/usr/local/lib    -lwx_gtk2-2.8
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 07, 2013, 06:48:27 pm
I am worrying that problem in my Cygwin system.
It seems that libtool utility always create static libraries.

I have created small test project:
1. Wrote small a.cpp file the following content:
Code: [Select]
__attribute__ ((dllexport)) int fn(int a)
{
  return a + 19;
}

and compile it by libtool (just wrapper for gcc)
Code: [Select]
libtool --mode=compile gcc -shared -c a.cpp
now I am trying to get libtest.dll or libtest.la
Code: [Select]
$ libtool --mode=link gcc -shared -g -O -o libtest.la a.lo
libtool: link: rm -fr .libs/libtest.a .libs/libtest.la .libs/libtest.lai
libtool: link: ar cru .libs/libtest.a .libs/a.o
libtool: link: ranlib .libs/libtest.a
libtool: link: ( cd ".libs" && rm -f "libtest.la" && ln -s "../libtest.la" "libtest.la" )

I have specified -shared option.
What I am doing wrong?
Title: Re: Compile CodeBlocks by Cygwin
Post by: oBFusCATed on November 07, 2013, 06:49:03 pm
Hm, then do you have wx.m4 file or something like this where AM_PATH_WXCONFIG or AM_OPTIONS_WXCONFIG are defined?
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 07, 2013, 06:52:35 pm
Thank you very much!

Now I manually copied wxwin.m4 into local codeblocks source folder, and added
Code: [Select]
m4_include(wxwin.m4)at begin of configure.in...

However, it does not matter... libcompiler.a is still created...
I think that libcompiler.dll should be created to allow codeblocks.exe to load this plugin and able to create new projects....
Please see my post above about libtool problem.
Title: Re: Compile CodeBlocks by Cygwin
Post by: oBFusCATed on November 07, 2013, 07:07:16 pm
Can't help on libtool issues, because I don't understand it, sorry.
Title: Re: Compile CodeBlocks by Cygwin
Post by: stahta01 on November 07, 2013, 08:30:28 pm
Hm, then do you have wx.m4 file or something like this where AM_PATH_WXCONFIG or AM_OPTIONS_WXCONFIG are defined?

IIRC, I followed the steps suggested in URL to get past this error in the past.
http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Linux (http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Linux)

I likely did something based on this line.
Code: [Select]
export ACLOCAL_FLAGS="-I `wx-config --prefix`/share/aclocal"

Tim S
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 07, 2013, 10:37:34 pm
Bingo!
I have compiled plugins as shared libraries:
(http://files.rsdn.ru/65166/code-blocks-cygwin-with-plugins.png)
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on November 11, 2013, 06:49:38 pm
Unfortunately, Code::Blocks does not work properly, I can create new 'Console' project in C++.
But gcc compiler is not invocaled from Code::Blocks.

Any ideas?

P.S.: I have specified paths for compiler toolchain, gcc.exe, g++.exe etc.
Title: Re: Compile CodeBlocks by Cygwin
Post by: stahta01 on November 11, 2013, 09:00:23 pm
Unfortunately, Code::Blocks does not work properly, I can create new 'Console' project in C++.
But gcc compiler is not invocaled from Code::Blocks.

Any ideas?

P.S.: I have specified paths for compiler toolchain, gcc.exe, g++.exe etc.

Other than the standard answer, no.
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F)

What path did you use? A windows or a CygWin path?
Because, I have no idea which is more likely to work.

Tim S.
Title: Re: Compile CodeBlocks by Cygwin
Post by: PetrPetrov on July 08, 2015, 01:51:16 pm
Sorry for the long delay.

As I can remember I specified Linux path (like /bin/gcc.exe or like /usr/bin/gcc.exe, /usr/bin/g++.exe etc).
I'll have a chance to compile it again in near future, maybe Cygwin was improved as well as C::B.