From: "Jonathan Underwood" <jonathan.underwood@gmail.com>
To: gsl-discuss@sources.redhat.com
Subject: Patch for compilation for a mingw32 host
Date: Sat, 07 Jul 2007 23:16:00 -0000 [thread overview]
Message-ID: <645d17210707071615m9ad98b9j2776a0a63213dc51@mail.gmail.com> (raw)
[-- 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
next reply other threads:[~2007-07-07 23:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-07 23:16 Jonathan Underwood [this message]
2007-07-10 21:04 ` Brian Gough
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=645d17210707071615m9ad98b9j2776a0a63213dc51@mail.gmail.com \
--to=jonathan.underwood@gmail.com \
--cc=gsl-discuss@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).