This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH mingw32 MD_STARTFILE_PREFIX was a bad idea.
- From: "Aaron W. LaFramboise" <aaronraolete36 at aaronwl dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 10 Jun 2004 22:20:10 -0500
- Subject: PATCH mingw32 MD_STARTFILE_PREFIX was a bad idea.
A year ago, I asked that MD_STARTFILE_PREFIX be defined for mingw32 to
enable GCC to be installed in any directory. Mingw32 does not have a
/lib, so the usual GCC searches don't work.
http://gcc.gnu.org/ml/gcc-patches/2003-05/msg02015.html
In that time, this patch has been a continuing source of bug reports and
subtle problems.
With the MD_STARTFILE_PREFIX macro defined to /mingw/lib, a search path
like this results:
$PREFIX/bin/gcc/mingw32/version
$PREFIX/bin/gcc
$PREFIX/lib/gcc/mingw32/version
$PREFIX/mingw32/lib
/mingw/lib
$PREFIX/lib
Since /mingw/lib is searched before $PREFIX/lib, this often causes the
wrong versions of gcc libraries, such as libstdc++-v3, to be linked
against. While this is not the behavior the documentation seemed to
indicate to me*, it seems to be the intended behavior, according to a
comment in config/i386/sco5.h**.
* "MD_STARTFILE_PREFIX If defined, this macro supplies an additional
prefix to try after the standard prefixes. MD_EXEC_PREFIX is not
searched when the -b option is used, or when the compiler is built as a
cross compiler."
** ". . . We get /usr/gnu/lib first by virtue of the MD_STARTFILE_PREFIX
below."
As near as I can tell, the only way to fix this is to remove this macro
and give up being able to install a mingw GCC to any directory. This
means having to install the libc (mingw runtime or otherwise) into any
directory you'd like to install GCC into before you build GCC.
Aaron W. LaFramboise
2004-06-10 Aaron W. LaFramboise <aaronraolete36@aaronwl.com>
* config/i386/mingw32.h (MD_STARTFILE_PREFIX): Remove.
Index: gcc/gcc/config/i386/mingw32.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config/i386/mingw32.h,v
retrieving revision 1.35
diff -c -3 -p -r1.35 mingw32.h
*** gcc/gcc/config/i386/mingw32.h 26 Sep 2003 03:46:06 -0000 1.35
--- gcc/gcc/config/i386/mingw32.h 8 Jun 2004 05:59:01 -0000
*************** Boston, MA 02111-1307, USA. */
*** 69,78 ****
#define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
%{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s}"
- /* An additional prefix to try after the standard prefixes. */
- #undef MD_STARTFILE_PREFIX
- #define MD_STARTFILE_PREFIX "/mingw/lib/"
-
/* Output STRING, a string representing a filename, to FILE.
We canonicalize it to be in Unix format (backslashes are replaced
forward slashes. */
--- 69,74 ----