Error Compiling wxwidgets-3.1.3 on windows10 with mingw compiler Topic is solved

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
gismo
Earned a small fee
Earned a small fee
Posts: 12
Joined: Thu Mar 12, 2020 10:48 pm

Error Compiling wxwidgets-3.1.3 on windows10 with mingw compiler

Post by gismo » Thu Mar 12, 2020 11:50 pm

I'm running Window 10 Pro, 64 bit, I downloaded C::B with the Mingw32 compiler and installed C::B and the compiler, set the path for the compiler. Next I downloaded the wxWidgets-3.1.3 (1).7z and unzipped it in C:\wxwidgets-3.1.3.and used the command prompt build as follows:

Code: Select all

C:\wxWidgets-3.1.3\build\msw>mingw32-make -f makefile.gcc BUILD=release SHARED=1 UNICODE=1 
It all seems to compile till it get to the end when it attempts to build wxmsw323ud_gcc_custom.dll

Code: Select all

g++ -shared -fPIC -o ..\..\lib\gcc_dll\wxmsw313ud_gcc_custom.dll @..\..\lib\gcc_dll\wxmsw313ud_gcc_custom.dll.rsp  -g -mthreads -L..\..\lib\gcc_dll -Wl,--out-implib=..\..\lib\gcc_dll\libwxmsw31ud.a    -lwxtiffd -lwxjpegd -lwxpngd   -lwxzlibd -lwxregexud -lwxexpatd   -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lwsock32 -lwininet -loleacc -luxtheme      ..\..\lib\gcc_dll\libwxscintillad.a
..\..\lib\gcc_dll/libwxexpatd.a(wxexpat_xmlparse.o): In function `writeRandomBytes_rand_s':
C:\wxWidgets-3.1.3\build\msw/../../src/expat/expat/lib/xmlparse.c:758: undefined reference to `_imp__rand_s'
collect2.exe: error: ld returned 1 exit status
makefile.gcc:5329: recipe for target '..\..\lib\gcc_dll\wxmsw313ud_gcc_custom.dll' failed
mingw32-make: *** [..\..\lib\gcc_dll\wxmsw313ud_gcc_custom.dll] Error 1 
I'm a newbie and have been struggling with this for several days. I would really appreciate some help. Thanks

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

Re: Error Compiling wxwidgets-3.1.3 on windows10 with mingw compiler

Post by doublemax » Fri Mar 13, 2020 12:06 am

Which exact version of MinGW are you using?

A common problem is to have multiple different toolchains in your PATH variable. Double check this.

You can also try to make sure that the path to the compiler is set to be first:
viewtopic.php?p=197005#p197005

Also try to run the command with "clean" at the end first.
Use the source, Luke!

stahta01
Super wx Problem Solver
Super wx Problem Solver
Posts: 365
Joined: Fri Nov 03, 2006 2:00 pm

Re: Error Compiling wxwidgets-3.1.3 on windows10 with mingw compiler

Post by stahta01 » Fri Mar 13, 2020 1:38 am

I am guessing wxWidgets expat bug likely was fixed by

Code: Select all

 expat/lib/xmlparse.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c
index bb56e59..d8e1f3d 100644
--- a/expat/lib/xmlparse.c
+++ b/expat/lib/xmlparse.c
@@ -737,9 +737,11 @@ writeRandomBytes_arc4random(void *target, size_t count) {
 #ifdef _WIN32
 
 /* Provide declaration of rand_s() for MinGW-32 (not 64, which has it),
-   as it doesn't declare it in its header up to at least 5.2.2 version
-   of its runtime package (mingwrt, containing stdlib.h). */
-#  if defined(__MINGW32__) && ! defined(__MINGW64_VERSION_MAJOR)
+   as it didn't declare it in its header prior to version 5.3.0 of its
+   runtime package (mingwrt, containing stdlib.h).  The upstream fix
+   was introduced at https://osdn.net/projects/mingw/ticket/39658 . */
+#  if defined(__MINGW32__) && defined(__MINGW32_VERSION)                       \
+      && __MINGW32_VERSION < 5003000L && ! defined(__MINGW64_VERSION_MAJOR)
 __declspec(dllimport) int rand_s(unsigned int *);
 #  endif
 

Post Reply