Ok, I give up, time to ask for help.
I've written a fairly simple telnet plugin for Codeblocks. I have a Linux version and a windows version of this plugin, which both seem to work when compiled natively from the same source. I'm trying to collapse both of these projects into one project so that I don't have to have seperate development environments; this means cross compiling the plugin for windows on Linux using mingw32. As an initial test, I'm trying to cross compile a stock plugin; that is, what comes out of the "create plugin wizard", in codeblocks v13-12.
Here are the wiki/forum pages I've been following:
http://forums.codeblocks.org/index.php/topic,3343.75.htmlwiki.codeblocks.org/index.php?title=Cross_Compiling_wxWidgets_Applications_on_Linux
After following the instructions, and employing whatever other minor fixes google can dig up for me, this is the command line I've generated.
Compiler Call
i586-mingw32msvc-g++ -ansi -g
##generated from compiler build option `pkg-config --cflags codeblocks`
-I/usr/local/include/codeblocks
-I/usr/local/include/codeblocks/tinyxml
-I/usr/local/include/codeblocks/scripting/include
-I/usr/local/include/codeblocks/scripting/bindings
-I/usr/local/include/codeblocks/scripting/sqplus
-I/usr/local/include/codeblocks/wxscintilla/include
##generated from compiler build option `/home/micron/pico_projects/codeblocks/wxWidgets-2.8.12_windows_crossCompile/wx-config --cflags --host=i586-mingw32msvc --static`
-I/home/micron/pico_projects/codeblocks/wxWidgets-2.8.12_windows_crossCompile/lib/wx/include/i586-mingw32msvc-msw-unicode-release-static-2.8
-I/home/micron/pico_projects/codeblocks/wxWidgets-2.8.12_windows_crossCompile/include
-I/home/micron/pico_projects/codeblocks/wxWidgets-2.8.12_windows_crossCompile/contrib/include
##explicitly listed, or listed in global compiler settings
-D__WXMSW__ -mthreads -U__STRICT_ANSI__ -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -DSTRICT -DHAVE_W32API_H -D__WXMSW__ -D__WINDOWS__
-I/usr/i586-mingw32msvc/include
-c
/home/micron/pico_projects/codeblocks/source/bullshitprojects/bullshitCrossCompilePlugin2/BullshitCrosscompilePlugin2.cpp -o .objs/BullshitCrosscompilePlugin2.o
Linker
i586-mingw32msvc-g++ -shared .objs/BullshitCrosscompilePlugin2.o -o BullshitCrosscompilePlugin2.dll
##generated from linker build option `/home/micron/pico_projects/codeblocks/wxWidgets-2.8.12_windows_crossCompile/wx-config --libs --host=i586-mingw32msvc --static`
-L/usr/i586-mingw32msvc/lib
-L/home/micron/pico_projects/codeblocks/wxWidgets-2.8.12_windows_crossCompile/lib -mthreads -Wl,--subsystem,windows -mwindows
/home/micron/pico_projects/codeblocks/wxWidgets-2.8.12_windows_crossCompile/lib/libwx_mswu_richtext-2.8-i586-mingw32msvc.a
/home/micron/pico_projects/codeblocks/wxWidgets-2.8.12_windows_crossCompile/lib/libwx_mswu_aui-2.8-i586-mingw32msvc.a
/home/micron/pico_projects/codeblocks/wxWidgets-2.8.12_windows_crossCompile/lib/libwx_mswu_xrc-2.8-i586-mingw32msvc.a
/home/micron/pico_projects/codeblocks/wxWidgets-2.8.12_windows_crossCompile/lib/libwx_mswu_qa-2.8-i586-mingw32msvc.a
/home/micron/pico_projects/codeblocks/wxWidgets-2.8.12_windows_crossCompile/lib/libwx_mswu_html-2.8-i586-mingw32msvc.a
/home/micron/pico_projects/codeblocks/wxWidgets-2.8.12_windows_crossCompile/lib/libwx_mswu_adv-2.8-i586-mingw32msvc.a
/home/micron/pico_projects/codeblocks/wxWidgets-2.8.12_windows_crossCompile/lib/libwx_mswu_core-2.8-i586-mingw32msvc.a
/home/micron/pico_projects/codeblocks/wxWidgets-2.8.12_windows_crossCompile/lib/libwx_baseu_xml-2.8-i586-mingw32msvc.a
/home/micron/pico_projects/codeblocks/wxWidgets-2.8.12_windows_crossCompile/lib/libwx_baseu_net-2.8-i586-mingw32msvc.a
/home/micron/pico_projects/codeblocks/wxWidgets-2.8.12_windows_crossCompile/lib/libwx_baseu-2.8-i586-mingw32msvc.a
-lwxregexu-2.8-i586-mingw32msvc -lwxexpat-2.8-i586-mingw32msvc -lwxtiff-2.8-i586-mingw32msvc -lwxjpeg-2.8-i586-mingw32msvc -lwxpng-2.8-i586-mingw32msvc -lwxzlib-2.8-i586-mingw32msvc
-lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32
##generated from linker build option`pkg-config --libs codeblocks`
[b]-L/usr/local/lib -lcodeblocks[/b]
##listed in global linker settings
-lstdc++ -lgcc -lodbc32 -lwsock32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lodbc32 -lwsock32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid
The
/home/micron/pico_projects/codeblocks/wxWidgets-2.8.12_windows_crossCompile directory is where I've installed a cross compiled wxWidgets... I skipped the install step of that installation so that it wouldn't conflict with my natively compiled widgets installation. As such, I call a local wx-config rather than the system wx-config.
Having done all that, I get the following error when attempting a compile
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/bin/ld: cannot find -lcodeblocks
The mingw linker is looking for libcodeblocks.a;
/usr/local/lib includes copies of libcodeblocks.so and libcodeblocks.la, but not libcodeblocks.a... I can manually specify a directory with libcodeblocks.a (built via
./configure --enable-static)... if I do that, these are the errors I get;
.objs/BullshitCrosscompilePlugin2.o: In function `BullshitCrosscompilePlugin2':
/home/micron/pico_projects/codeblocks/source/bullshitprojects/bullshitCrossCompilePlugin2/BullshitCrosscompilePlugin2.cpp:13: undefined reference to `__imp___ZN12cbToolPluginC2Ev'
/home/micron/pico_projects/codeblocks/source/bullshitprojects/bullshitCrossCompilePlugin2/BullshitCrosscompilePlugin2.cpp:18: undefined reference to `__imp___ZN7Manager12LoadResourceERK8wxString'
/home/micron/pico_projects/codeblocks/source/bullshitprojects/bullshitCrossCompilePlugin2/BullshitCrosscompilePlugin2.cpp:13: undefined reference to `__imp___ZN12cbToolPluginC2Ev'
/home/micron/pico_projects/codeblocks/source/bullshitprojects/bullshitCrossCompilePlugin2/BullshitCrosscompilePlugin2.cpp:18: undefined reference to `__imp___ZN7Manager12LoadResourceERK8wxString'
.objs/BullshitCrosscompilePlugin2.o: In function `PluginRegistrant':
/usr/local/include/codeblocks/cbplugin.h:901: undefined reference to `__imp___ZN7Manager3GetEv'
/usr/local/include/codeblocks/cbplugin.h:901: undefined reference to `__imp___ZNK7Manager16GetPluginManagerEv'
/usr/local/include/codeblocks/cbplugin.h:901: undefined reference to `__imp___ZN13PluginManager14RegisterPluginERK8wxStringPFP8cbPluginvEPFvS4_EPFvPiS9_S9_E'
.objs/BullshitCrosscompilePlugin2.o: In function `~cbToolPlugin':
/usr/local/include/codeblocks/cbplugin.h:665: undefined reference to `__imp___ZTV12cbToolPlugin'
/usr/local/include/codeblocks/cbplugin.h:665: undefined reference to `__imp___ZN8cbPluginD2Ev'
.objs/BullshitCrosscompilePlugin2.o: In function `_Z17NotifyMissingFileRK8wxString':
/usr/local/include/codeblocks/globals.h:329: undefined reference to `__imp___Z12cbMessageBoxRK8wxStringS1_iP8wxWindowii'
.objs/BullshitCrosscompilePlugin2.o:BullshitCrosscompilePlugin2.cpp:(.rdata$_ZTV27BullshitCrosscompilePlugin2[vtable for BullshitCrosscompilePlugin2]+0x78): undefined reference to `cbPlugin::NotImplemented(wxString const&) const'
collect2: ld returned 1 exit status
At this point I'm stuck. These look like mangled names to me, but libcodeblocks.a does contain references to cbToolPlugin at least... I can guess that libcodeblocks.a doesn't create entry points with mangled names, but I don't know why my application would expect mangled names. I'm also not cross compiling libcodeblocks.a, and it seems like that is unlikely to work if libcodeblocks.a is referencing linux libraries, but I can't find instructions on how to cross compile the codeblocks executable... simply following the style described for cross compiling wxWidgets did not work.
Can someone point me at a guide for cross compiling the codeblocks executable? Or else, tell me what other thing I'm doing wrong?