wxCurl linker problems Topic is solved

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
4ggre5510n
Earned a small fee
Earned a small fee
Posts: 12
Joined: Sat Jan 14, 2012 10:34 pm

wxCurl linker problems

Post by 4ggre5510n »

Greetings!

I have successfully compiled wxWidgets as monolithic:
SHARED=1 MONOLITHIC=1 BUILD=release

And also successfully compiled wxCode with:
SHARED=1 MONOLITHIC=1 BUILD=release WX_DEBUG=0

I am using Code::Blocks with MinGW ( gcc version 4.4.1 (TDM-2 mingw32) ) under Windows 7.

Linker includes both libraries created by makefile.gcc from wxCurl.

My current linker settings:
-mthreads
-lwxmsw29u
-lcurl
-lwxcode_msw29u_wxcurl
-lwxcode_msw29ud_wxcurl

Yet still, it fails to compile wxCurl code sample.

Console log:
-C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\panel.h|18|warning: type attributes ignored after type is already defined|
C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\panel.h|19|warning: type attributes ignored after type is already defined|
C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\panel.h|20|warning: type attributes ignored after type is already defined|
C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\panel.h|21|warning: type attributes ignored after type is already defined|
C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\dialog.h|19|warning: type attributes ignored after type is already defined|
C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\dialog.h|20|warning: type attributes ignored after type is already defined|
C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\dialog.h|21|warning: type attributes ignored after type is already defined|
C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\dialog.h|22|warning: type attributes ignored after type is already defined|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.cpp|405|undefined reference to `_imp___ZN20wxCurlTransferDialog8RunModalEv'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.cpp|463|undefined reference to `_imp___ZN20wxCurlTransferDialog8RunModalEv'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.cpp|473|undefined reference to `_imp___ZN10wxCurlBaseC1ERK8wxStringS2_S2_P12wxEvtHandleril'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.cpp|473|undefined reference to `_imp___ZN10wxCurlBaseD1Ev'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.cpp|473|undefined reference to `_imp___ZN10wxCurlBaseD1Ev'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.cpp|474|undefined reference to `_imp___ZN30wxCurlConnectionSettingsDialog8RunModalEP10wxCurlBase'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.cpp|481|undefined reference to `_imp___ZNK10wxCurlBase12GetProxyPortEv'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.cpp|481|undefined reference to `_imp___ZNK10wxCurlBase16GetProxyPasswordEv'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.cpp|481|undefined reference to `_imp___ZNK10wxCurlBase16GetProxyUsernameEv'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.cpp|481|undefined reference to `_imp___ZNK10wxCurlBase12GetProxyHostEv'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.cpp|481|undefined reference to `_imp___ZNK10wxCurlBase8UseProxyEv'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.cpp|481|undefined reference to `_imp___ZNK10wxCurlBase7GetPortEv'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.cpp|481|undefined reference to `_imp___ZNK10wxCurlBase11GetPasswordEv'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.cpp|481|undefined reference to `_imp___ZNK10wxCurlBase11GetUsernameEv'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.cpp|481|undefined reference to `_imp___ZN10wxCurlBaseD1Ev'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.cpp|481|undefined reference to `_imp___ZN10wxCurlBaseD1Ev'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.o||In function `wxCurlTransferDialog':|
C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\dialog.h|74|undefined reference to `_imp___ZTV20wxCurlTransferDialog'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.o||In function `~wxCurlTransferDialog':|
C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\dialog.h|101|undefined reference to `_imp___ZTV20wxCurlTransferDialog'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.o||In function `wxCurlDownloadDialog':|
C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\dialog.h|220|undefined reference to `_imp___ZTV20wxCurlDownloadDialog'|
C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\dialog.h|220|undefined reference to `_imp___ZN20wxCurlDownloadDialog6CreateERK8wxStringP14wxOutputStreamS2_S2_RK8wxBitmapP8wxWindowl'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.o||In function `wxCurlUploadDialog':|
C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\dialog.h|262|undefined reference to `_imp___ZTV18wxCurlUploadDialog'|
C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\dialog.h|262|undefined reference to `_imp___ZN18wxCurlUploadDialog6CreateERK8wxStringP13wxInputStreamS2_S2_RK8wxBitmapP8wxWindowl'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.o||In function `wxCurlConnectionSettingsDialog':|
C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\dialog.h|298|undefined reference to `_imp___ZTV30wxCurlConnectionSettingsDialog'|
C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\dialog.h|298|undefined reference to `_imp___ZN30wxCurlConnectionSettingsDialog6CreateERK8wxStringS2_P8wxWindowl'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.o||In function `~wxCurlDownloadDialog':|
C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\dialog.h|209|undefined reference to `_imp___ZTV20wxCurlDownloadDialog'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.o||In function `~wxCurlUploadDialog':|
C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\dialog.h|251|undefined reference to `_imp___ZTV18wxCurlUploadDialog'|
C:\Users\g_uteQ1137\Desktop\wxcurl\samples\dialogs\minimal.o||In function `~wxCurlConnectionSettingsDialog':|
C:\Users\g_uteQ1137\Desktop\wxcurl\include\wx\curl\dialog.h|290|undefined reference to `_imp___ZTV30wxCurlConnectionSettingsDialog'|
||=== Build finished: 27 errors, 8 warnings (0 minutes, 2 seconds) ===|
I will appreciate your help!
Best regards!


@EDIT
I've actually discovered possible (?) reason for linking failure: wxCurl expects WX_SHARED flag rather then "SHARED". So it didn't build .dll file, and as so failed later to link with dll wxWidgets build *

So, Ive tried to compile wxCurl with proper WX_SHARED=1 flag.

Yet I've encountered numerous linking errors while compiling just libcurl itself.

He is the command I used:
mingw32-make -f makefile.gcc WX_SHARED=1 WX_MONOLITHIC=1 WX_DEBUG=0
And the errors (after some successful compiling .c into .o) :
Creating library file: ..\lib\libcurl.a
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0x217): undefined reference to `_imp__ldap_err2stringA'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0x258): undefined reference to `_imp__ldap_msgfree'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0x284): undefined reference to `_imp__ldap_unbind_s'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0x604): undefined reference to `_imp__ldap_set_optionA'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0x64d): undefined reference to `_imp__ldap_simple_bind_sA'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0x69e): undefined reference to `_imp__ldap_search_sA'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0x6bb): undefined reference to `_imp__ldap_err2stringA'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0x742): undefined reference to `_imp__ldap_err2stringA'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0x7a1): undefined reference to `_imp__ldap_set_optionA'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0x7b9): undefined reference to `_imp__ldap_initA'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0x7f4): undefined reference to `_imp__ldap_first_entry'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0x82e): undefined reference to `_imp__ldap_get_dnA'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0x8c0): undefined reference to `_imp__ldap_first_attributeA'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0x8e6): undefined reference to `_imp__ldap_get_values_lenA'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0xaa0): undefined reference to `_imp__ldap_value_free_len'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0xaed): undefined reference to `_imp__ldap_memfreeA'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0xb07): undefined reference to `_imp__ldap_next_attributeA'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0xb1e): undefined reference to `_imp__ldap_memfreeA'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0xb36): undefined reference to `_imp__ber_free'
mingw\libcurl_dll_ldap.o:ldap.c:(.text+0xb49): undefined reference to `_imp__ldap_next_entry'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [..\lib\libcurl.dll] Error 1
However, none of these errors occurs, if I build with WX_SHARED=0...

I will greatly appreciate your help!

* I have two builds of wxWidgets in same directory. Makefile created non-dll, while IDE later tried to connect with the other wxWidgets build.
4ggre5510n
Earned a small fee
Earned a small fee
Posts: 12
Joined: Sat Jan 14, 2012 10:34 pm

Re: wxCurl linker problems

Post by 4ggre5510n »

Solved.

There were three problems, one was mine:
- I confused non-shared build with the .dll one.

And two because of invalid makefiles:
- There was missing linker "-lwldap32" flag in thirdparty/curl/build/makefile.gcc ( solved by setting LDFLAGS ?= -lwldap32 into either wxCurl or curl makefile.gcc )
- wxCurl makefile.gcc couldn't actually link with MONOLITHIC build of wxWidgets. There are no flags or options properly invoking linker with single wxWidgets library. Solved by manually removing non-existent (in MONOLITHIC build) libraries from makefile.

Maybe some wxCurl dev would like to look into this :]
caseyodonnell
Knows some wx things
Knows some wx things
Posts: 31
Joined: Fri Sep 10, 2004 1:03 pm
Location: Troy, NY
Contact:

Re: wxCurl linker problems

Post by caseyodonnell »

Well... :) I guess as the original wxCurl person I should look into this, right?

From what I can tell, the solution is that we need to shift the mingw32-make to do the following, right?

Code: Select all

mingw32-make -f makefile.gcc WX_SHARED=1 LDFLAGS=-lwldap32
I'm not a MingGW person, so I'll take your word for this. :)

Casey
samsam598
Super wx Problem Solver
Super wx Problem Solver
Posts: 340
Joined: Mon Oct 06, 2008 12:55 pm

Re: wxCurl linker problems

Post by samsam598 »

I encountered the same problem before under windows with MinGW.What I did is very stupid:build both monolithic and non-monolithic version of wx,that is :

Code: Select all

mingw32-make -f makefile.gcc BUILD=release SHARED=0 UNICODE=1 MONOLITHIC=0 2>errlog.txt
mingw32-make -f makefile.gcc BUILD=release SHARED=0 UNICODE=1 MONOLITHIC=1 2>errlog.txt
Since then I build the wxCurl sample without any problems.

My 1 cent.
Regards,
Sam
-------------------------------------------------------------------
Windows 10 64bit
VS Community 2019
msys2-mingw13.2.0 C::B character set: UTF-8/GBK(Chinese)
wxWidgets 3.3/3.2.4 Unicode Mono Static gcc static build
samsam598
Super wx Problem Solver
Super wx Problem Solver
Posts: 340
Joined: Mon Oct 06, 2008 12:55 pm

Re: wxCurl linker problems

Post by samsam598 »

caseyodonnell wrote:Well... :) I guess as the original wxCurl person I should look into this, right?

From what I can tell, the solution is that we need to shift the mingw32-make to do the following, right?

Code: Select all

mingw32-make -f makefile.gcc WX_SHARED=1 LDFLAGS=-lwldap32
I'm not a MingGW person, so I'll take your word for this. :)

Casey
When I tried to build the most recent wx2.9.x with MinGW4.7.1 + -std=gnu++11,it is fine;but after that when I tried to build wxCurl lib with the same compiler(regardless has option -std=gnu++11 or not),it failed,saying that somewhere in the src 'isnan' does not defined in that scope bla;but if I changed to MinGW4.5 without -std=gnu+11,everyting goes fine.

Appreciated for the solution,I really wanna turn to c++11 with wx.
Regards,
Sam
-------------------------------------------------------------------
Windows 10 64bit
VS Community 2019
msys2-mingw13.2.0 C::B character set: UTF-8/GBK(Chinese)
wxWidgets 3.3/3.2.4 Unicode Mono Static gcc static build
Post Reply