How to install the latest wxWidgets on Ubuntu

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
kagi3624
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed Feb 26, 2020 8:13 am

How to install the latest wxWidgets on Ubuntu

Post by kagi3624 » Sat Feb 29, 2020 11:56 am

Hello, all my previous attempts to get it running failed. Today I reinstalled Ubuntu 18.04 and I would like to know how I should proceed with the wxwidgets installation? Earlier I tried to compile it from source, and it was successful but I couldn't compile the minimal example because some libs were missing. The wiki instructions to install it from the binaries seems outdated (2.8) so what is the correct way to install wxwidgets on Ubuntu..

Thanks a lot.

User avatar
doublemax
Moderator
Moderator
Posts: 14613
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to install the latest wxWidgets on Ubuntu

Post by doublemax » Sat Feb 29, 2020 12:53 pm

Earlier I tried to compile it from source, and it was successful...
That's good. What command line did you use?
...but I couldn't compile the minimal example because some libs were missing.
What command line did you use (it should have been the same as above), and what errors do you get?
Use the source, Luke!

DavidHart
Site Admin
Site Admin
Posts: 3940
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: How to install the latest wxWidgets on Ubuntu

Post by DavidHart » Sat Feb 29, 2020 1:28 pm

Hi,
>...but I couldn't compile the minimal example because some libs were missing.
What command line did you use (it should have been the same as above)...
Well, not normally.

The initial 'configure' of the wx source also configures the samples. So, given a successful build and install, all that should be needed is to cd into samples/minimal dir and run 'make'.

Regards,

David

kagi3624
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed Feb 26, 2020 8:13 am

Re: How to install the latest wxWidgets on Ubuntu

Post by kagi3624 » Sat Feb 29, 2020 4:58 pm

Here is my other thread.

viewtopic.php?f=19&t=46879

DavidHart
Site Admin
Site Admin
Posts: 3940
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: How to install the latest wxWidgets on Ubuntu

Post by DavidHart » Sat Feb 29, 2020 5:17 pm

Yes, I saw it. But did you try doing what I suggested above? That would mean you are trying to build a properly-configured sample, and it has a much greater chance of succeeding.

kagi3624
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed Feb 26, 2020 8:13 am

Re: How to install the latest wxWidgets on Ubuntu

Post by kagi3624 » Sat Feb 29, 2020 5:36 pm

Hello DavidHart...it works if I follow the example except I have to leave out the 'make clean' line!

DavidHart
Site Admin
Site Admin
Posts: 3940
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: How to install the latest wxWidgets on Ubuntu

Post by DavidHart » Sat Feb 29, 2020 5:52 pm

.it works if I follow the example
'example' being the wxWiki page mentioned in the other thread?

If so, and iiuc, you just did what I suggested; and it works. So you know that you have a working wxWidgets installation. Now you 'just' need to decide how to use that installation to build your code. There are several ways, starting with doing things in a terminal e.g.:
g++ -g foo.cpp bar.cpp $(wx-config --cxxflags --libs all) -o baz
as the simplest;
up to the most complex: using a makefile generator like Cmake.

Or am I misunderstanding the situation?

kagi3624
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed Feb 26, 2020 8:13 am

Re: How to install the latest wxWidgets on Ubuntu

Post by kagi3624 » Sat Feb 29, 2020 5:59 pm

Yes, exactly! Though I don't understand why "make clean" destroys the linking to the library. I will look into the examples now and other tutorials :D

kagi3624
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed Feb 26, 2020 8:13 am

Re: How to install the latest wxWidgets on Ubuntu

Post by kagi3624 » Sat Feb 29, 2020 7:59 pm

DavidHart wrote:
Sat Feb 29, 2020 5:52 pm
There are several ways, starting with doing things in a terminal e.g.:
g++ -g foo.cpp bar.cpp $(wx-config --cxxflags --libs all) -o baz
Hey David, I tried to compile a simple example with this command, just an empty window but I get a numerous "undefined reference to" notices and an error

Code: Select all

/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x568): undefined reference to `wxWindowBase::DoSetSizeHints(int, int, int, int, int, int)'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x570): undefined reference to `wxWindow::DoGetBorderSize() const'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x578): undefined reference to `wxWindow::DoMoveWindow(int, int, int, int)'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x580): undefined reference to `wxWindowBase::DoCentre(int)'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x588): undefined reference to `wxWindow::DoSetToolTip(wxToolTip*)'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x590): undefined reference to `wxWindow::DoPopupMenu(wxMenu*, int, int)'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x598): undefined reference to `wxWindowBase::AdjustForParentClientOrigin(int&, int&, int) const'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x5a0): undefined reference to `wxWindowBase::DoSetWindowVariant(wxWindowVariant)'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x5a8): undefined reference to `wxWindow::DoFreeze()'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x5b0): undefined reference to `wxWindow::DoThaw()'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x5b8): undefined reference to `wxWindow::GetConnectWidget()'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x5c0): undefined reference to `wxWindow::GTKProcessEvent(wxEvent&) const'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x5c8): undefined reference to `wxWindow::GTKHandleRealized()'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x5d8): undefined reference to `wxWindow::GTKWidgetNeedsMnemonic() const'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x5e0): undefined reference to `wxWindow::GTKWidgetDoSetMnemonic(_GtkWidget*)'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x5e8): undefined reference to `wxWindow::GTKGetWindow(wxArrayGdkWindows&) const'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x5f0): undefined reference to `wxWindow::GTKApplyToolTip(char const*)'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x600): undefined reference to `wxWindow::GTKIMFilterKeypress(_GdkEventKey*) const'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x608): undefined reference to `wxWindow::DoApplyWidgetStyle(_GtkRcStyle*)'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV21wxMDIClientWindowBase[_ZTV21wxMDIClientWindowBase]+0x618): undefined reference to `wxWindow::AddChildGTK(wxWindow*)'
/tmp/ccD3iSeV.o: In function `wxObjectEventFunctor::~wxObjectEventFunctor()':
/usr/local/include/wx-3.0/wx/event.h:219: undefined reference to `wxEventFunctor::~wxEventFunctor()'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTV20wxThreadHelperThread[_ZTV20wxThreadHelperThread]+0x10): undefined reference to `wxThread::TestDestroy()'
/tmp/ccD3iSeV.o: In function `wxThreadHelperThread::~wxThreadHelperThread()':
/usr/local/include/wx-3.0/wx/thread.h:662: undefined reference to `wxThread::~wxThread()'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTI9MainFrame[_ZTI9MainFrame]+0x10): undefined reference to `typeinfo for wxFrame'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTI7MainApp[_ZTI7MainApp]+0x10): undefined reference to `typeinfo for wxApp'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTI21wxMDIClientWindowBase[_ZTI21wxMDIClientWindowBase]+0x10): undefined reference to `typeinfo for wxWindow'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTI20wxMDIParentFrameBase[_ZTI20wxMDIParentFrameBase]+0x10): undefined reference to `typeinfo for wxFrame'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTI20wxObjectEventFunctor[_ZTI20wxObjectEventFunctor]+0x10): undefined reference to `typeinfo for wxEventFunctor'
/tmp/ccD3iSeV.o:(.data.rel.ro._ZTI20wxThreadHelperThread[_ZTI20wxThreadHelperThread]+0x10): undefined reference to `typeinfo for wxThread'
Is there still something missing in the compiler command?

DavidHart
Site Admin
Site Admin
Posts: 3940
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: How to install the latest wxWidgets on Ubuntu

Post by DavidHart » Sat Feb 29, 2020 9:02 pm

Can you copy/paste to here the exact command you used (I doubt if you are really calling your files foo.cpp etc).

And also paste the result of doing, in the same terminal:
wx-config --libs all

kagi3624
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed Feb 26, 2020 8:13 am

Re: How to install the latest wxWidgets on Ubuntu

Post by kagi3624 » Sat Feb 29, 2020 9:41 pm

I found the error...I was using a single - instead of double -- with libs :roll:

kagi3624
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed Feb 26, 2020 8:13 am

Re: How to install the latest wxWidgets on Ubuntu

Post by kagi3624 » Sun Mar 01, 2020 5:48 am

Hello again,

what do I need to crosscompile programs in ubuntu for windows? I wanted to follow a tutorial but it seems rather outdated. It says to install mingw32 but there is no such package for Ubuntu. Is there maybe an up to date tutorial? Thx

DavidHart
Site Admin
Site Admin
Posts: 3940
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: How to install the latest wxWidgets on Ubuntu

Post by DavidHart » Sun Mar 01, 2020 7:41 am

No idea. If searching the forum doesn't provide an answer, I suggest you start a new topic.

LsDevs
Knows some wx things
Knows some wx things
Posts: 31
Joined: Fri Feb 28, 2020 8:23 am

Re: How to install the latest wxWidgets on Ubuntu

Post by LsDevs » Sun Mar 01, 2020 11:29 am

kagi3624 wrote:
Sun Mar 01, 2020 5:48 am
Hello again,

what do I need to crosscompile programs in ubuntu for windows? I wanted to follow a tutorial but it seems rather outdated. It says to install mingw32 but there is no such package for Ubuntu. Is there maybe an up to date tutorial? Thx
Hi,
You need to download wxWidgets last sources, MinGW-64 and :
- cd to the wxWidgets-3.1.0 top directory.
- mkdir build-win, cd build-win
- ../configure --disable-debug_flag --host=x86_64-w64-mingw32 --build=x86_64-linux-gnu
- make

Now if you want to cross compile just use :

Code: Select all

x86_64-w64-mingw32-g++ *.cpp -o out.exe `PATH/TO/wxIDGETS/build_win/wx-config --cxxflags` `PATH/TO/wxIDGETS/build_win/wx-config --libs`
If you want static library use --disbale-shared too

Following viewtopic.php?t=44108

kagi3624
Earned a small fee
Earned a small fee
Posts: 14
Joined: Wed Feb 26, 2020 8:13 am

Re: How to install the latest wxWidgets on Ubuntu

Post by kagi3624 » Sun Mar 01, 2020 8:00 pm

hello LsDvs, I figured out how to crosscompile, but I have two questions, what does --disable-debug_flag do, is it necessary? And even though I disabled shared libraries I still got missing dll errors (libstdc++-6.dll and libgcc_s_seh-1.dll ) while launching the .exe in windows.

Sorry for asking same question in some other thread.

Post Reply