GTK : build failure with wxLog

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.
Post Reply
raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 419
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

GTK : build failure with wxLog

Post by raananb » Wed Jan 08, 2020 9:41 am

Using wxWidgets 3.1.3 under Ubuntu 18.04/GTK2 to build my application fails (both for GTKDebug and GTKRelease) with the following message:

Makefile:130: recipe for target 'GTKDebug/AccountsManager' failed
*** /home/raanan/wxWidgets/GCCBuildReleaseGTK2Unicode/lib/libwx_gtk2u_webview-3.1.a(webviewlib_gtk_webview_webkit.o): In function `wxWebViewWebKit::RunScript(wxString const&, wxString*)':

*** webview_webkit.cpp:(.text+0x309f): undefined reference to `wxLog::GetComponentLevel(wxString)'
*** collect2: error: ld returned 1 exit status
*** make: *** [GTKDebug/AccountsManager] Error 1


wx/log.h is included in webview-webkit.cpp as well as in webview-webkit2.cpp

libwx_gtk2u_webview-3.1.a exists.

'make' lines 129/130:

$(OUTPUTPATH)/$(PROGRAM): $(OBJECTS) $(EXTRADEPENDENCIES)
$(LINKER) -o [email protected] $(OBJECTS) $(LDFLAGS)

What needs to be done to get rid of this error?

Edit: the same application code works in Windows 10 & OSX Catalina

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

Re: GTK : build failure with wxLog

Post by DavidHart » Wed Jan 08, 2020 9:54 am

Hi,
What needs to be done to get rid of this error?
That's hard to guess. Ways to approach the problem include:

1) This is presumably a self-built static-linking wx3.1.3. What happens if you create a separate dynamic-linking wx build, as that is what is used 99% of the time on Linux; does your program build successfully against that?
2) Does the 'webview' sample build and run successfully? If so, what does your code do that's different?
3) If neither of those suggestions help, please create and post a minimal program that demonstrates the problem; perhaps an adaptation of the 'webview' sample.

Regards,

David

raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 419
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: GTK : build failure with wxLog

Post by raananb » Wed Jan 08, 2020 2:07 pm

Thanks for the quick reply.

wxWidgets is built using DialogBlocks with the settings below, which I am not sure how to link to your first comment.

Image

The webview sample runs ok as far as I could judge, but does not do what I am doing, and which works on Windows and OSX: I create a browser and load a URL, then when the document loads, I extract the data I need from the page.

I tried to narrow down the issue, and it is raised by the statement below:

m_browser = wxWebView::New(this, wxID_ANY, wxEmptyString);

The error message cites webview_webkit.cpp as the source of the problem, but this file has an #include "wx/log.h" statement up front, and that is where GetComponentLevel(wxString) is declared.

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

Re: GTK : build failure with wxLog

Post by DavidHart » Wed Jan 08, 2020 2:48 pm

which I am not sure how to link to your first comment.
Change the third setting, 'Shared mode', to (presumably) Dynamic; then rebuild.

The 'webview' sample does:
m_browser = wxWebView::New(this, wxID_ANY, url);

In your code, 'url' is "". Maybe that causes the problem. You can easily find out by altering the sample, replacing 'url' with "". Or by altering your code, replacing wxEmptyString with e.g. "https://www.google.com".

raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 419
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: GTK : build failure with wxLog

Post by raananb » Wed Jan 08, 2020 5:45 pm

Changing the third setting generated a DLL, with new errors:

Makefile:130: recipe for target 'GTKRelease/AccountsManager' failed
*** /usr/bin/ld: /home/raanan/wxWidgets-3.1.3/GCCBuildReleaseGTK2UnicodeDLL/lib/libwx_gtk2u_core-3.1.so: undefined reference to symbol 'gtk_widget_set_sensitive'

*** //usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0: error adding symbols: DSO missing from command line
*** collect2: error: ld returned 1 exit status
*** make: *** [GTKRelease/AccountsManager] Error 1

Creating the browser with a non-empty url makes no difference.

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

Re: GTK : build failure with wxLog

Post by DavidHart » Wed Jan 08, 2020 7:24 pm

Changing the third setting generated a DLL, with new errors:

Makefile:130: recipe for target 'GTKRelease/AccountsManager' failed
*** /usr/bin/ld: /home/raanan/wxWidgets-3.1.3/GCCBuildReleaseGTK2UnicodeDLL/lib/libwx_gtk2u_core-3.1.so: undefined reference to symbol 'gtk_widget_set_sensitive'
*** //usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0: error adding symbols: DSO missing from command line
A quick google of the error messages suggests that D::B is getting the order of the libs wrong: see e.g.
this thread. Why not build wx from a terminal? It's easy: just do, in the wx source dir:

Code: Select all

mkdir dynamic-build && cd dynamic-build
../configure --enable-debug --prefix=`pwd`
make -j<no-of-cores>
No need to 'make install'. Instead, use the resulting build by using /full/path/to/its/wx-config, which you will presumably put in D::B's compiler and linker settings.
Creating the browser with a non-empty url makes no difference.
I've run out of guesses. You need to find a way of reproducing the problem in a minimal program, which you can then post. However doing so risks you finding the cause of the error yourself ;) .

Post Reply