For some reason the C::B binaries often crash on my Win7 laptop.
For development on this laptop I use a combination of C::B and Msys2
(https://sourceforge.net/p/msys2/wiki/MSYS2 installation)
I am now trying to compile C::B in the Msys2 envioronment.
The Linux installation instructions (http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Linux) seem most suitable for building in Msys2.
Compiling wxwidgets was easy:
1. wget --no-check-certificate https://github.com/wxWidgets/wxWidgets/archive/master.zip && unzip master.zip && mv wxWidgets-master wxWidgets-dev
2. cd wxWidgets-dev
3. configure --prefix=/mingw64; make; make install ## prefix for the 64bit compiler environment
The wxWidgets tests described on the linux page all work (i.e. return useful info):
$ wx-config --prefix
/mingw64
$ wx-config --libs
-L/mingw64/lib -Wl,--subsystem,windows -mwindows -lwx_mswu_xrc-3.1 -lwx_mswu_html-3.1 -lwx_mswu_qa-3.1 -lwx_mswu_adv-3.1 -lwx_mswu_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1 -lwx_baseu-3.1
$ which wx-config
/mingw64/bin/wx-config
Then I continue with C::B:
a) svn checkout http://svn.code.sf.net/p/codeblocks/code/trunk codeblocks-dev
b) cd codeblocks-dev/
c) ./bootstrap
d) ./configure --with-wx-config=`which wx-config`; ## no errors/warnings, wxwidgets 3.1 found, advised to issue 'make'
e) make
follows with the output below.
The warnings and errors all seem to relate to DLLexport and DLLimport.
Is this something that should be set explicitly when (in Windows) it's not possible to use C::B to build C::B?
Thanks for the help, really hoping to use C::B also in Msys2 for Windows binaries!
`make` output:
/bin/sh ../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../src/include -I/mingw64/lib/wx/include/msw-unicode-3.1 -I/mingw64/include/wx-3.1 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMSW__ -I../../src/include -I../../src/sdk/wxscintilla/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 -I../../src/include/mozilla_chardet/mfbt -I../../src/include/mozilla_chardet/nsprpub/pr/include -I../../src/include/mozilla_chardet/xpcom -I../../src/include/mozilla_chardet/xpcom/base -I../../src/include/mozilla_chardet/xpcom/glue -ansi -DTIXML_USE_STL -O2 -ffast-math -DCB_AUTOCONF -g -O2 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT annoyingdialog.lo -MD -MP -MF $depbase.Tpo -c -o annoyingdialog.lo annoyingdialog.cpp &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../src/include -I/mingw64/lib/wx/include/msw-unicode-3.1 -I/mingw64/include/wx-3.1 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMSW__ -I../../src/include -I../../src/sdk/wxscintilla/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 -I../../src/include/mozilla_chardet/mfbt -I../../src/include/mozilla_chardet/nsprpub/pr/include -I../../src/include/mozilla_chardet/xpcom -I../../src/include/mozilla_chardet/xpcom/base -I../../src/include/mozilla_chardet/xpcom/glue -ansi -DTIXML_USE_STL -O2 -ffast-math -DCB_AUTOCONF -g -O2 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT annoyingdialog.lo -MD -MP -MF .deps/annoyingdialog.Tpo -c annoyingdialog.cpp -DDLL_EXPORT -DPIC -o .libs/annoyingdialog.o
annoyingdialog.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
/*
^
annoyingdialog.cpp:10:25: warning: ../../src/include/sdk_precomp.h.gch: not used because `DLL_EXPORT' is defined [-Winvalid-pch]
In file included from C:/tools/msys2/mingw64/include/wx-3.1/wx/window.h:18:0,
from C:/tools/msys2/mingw64/include/wx-3.1/wx/msw/private.h:26,
from C:/tools/msys2/mingw64/include/wx-3.1/wx/wxprec.h:33,
from ../../src/include/sdk_common.h:37,
from ../../src/include/sdk_precomp.h:13,
from annoyingdialog.cpp:10:
C:/tools/msys2/mingw64/include/wx-3.1/wx/event.h:3983:34: warning: 'AnnoyingDialog::sm_eventTable' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
const wxEventTable theClass::sm_eventTable = \
^
C:/tools/msys2/mingw64/include/wx-3.1/wx/event.h:4397:56: note: in expansion of macro 'wxBEGIN_EVENT_TABLE'
#define BEGIN_EVENT_TABLE(a,b) wxBEGIN_EVENT_TABLE(a,b)
^
annoyingdialog.cpp:26:1: note: in expansion of macro 'BEGIN_EVENT_TABLE'
BEGIN_EVENT_TABLE(AnnoyingDialog, wxScrollingDialog)
^
annoyingdialog.cpp:26:19: warning: 'virtual const wxEventTable* AnnoyingDialog::GetEventTable() const' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
BEGIN_EVENT_TABLE(AnnoyingDialog, wxScrollingDialog)
^
<< >>
<< loads of warnings about deprecated virtual void functions >>
<< >>
^
In file included from C:/tools/msys2/mingw64/include/wx-3.1/wx/window.h:18:0,
from C:/tools/msys2/mingw64/include/wx-3.1/wx/msw/private.h:26,
from C:/tools/msys2/mingw64/include/wx-3.1/wx/wxprec.h:33,
from ../../src/include/sdk_common.h:37,
from ../../src/include/sdk_precomp.h:13,
from annoyingdialog.cpp:10:
annoyingdialog.cpp: In member function 'virtual const wxEventTable* AnnoyingDialog::GetEventTable() const':
annoyingdialog.cpp:26:19: error: definition of static data member 'AnnoyingDialog::sm_eventTable' of dllimport'd class
BEGIN_EVENT_TABLE(AnnoyingDialog, wxScrollingDialog)
^
C:/tools/msys2/mingw64/include/wx-3.1/wx/event.h:3983:24: note: in definition of macro 'wxBEGIN_EVENT_TABLE'
const wxEventTable theClass::sm_eventTable = \
^
annoyingdialog.cpp:26:1: note: in expansion of macro 'BEGIN_EVENT_TABLE'
BEGIN_EVENT_TABLE(AnnoyingDialog, wxScrollingDialog)
^
annoyingdialog.cpp: In member function 'virtual wxEventHashTable& AnnoyingDialog::GetEventHashTable() const':
annoyingdialog.cpp:26:19: error: definition of static data member 'AnnoyingDialog::sm_eventHashTable' of dllimport'd class
BEGIN_EVENT_TABLE(AnnoyingDialog, wxScrollingDialog)
^
C:/tools/msys2/mingw64/include/wx-3.1/wx/event.h:3987:22: note: in definition of macro 'wxBEGIN_EVENT_TABLE'
wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \
^
annoyingdialog.cpp:26:1: note: in expansion of macro 'BEGIN_EVENT_TABLE'
BEGIN_EVENT_TABLE(AnnoyingDialog, wxScrollingDialog)
^
Makefile:948: recipe for target 'annoyingdialog.lo' failed
make[3]: *** [annoyingdialog.lo] Error 1
make[3]: Leaving directory '/home/amwink/codeblocks-dev/src/sdk'
Makefile:969: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/amwink/codeblocks-dev/src/sdk'
Makefile:455: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/amwink/codeblocks-dev/src'
Makefile:495: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
That's basically what I'm doing in Msys2:
$ gcc -v
Using built-in specs.
COLLECT_GCC=C:\tools\msys2\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/tools/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-5.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --with-gxx-include-dir=/mingw64/include/c++/5.2.0 --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-version-specific-runtime-libs --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev3, Built by MSYS2 project' --with-bugurl=http://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 5.2.0 (Rev3, Built by MSYS2 project)
$ gdb -v
GNU gdb (GDB) 7.9.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Just to report, configuring wxWidgets with --prefix=/mingw64 --enable-compat28
before building did not solve the issue. The build of C::B stops with the same error at the same line.
I'm not sure if the problem is with how wxWidgets was coded / built or C::B?
Many thanks for that!
In the meantime I am compiling wxWidgets with more options for 'configure':
--enable-shared --enable-unicode --enable-opengl --enable-monolithic
Options that are set via a Makefile.gcc in the Windows compilation guide of C::B -- I only have 'configure' though.
Many thanks for that!
In the meantime I am compiling wxWidgets with more options for 'configure':
--enable-shared --enable-unicode --enable-opengl --enable-monolithic
Options that are set via a Makefile.gcc in the Windows compilation guide of C::B -- I only have 'configure' though.
These options are almost positively required
--enable-shared --enable-unicode
Note: wxWidgets should default to having "--enable-unicode" as if it was on.
The option "--enable-opengl" is NOT required; but, a very good idea.
No idea on whether "--enable-monolithic" is required; but, I would guess it is NOT required and wxWidgets master tends to be broken from time to time on using that option.
Tim S.
Scouring all previous posts and manuals for options, I used this for building wxWidgets
configure --prefix=/mingw64 \
--enable-compat28 --enable-xrc --enable-shared --enable-monolithic --disable-debug \
--enable-unicode --enable-vendor=cb --disable-universal --enable-tooltips --enable-dnd \
--with-opengl \
CFLAGS='-fno-keep-inline-dllexport' \
CXXFLAGS='-fno-keep-inline-dllexport'
But the same DLL-related things are still causing problems even with all those options.
I have tried
cd ../wxWidgets-dev/
make distclean
configure --prefix=/mingw64 \
--disable-shared --enable-static --enable-compat28 --enable-xrc --enable-monolithic --disable-debug \
--enable-unicode --enable-vendor=cb --disable-universal --enable-tooltips --enable-dnd \
--with-opengl
updatedb & make && make install
cd ../codeblocks-dev/
./bootstrap
./configure --with-wx-config=`which wx-config`
make
To see if it would work with wxWidgets compiled as a static library, but it still stops at the Annoying Dialog (same place) complaining about static members.
Out of ideas.
I have compiled https://github.com/jrfonseca/drmingw (https://github.com/jrfonseca/drmingw) in Msys2, which includes a exchndl DLL.
In Msys2 64-bit I did
git clone https://github.com/jrfonseca/drmingw.git
cd drmingw/
mkdir build
cd build
cmake .. -G "MSYS Makefiles"
make
which produces a DLL file bin/exchndl.dll that I'm more than happy to share.