Page 1 of 2

Build wxFreeChart and using it in Code::Blocks

Posted: Tue May 29, 2018 8:41 pm
by nona
Hi,
I need help with my task. I downloaded a zip file of wxFreeChart and extract it the info says I should be inside build dir and run these commands:

Installation - win32
--------------------

When building on win32, you can use the makefiles in the BUILD folder using the
WX_DIR, WX_DEBUG, WX_UNICODE and WX_SHARED to match your wxWidgets build.
Examples:

> nmake -fmakefile.vc WX_DIR=c:\path\to\my\wxWidgets WX_UNICODE=0/1 WX_DEBUG=0/1 WX_SHARED=0/1 WX_MONOLITHIC=0/1
> make -fmakefile.bcc WX_DIR=c:\path\to\my\wxWidgets WX_UNICODE=0/1 WX_DEBUG=0/1 WX_SHARED=0/1 WX_MONOLITHIC=0/1

But I got error nmake is not recognized. so I change it to mingw32-make -fmakefile.gcc but I still get errors:

----------------------------------------------------------------------------
The selected wxWidgets build is not available!
Please use the options prefixed with WX_ to select another wxWidgets build.
----------------------------------------------------------------------------
mingw32-make: *** [makefile.gcc:321: test_for_selected_wxbuild] Error 1

Can any one help me please?

Re: Build wxFreeChart and using it in Code::Blocks

Posted: Wed May 30, 2018 11:57 am
by xaviou
Hi
nona wrote:But I got error nmake is not recognized. so I change it to mingw32-make -fmakefile.gcc but I still get errors:
This is the right thing.
But the others command line options must match the ones you've used to build your version of wxWidgets.

Did you build your libs or did you download them ?
Regards
Xav'

Re: Build wxFreeChart and using it in Code::Blocks

Posted: Wed May 30, 2018 12:29 pm
by PB
Unless you are using obsolete wxWidgets 2.8, you also need to set the wxWidgets version, e.g.
WX_VERSION=31 for wxWidgets 3.1. The other options you may need to set are (taken from the GCC makefile)

Code: Select all

# Use DLL build of wx library? [0,1]
WX_SHARED ?= 0

# Use Unicode build of wxWidgets? [0,1]
WX_UNICODE ?= 0

# Use debug build of wxWidgets (define __WXDEBUG__)? [0,1]
WX_DEBUG ?= 1

# Version of the wx library to build against. 
WX_VERSION ?= 28

# Use monolithic build of wxWidgets? [0,1]
WX_MONOLITHIC ?= 0

# The directory where wxWidgets library is installed 
WX_DIR ?= $(WXWIN)

# Build this wxCode component as DLL or as static library? [0,1]
SHARED ?= 0
Also post the full command line you used and what wxWidgets build(s) you have.


BTW, where did you get the sources from? Here you can find wxFreeChart where I changed some things (from the version from wxCode) so it works better with recent (3+) wxWidget versions: https://github.com/PBfordev/wxFreeChart. In the linked repo description there is also a link to a version which should include even more updates and improvements.

Re: Build wxFreeChart and using it in Code::Blocks

Posted: Wed May 30, 2018 4:44 pm
by nona
xaviou wrote:Hi
nona wrote:But I got error nmake is not recognized. so I change it to mingw32-make -fmakefile.gcc but I still get errors:
This is the right thing.
But the others command line options must match the ones you've used to build your version of wxWidgets.

Did you build your libs or did you download them ?
Regards
Xav'
So I did that:

C:\wxFreeChart\build>mingw32-make -f makefile.gcc WX_DIR=C:\wxWidgets-3.0.4 SHARED=1 UNICODE=1 BUILD=release

the same like I build my wxWidgets but I still getting error:

----------------------------------------------------------------------------
The selected wxWidgets build is not available!
Please use the options prefixed with WX_ to select another wxWidgets build.
----------------------------------------------------------------------------
mingw32-make: *** [makefile.gcc:345: test_for_selected_wxbuild] Error 1

Re: Build wxFreeChart and using it in Code::Blocks

Posted: Wed May 30, 2018 4:45 pm
by nona
PB wrote:Unless you are using obsolete wxWidgets 2.8, you also need to set the wxWidgets version, e.g.
WX_VERSION=31 for wxWidgets 3.1. The other options you may need to set are (taken from the GCC makefile)

Code: Select all

# Use DLL build of wx library? [0,1]
WX_SHARED ?= 0

# Use Unicode build of wxWidgets? [0,1]
WX_UNICODE ?= 0

# Use debug build of wxWidgets (define __WXDEBUG__)? [0,1]
WX_DEBUG ?= 1

# Version of the wx library to build against. 
WX_VERSION ?= 28

# Use monolithic build of wxWidgets? [0,1]
WX_MONOLITHIC ?= 0

# The directory where wxWidgets library is installed 
WX_DIR ?= $(WXWIN)

# Build this wxCode component as DLL or as static library? [0,1]
SHARED ?= 0
Also post the full command line you used and what wxWidgets build(s) you have.


BTW, where did you get the sources from? Here you can find wxFreeChart where I changed some things (from the version from wxCode) so it works better with recent (3+) wxWidget versions: https://github.com/PBfordev/wxFreeChart. In the linked repo description there is also a link to a version which should include even more updates and improvements.

I am using wxWidgets 3.0.4 and build it using:
mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=release

Re: Build wxFreeChart and using it in Code::Blocks

Posted: Wed May 30, 2018 5:04 pm
by PB
nona wrote:I am using wxWidgets 3.0.4 and build it using:
mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=release
Well, then the command line should be

Code: Select all

mingw32-make -f makefile.gcc WX_SHARED=1 WX_UNICODE=1 WX_DEBUG=0 WX_VERSION=30
If your WXWIN environment variable is not set properly you also need either to set it or use WX_DIR parameter when building wxFreeChart. If you want to build wxFreeChart as a DLL, you also need to add SHARED=1

Re: Build wxFreeChart and using it in Code::Blocks

Posted: Wed May 30, 2018 5:30 pm
by nona
PB wrote:
nona wrote:I am using wxWidgets 3.0.4 and build it using:
mingw32-make -f makefile.gcc SHARED=1 UNICODE=1 BUILD=release
Well, then the command line should be

Code: Select all

mingw32-make -f makefile.gcc WX_SHARED=1 WX_UNICODE=1 WX_DEBUG=0 WX_VERSION=30
If your WXWIN environment variable is not set properly you also need either to set it or use WX_DIR parameter when building wxFreeChart. If you want to build wxFreeChart as a DLL, you also need to add SHARED=1
Thanks for the quick reply. I run it and I think it started to build after I added WX_DIR=C:\wxWidgets-3.0.4 but at the end I got that:

Code: Select all

g++ -shared -fPIC -o ..\lib\gcc_dll\wxcode_msw30u_freechart.dll gccmswu\wxfreechart_dll_legend.o gccmswu\wxfreechart_dll_pieplot.o gccmswu\wxfreechart_dll_art.o gccmswu\wxfreechart_dll_multiplot.o gccmswu\wxfreechart_dll_ganttdataset.o gccmswu\wxfreechart_dll_ganttsimpledataset.o gccmswu\wxfreechart_dll_ganttplot.o gccmswu\wxfreechart_dll_ganttrenderer.o gccmswu\wxfreechart_dll_tooltips.o gccmswu\wxfreechart_dll_plot.o gccmswu\wxfreechart_dll_renderer.o gccmswu\wxfreechart_dll_title.o gccmswu\wxfreechart_dll_barrenderer.o gccmswu\wxfreechart_dll_barplot.o gccmswu\wxfreechart_dll_marker.o gccmswu\wxfreechart_dll_chart.o gccmswu\wxfreechart_dll_labelaxis.o gccmswu\wxfreechart_dll_logarithmicnumberaxis.o gccmswu\wxfreechart_dll_compdateaxis.o gccmswu\wxfreechart_dll_juliandateaxis.o gccmswu\wxfreechart_dll_axis.o gccmswu\wxfreechart_dll_numberaxis.o gccmswu\wxfreechart_dll_categoryaxis.o gccmswu\wxfreechart_dll_dateaxis.o gccmswu\wxfreechart_dll_axisplot.o gccmswu\wxfreechart_dll_areadraw.o gccmswu\wxfreechart_dll_bubbleplot.o gccmswu\wxfreechart_dll_xyzdataset.o gccmswu\wxfreechart_dll_xyzrenderer.o gccmswu\wxfreechart_dll_polynom.o gccmswu\wxfreechart_dll_sinefunction.o gccmswu\wxfreechart_dll_timeseriesdataset.o gccmswu\wxfreechart_dll_xyplot.o gccmswu\wxfreechart_dll_xyarearenderer.o gccmswu\wxfreechart_dll_xydynamicdataset.o gccmswu\wxfreechart_dll_vectordataset.o gccmswu\wxfreechart_dll_xyhistorenderer.o gccmswu\wxfreechart_dll_xyrenderer.o gccmswu\wxfreechart_dll_xydataset.o gccmswu\wxfreechart_dll_xysimpledataset.o gccmswu\wxfreechart_dll_xylinerenderer.o gccmswu\wxfreechart_dll_juliantimeseriesdataset.o gccmswu\wxfreechart_dll_ohlcsimpledataset.o gccmswu\wxfreechart_dll_ohlcrenderer.o gccmswu\wxfreechart_dll_ohlcbarrenderer.o gccmswu\wxfreechart_dll_ohlcplot.o gccmswu\wxfreechart_dll_ohlccandlestickrenderer.o gccmswu\wxfreechart_dll_movingaverage.o gccmswu\wxfreechart_dll_ohlcdataset.o gccmswu\wxfreechart_dll_categorydataset.o gccmswu\wxfreechart_dll_categoryrenderer.o gccmswu\wxfreechart_dll_categorysimpledataset.o gccmswu\wxfreechart_dll_symbol.o gccmswu\wxfreechart_dll_dataset.o gccmswu\wxfreechart_dll_chartsplitpanel.o gccmswu\wxfreechart_dll_colorscheme.o gccmswu\wxfreechart_dll_zoompan.o gccmswu\wxfreechart_dll_crosshair.o gccmswu\wxfreechart_dll_chartpanel.o  -mthreads -LC:\wxWidgets-3.0.4\lib\gcc_dll  -L..\lib\gcc_dll -Wl,--out-implib=..\lib\gcc_dll\libwxcode_msw30u_freechart.a   -lwxmsw30u_core -lwxbase30u -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lodbc32
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x5e5): undefined reference to `wxAuiPaneButtonArray::operator=(wxAuiPaneButtonArray const&)'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x61e): undefined reference to `wxAuiPaneInfo::IsValid() const'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x671): undefined reference to `wxAuiPaneButtonArray::~wxAuiPaneButtonArray()'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x910): undefined reference to `wxAuiPaneButtonArray::operator=(wxAuiPaneButtonArray const&)'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x971): undefined reference to `wxAuiPaneInfo::IsValid() const'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x9c6): undefined reference to `wxAuiPaneButtonArray::~wxAuiPaneButtonArray()'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0xc67): undefined reference to `wxAuiPaneButtonArray::operator=(wxAuiPaneButtonArray const&)'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0xcaf): undefined reference to `wxAuiPaneInfo::IsValid() const'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0xd04): undefined reference to `wxAuiPaneButtonArray::~wxAuiPaneButtonArray()'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0xf10): undefined reference to `wxAuiPaneButtonArray::operator=(wxAuiPaneButtonArray const&)'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0xf46): undefined reference to `wxAuiPaneInfo::IsValid() const'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0xf99): undefined reference to `wxAuiPaneButtonArray::~wxAuiPaneButtonArray()'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x1225): undefined reference to `wxAuiPaneButtonArray::operator=(wxAuiPaneButtonArray const&)'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x1269): undefined reference to `wxAuiPaneButtonArray::~wxAuiPaneButtonArray()'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x12da): undefined reference to `wxAuiManager::AddPane(wxWindow*, wxAuiPaneInfo const&)'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x12e8): undefined reference to `wxAuiManager::Update()'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x12f9): undefined reference to `wxAuiPaneButtonArray::~wxAuiPaneButtonArray()'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x145d): undefined reference to `wxAuiPaneButtonArray::operator=(wxAuiPaneButtonArray const&)'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x15a6): undefined reference to `wxAuiPaneButtonArray::operator=(wxAuiPaneButtonArray const&)'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x16bf): undefined reference to `wxAuiPaneButtonArray::operator=(wxAuiPaneButtonArray const&)'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x1806): undefined reference to `wxAuiPaneButtonArray::operator=(wxAuiPaneButtonArray const&)'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x190c): undefined reference to `wxAuiPaneButtonArray::~wxAuiPaneButtonArray()'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x199a): undefined reference to `wxAuiPaneButtonArray::~wxAuiPaneButtonArray()'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x1a5a): undefined reference to `wxAuiPaneButtonArray::~wxAuiPaneButtonArray()'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x1a6c): undefined reference to `wxAuiPaneButtonArray::~wxAuiPaneButtonArray()'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x1ae5): undefined reference to `wxAuiPaneButtonArray::~wxAuiPaneButtonArray()'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x1b09): more undefined references to `wxAuiPaneButtonArray::~wxAuiPaneButtonArray()' follow
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x1e37): undefined reference to `wxAuiManager::wxAuiManager(wxWindow*, unsigned int)'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text+0x1e47): undefined reference to `wxAuiManager::Update()'
gccmswu\wxfreechart_dll_chartsplitpanel.o:chartsplitpanel.cpp:(.text$_ZN13wxAuiPaneInfoD1Ev[__ZN13wxAuiPaneInfoD1Ev]+0xd): undefined reference to `wxAuiPaneButtonArray::~wxAuiPaneButtonArray()'
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [makefile.gcc:364: ..\lib\gcc_dll\wxcode_msw30u_freechart.dll] Error 1
Is my build went successfully or not and how can I know?

Re: Build wxFreeChart and using it in Code::Blocks

Posted: Wed May 30, 2018 6:43 pm
by ONEEYEMAN
Hi,
No, you build is not successful as you have errors.

Thank you.

Re: Build wxFreeChart and using it in Code::Blocks

Posted: Wed May 30, 2018 7:08 pm
by PB
nona wrote:Is my build went successfully or not and how can I know?
You can tell your build failed because of the log you posted, see the error listed there and the exit status.

All the issues are related to wxAUI. I tested it myself and got the same result you got. Looking at the GCC makefile I noticed that the AUI library was missing from the list of wxWidgets libraries. When I fixed this*, I could build wxFreeChart successfully.

I also noticed one other thing, SHARED does not work as advertised. It should default to 0, i.e., when not used the static library should be built. However, if I did not use it or set it to 0, a DLL was built. When I set it to 1, it seemed a DLL was still attempted to be built, although in a wrongly named directory.

*Quick hack: in build/makefile.gcc, at line 364, starting with $(CXX) $(LINK_DLL_FLAGS) -fPIC -o [email protected] $(WXFREECHART_DLL_OBJECTS)I added $(__WXLIB_AUI_NAME_p) between $(LDFLAGS) and $(__WXLIB_CORE_NAME_p)

Re: Build wxFreeChart and using it in Code::Blocks

Posted: Wed May 30, 2018 7:29 pm
by nona
PB wrote:
nona wrote:Is my build went successfully or not and how can I know?
You can tell your build failed because of the log you posted, see the error listed there and the exit status.

All the issues are related to wxAUI. I tested it myself and got the same result you got. Looking at the GCC makefile I noticed that the AUI library was missing from the list of wxWidgets libraries. When I fixed this*, I could build wxFreeChart successfully.

I also noticed one other thing, SHARED does not work as advertised. It should default to 0, i.e., when not used the static library should be built. However, if I did not use it or set it to 0, a DLL was built. When I set it to 1, it seemed a DLL was still attempted to be built, although in a wrongly named directory.

*Quick hack: in build/makefile.gcc, at line 364, starting with $(CXX) $(LINK_DLL_FLAGS) -fPIC -o [email protected] $(WXFREECHART_DLL_OBJECTS)I added $(__WXLIB_AUI_NAME_p) between $(LDFLAGS) and $(__WXLIB_CORE_NAME_p)

Many thanks PB for replaying my questions.
So I need to set SHARED=0 instead of 1

Re: Build wxFreeChart and using it in Code::Blocks

Posted: Wed May 30, 2018 7:33 pm
by ONEEYEMAN
Hi,
Don't forget to rebuild wxWidgets with SHARED=0.
The 2 configurations must match.

Thank you.

Re: Build wxFreeChart and using it in Code::Blocks

Posted: Wed May 30, 2018 7:55 pm
by PB
nona wrote:So I need to set SHARED=0 instead of 1
As I wrote above, while this (WX_SHARED=1 with SHARED=0) was probably intended to work but it actually does not. The static build of wxFreeChart seems to be produced only with wxWidgets static build.

However, as you built wxWidgets in shared (DLL) mode, you may as well build wxFreeChart the same way.

Re: Build wxFreeChart and using it in Code::Blocks

Posted: Wed May 30, 2018 9:38 pm
by nona
ONEEYEMAN wrote:Hi,
Don't forget to rebuild wxWidgets with SHARED=0.
The 2 configurations must match.

Thank you.
Thank you that worked fine :)

Re: Build wxFreeChart and using it in Code::Blocks

Posted: Wed May 30, 2018 9:39 pm
by nona
PB wrote:
nona wrote:So I need to set SHARED=0 instead of 1
As I wrote above, while this (WX_SHARED=1 with SHARED=0) was probably intended to work but it actually does not. The static build of wxFreeChart seems to be produced only with wxWidgets static build.

However, as you built wxWidgets in shared (DLL) mode, you may as well build wxFreeChart the same way.[/quot

Thank you! I built it successfully :)

Re: Build wxFreeChart and using it in Code::Blocks

Posted: Wed May 30, 2018 9:41 pm
by nona
I am sorry that I keep asking I am still very new in this. but now I am using Code::Blocks how to use wxFreeChart with it?