public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* Patch for compilation for a mingw32 host
@ 2007-07-07 23:16 Jonathan Underwood
  2007-07-10 21:04 ` Brian Gough
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Underwood @ 2007-07-07 23:16 UTC (permalink / raw)
  To: gsl-discuss

[-- Attachment #1: Type: text/plain, Size: 2812 bytes --]

Hi,

I have recently been cross compiling GSL shared libraries (DLLs) on a
linux machine for a mingw32msvc host, and needed to use the attached
patch to make this work. I believe this patch would also be
useful/needed if you were simply compiling inside MSYS/mingw32, or
with cygwin and the -mno-cygwin option - I haven't tried either of
these things though. Without this patch it is not possible to build a
shared library for this host. n explanation follows.

The following are specific to mingw32 (i.e. Windows) hosts. Windows
does not allow DLLs with undefined symbols and so we need the
-no-undefined options for GCC. We also need to link against the
gslcblas library to resolve the cblas symbols. This means it is then
probably not possible to drop in a replacement cblas library at
runtime. To use a different cblas library, it is probably necessary to
link it at build time unless the alternative library is ABI
compatible.

Note that in principle, libtool should add the -no-undefined option if
it detects mingw is the host arch, but at this point in time libtool
doesn't (at least for 1.5.22) and the libtool developers recommend
adding it manually. I expect this will get fixed in a later release of
libtool.

These patches have (hopefully) been put together in such a way as they
won't impact building for any other host arch.

Best wishes,
Jonathan.

diff -ru gsl-1.9/cblas/Makefile.am gsl-1.9-mingw/cblas/Makefile.am
--- gsl-1.9/cblas/Makefile.am   2004-09-11 14:45:09.000000000 +0100
+++ gsl-1.9-mingw/cblas/Makefile.am     2007-07-08 00:05:00.000000000 +0100
@@ -1,6 +1,11 @@
 lib_LTLIBRARIES = libgslcblas.la
 libgslcblas_la_LDFLAGS = -version-info $(GSL_LT_CBLAS_VERSION)

+MINGW32_HOST = @MINGW32_HOST@
+if MINGW32_HOST
+libgslcblas_la_LDFLAGS += -no-undefined
+endif
+
 pkginclude_HEADERS = gsl_cblas.h

 INCLUDES= -I$(top_srcdir)
diff -ru gsl-1.9/configure.ac gsl-1.9-mingw/configure.ac
--- gsl-1.9/configure.ac        2007-02-20 13:08:16.000000000 +0000
+++ gsl-1.9-mingw/configure.ac  2007-07-08 00:04:38.000000000 +0100
@@ -89,6 +89,14 @@

 dnl Checks for typedefs, structures, and compiler characteristics.

+case "$host_os" in
+     *mingw*)
+       MINGW=true
+       ;;
+esac
+
+AM_CONDITIONAL(MINGW32_HOST, test "$MINGW" = "true")
+
 dnl Checks for library functions.

 dnl AC_FUNC_ALLOCA
diff -ru gsl-1.9/Makefile.am gsl-1.9-mingw/Makefile.am
--- gsl-1.9/Makefile.am 2006-11-02 17:50:01.000000000 +0000
+++ gsl-1.9-mingw/Makefile.am   2007-07-08 00:04:45.000000000 +0100
@@ -21,6 +21,12 @@
 libgsl_la_LDFLAGS = -version-info $(GSL_LT_VERSION)
 noinst_HEADERS = templates_on.h templates_off.h

+MINGW32_HOST = @MINGW32_HOST@
+if MINGW32_HOST
+libgsl_la_LIBADD += cblas/libgslcblas.la
+libgsl_la_LDFLAGS += -no-undefined
+endif
+
 m4datadir = $(datadir)/aclocal
 m4data_DATA = gsl.m4

[-- Attachment #2: gsl-1.9-mingw-host.patch --]
[-- Type: text/x-patch, Size: 1428 bytes --]

diff -ru gsl-1.9/cblas/Makefile.am gsl-1.9-mingw/cblas/Makefile.am
--- gsl-1.9/cblas/Makefile.am	2004-09-11 14:45:09.000000000 +0100
+++ gsl-1.9-mingw/cblas/Makefile.am	2007-07-08 00:05:00.000000000 +0100
@@ -1,6 +1,11 @@
 lib_LTLIBRARIES = libgslcblas.la
 libgslcblas_la_LDFLAGS = -version-info $(GSL_LT_CBLAS_VERSION)
 
+MINGW32_HOST = @MINGW32_HOST@
+if MINGW32_HOST
+libgslcblas_la_LDFLAGS += -no-undefined
+endif
+
 pkginclude_HEADERS = gsl_cblas.h
 
 INCLUDES= -I$(top_srcdir)
diff -ru gsl-1.9/configure.ac gsl-1.9-mingw/configure.ac
--- gsl-1.9/configure.ac	2007-02-20 13:08:16.000000000 +0000
+++ gsl-1.9-mingw/configure.ac	2007-07-08 00:04:38.000000000 +0100
@@ -89,6 +89,14 @@
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 
+case "$host_os" in
+     *mingw*)
+	MINGW=true
+	;;
+esac
+
+AM_CONDITIONAL(MINGW32_HOST, test "$MINGW" = "true")
+
 dnl Checks for library functions.
 
 dnl AC_FUNC_ALLOCA
diff -ru gsl-1.9/Makefile.am gsl-1.9-mingw/Makefile.am
--- gsl-1.9/Makefile.am	2006-11-02 17:50:01.000000000 +0000
+++ gsl-1.9-mingw/Makefile.am	2007-07-08 00:04:45.000000000 +0100
@@ -21,6 +21,12 @@
 libgsl_la_LDFLAGS = -version-info $(GSL_LT_VERSION)
 noinst_HEADERS = templates_on.h templates_off.h
 
+MINGW32_HOST = @MINGW32_HOST@
+if MINGW32_HOST
+libgsl_la_LIBADD += cblas/libgslcblas.la
+libgsl_la_LDFLAGS += -no-undefined
+endif
+
 m4datadir = $(datadir)/aclocal
 m4data_DATA = gsl.m4
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Patch for compilation for a mingw32 host
  2007-07-07 23:16 Patch for compilation for a mingw32 host Jonathan Underwood
@ 2007-07-10 21:04 ` Brian Gough
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Gough @ 2007-07-10 21:04 UTC (permalink / raw)
  To: Jonathan Underwood; +Cc: gsl-discuss

Thanks for the suggestion. I have applied the patch.

-- 
Brian Gough

Network Theory Ltd,
Publishing Free Software Manuals --- http://www.network-theory.co.uk/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-10 21:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-07 23:16 Patch for compilation for a mingw32 host Jonathan Underwood
2007-07-10 21:04 ` Brian Gough

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).