std library - poco compilation problem mingw - fedora10

Richard W.M. Jones rjones at redhat.com
Sat Nov 8 11:33:25 UTC 2008


On Sat, Nov 08, 2008 at 10:35:17AM +0000, Richard W.M. Jones wrote:
> I gather that you didn't write Poco's build system, but you need to go
> back and find out why it's including this.  Probably (as demonstrated
> by the MinGW / Cygwin confusion above), Poco either hasn't been ported
> to MinGW, or needs some different options to compile under a true
> MinGW cross-compiler.

I had a closer look at Poco, and the problem is the latter: Poco have
made the mistake of beliving that they can hand-roll a build system
which is better than autoconf, and as with everyone who tries that
they've ended up with something which is both worse and unfamiliar.

(Still, at least it's not as bad as what Boost did.  Oh my, their
hand-rolled build system is a tremendous example of fail).

This was my best shot at a patch for Poco 'economy' 1.3.3p1:

(a) Copy build/config/MinGW to build/config/MinGW-cross
(b) Apply the attached patches, in order
(c) ./configure --config=MinGW-cross
(d) make

(This builds plausible-looking DLLs and binaries - I didn't test
whether they worked.)

**Please submit the patches back** to Poco's upstream for inclusion in
future releases.

Since Poco is a development tool / library under a free license, this
is something that is suitable for inclusion in the Fedora MinGW
project.  You would need to get sponsored[1] if you aren't already,
and submit a review request[2] for it.  This way, we can share
maintenance tasks for it, and you get a supported, up to date version
in Fedora itself.

Rich.

[1] http://fedoraproject.org/wiki/PackageMaintainers/HowToGetSponsored
[2] http://fedoraproject.org/wiki/PackageMaintainers/Join

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
Read my OCaml programming blog: http://camltastic.blogspot.com/
Fedora now supports 68 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
-------------- next part --------------
NB. Copy build/config/MinGW to build/config/MinGW-cross before
applying this patch.

--- build/config/MinGW	2008-10-09 17:11:22.000000000 +0100
+++ build/config/MinGW-cross	2008-11-08 11:12:16.000000000 +0000
@@ -16,14 +16,15 @@
 #
 # Define Tools
 #
-CC      = gcc
-CXX     = g++
+CC      = i686-pc-mingw32-gcc
+CXX     = i686-pc-mingw32-g++
 LINK    = $(CXX)
-LIB     = ar -cr
-RANLIB  = ranlib
-SHLIB   = $(CXX) -shared -mno-cygwin -o $@ -Wl,--out-implib=$(dir $@)$(subst cyg,lib,$(basename $(notdir $@))).a
+LIB     = i686-pc-mingw32-ar -cr
+#RANLIB  = i686-pc-mingw32-ranlib
+RANLIB  = :
+SHLIB   = $(CXX) -shared -o $@ -Wl,--out-implib=$(dir $@)$(subst cyg,lib,$(basename $(notdir $@))).dll.a
 SHLIBLN = $(POCO_BASE)/build/script/shlibln
-STRIP   = strip
+STRIP   = i686-pc-mingw32-strip
 DEP     = $(POCO_BASE)/build/script/makedepend.gcc 
 SHELL   = sh
 RM      = rm -rf
@@ -36,7 +37,10 @@
 SHAREDLIBEXT     = .dll
 SHAREDLIBLINKEXT = .dll
 
-BINEXT          = .exe
+# RWMJ: They do, but only if you specify -o foo.exe.  I see now
+# way to do that, so instead pretend that they don't have the .exe
+# extension.
+#BINEXT          = .exe
 
 #
 # Compiler and Linker Flags
@@ -66,9 +70,12 @@
 #
 # System Specific Flags
 #
-SYSFLAGS = -mno-cygwin -D_WIN32 -DMINGW32 -DWINVER=0x500 -DPOCO_NO_FPENVIRONMENT -DPCRE_STATIC -DPOCO_THREAD_STACK_SIZE -DFoundation_Config_INCLUDED -I/usr/local/include -I/usr/include
+SYSFLAGS = -D_WIN32 -DMINGW32 -DWINVER=0x500 -DPOCO_NO_FPENVIRONMENT -DPCRE_STATIC -DPOCO_THREAD_STACK_SIZE -DFoundation_Config_INCLUDED
 
 #
 # System Specific Libraries
 #
-SYSLIBS  = -L/usr/local/lib -L/usr/lib -liphlpapi -lws2_32 -lssl -lcrypto -lws2_32 -lgdi32
+# RWMJ: Not clear why, but for some reason the linker cannot find
+# the SSL and libcrypto libraries using just -lssl -lcrypto. (XXX)
+SSLLIBS = /usr/i686-pc-mingw32/sys-root/mingw/lib/libssl.dll.a /usr/i686-pc-mingw32/sys-root/mingw/lib/libcrypto.dll.a
+SYSLIBS  = -liphlpapi -lws2_32 $(SSLLIBS) -lws2_32 -lgdi32
-------------- next part --------------
--- Foundation/Makefile.orig	2008-11-08 11:03:03.000000000 +0000
+++ Foundation/Makefile	2008-11-08 11:03:26.000000000 +0000
@@ -40,8 +40,12 @@
 ifeq ($(POCO_CONFIG),MinGW)
 	objects += EventLogChannel WindowsConsoleChannel
 else
+ifeq ($(POCO_CONFIG),MinGW-cross)
+	objects += EventLogChannel WindowsConsoleChannel
+else
 	objects += SyslogChannel
 endif
+endif
 
 target         = PocoFoundation
 target_version = $(LIBVERSION)
--- Util/Makefile.orig	2008-11-08 11:26:18.000000000 +0000
+++ Util/Makefile	2008-11-08 11:26:44.000000000 +0000
@@ -17,7 +17,10 @@
 	Validator IntValidator RegExpValidator OptionCallback
 
 ifeq ($(POCO_CONFIG),MinGW)
-	objects += WinService 
+	objects += WinService
+endif
+ifeq ($(POCO_CONFIG),MinGW-cross)
+	objects += WinService
 endif
 
 target         = PocoUtil
-------------- next part --------------
--- Foundation/src/Environment_WIN32.cpp.orig	2008-11-08 10:45:23.000000000 +0000
+++ Foundation/src/Environment_WIN32.cpp	2008-11-08 10:45:49.000000000 +0000
@@ -173,7 +173,7 @@
 			{
 				if (pAdapter->Type == MIB_IF_TYPE_ETHERNET && pAdapter->AddressLength == sizeof(id))
 				{
-					std::memcpy(&id, pAdapter->Address, pAdapter->AddressLength);
+					memcpy(&id, pAdapter->Address, pAdapter->AddressLength);
 					found = true;
 				}
 				pAdapter = pAdapter->Next;


More information about the mingw mailing list