[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] Locating gcc runtime dlls
From: |
Greg Chicares |
Subject: |
[lmi] Locating gcc runtime dlls |
Date: |
Tue, 30 May 2017 16:08:10 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
Vadim--To distribute lmi to msw end users, we must include the compiler's
runtime DLLs. Shouldn't there be a convenient and robust way to find them
in a gcc installation, so that they can be copied for redistribution?
I tried to find such a way in the patch below, hoping that I could make it
independent of
- compiler version
- host bit width (32 vs. 64)
- exception model (sjlj vs. seh)
- build machine (cygwin vs. debian)
If I could only find gcc's sysroot, I could just
cp -a sysroot/libstdc++*.dll /install/path
cp -a sysroot/libgcc_s*.dll /install/path
and I'd never have to worry about
- libstdc++-V.dll where V is now "6" but will change
- libgcc_s_E-V.dll for E in {sjlj, seh} and V in {1, 2...}
For debian cross compilers, 'gcc -print-libgcc-file-name' works; but for
cygwin (using native gcc-4.9.1 the way mingw-w64 packages it) that command
finds a directory with a static libgcc and no dlls, and I can't even find
the libgcc*.dll directory in 'gcc -v'.
AFAICT, the best I can do is to use '-print-libgcc-file-name' with debian,
and look in /path/to/gcc/bin for the dlls with cygwin. But I'm hoping that
you've encountered this problem before and found a better solution.
---------8<--------8<--------8<--------8<--------8<--------8<--------8<-------
diff --git a/msw_cygwin.make b/msw_cygwin.make
index 052e143..aab2db0 100644
--- a/msw_cygwin.make
+++ b/msw_cygwin.make
@@ -71,11 +71,11 @@ CXX := $(gcc_bin_dir)$(host_prefix)g++
LD := $(gcc_bin_dir)$(host_prefix)g++
RC := $(gcc_bin_dir)$(host_prefix)windres
-# Identify run-time libraries for redistribution. See:
-# https://cygwin.com/ml/cygwin/2010-09/msg00553.html
-# Of course manipulating an lmi user's $PATH is out of the question.
+# Identify run-time libraries for redistribution. Perhaps gcc's
+# '-print-sysroot' would be more suitable, but that option returns
+# an empty string with mingw-w64 gcc-4.9.1 .
-compiler_sysroot := /MinGW_/i686-w64-mingw32/lib
+compiler_sysroot := $(dir $(shell $(CXX) -print-libgcc-file-name))
compiler_runtime_files := \
$(compiler_sysroot)/libstdc++-6.dll \
diff --git a/msw_generic.make b/msw_generic.make
index de5f906..2f82b0b 100644
--- a/msw_generic.make
+++ b/msw_generic.make
@@ -51,9 +51,11 @@ CXX := $(gcc_bin_dir)$(host_prefix)g++
LD := $(gcc_bin_dir)$(host_prefix)g++
RC := $(gcc_bin_dir)$(host_prefix)windres
-# Identify run-time libraries for redistribution.
+# Identify run-time libraries for redistribution. Perhaps gcc's
+# '-print-sysroot' would be more suitable, but that option returns
+# an empty string with mingw-w64 gcc-4.9.1 .
-compiler_sysroot := /usr/lib/gcc/i686-w64-mingw32/4.9-win32
+compiler_sysroot := $(dir $(shell $(CXX) -print-libgcc-file-name))
compiler_runtime_files := \
$(compiler_sysroot)/libstdc++-6.dll \
--------->8-------->8-------->8-------->8-------->8-------->8-------->8-------
- [lmi] Locating gcc runtime dlls,
Greg Chicares <=