This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
GCC 3.x can't find startup files and libraries under Windows/MINGW32
- To: gcc-patches at gcc dot gnu dot org, obry at gnat dot com
- Subject: GCC 3.x can't find startup files and libraries under Windows/MINGW32
- From: obry at gnat dot com
- Date: Sun, 3 Jun 2001 16:31:06 -0400 (EDT)
Hello,
This patch fix a problem when GCC is looking for startup files like crt?.o and
standard libraries under Windows/MINGW32 like libmingw32.a, libkernel32.a.
The problem is that the standard lib directory is not in the startfile_prefixes
list. It used to be in previous version of GCC. I suppose that this regression
is due related to new make_relative_prefix mechanism.
Anyway this patch fix this specific problem. I'm not sure if it is the best
way to fix this problem, but with this patch it is possible to change GCC
directory and to still use it by setting the PATH and GCC_ROOT. This is not
possible without this patch.
I have put this code for all platforms as it seems a general fix but it would
be perfectly possible to activate this patch only for MINGW32. Thoughts ?
<<
*** gcc.c.orig Sun Jun 3 20:43:14 2001
--- gcc.c Sun Jun 3 22:11:58 2001
***************
*** 3046,3051 ****
--- 3046,3052 ----
if (gcc_exec_prefix)
{
int len = strlen (gcc_exec_prefix);
+ int clen;
if (len > (int) sizeof ("/lib/gcc-lib/") - 1
&& (IS_DIR_SEPARATOR (gcc_exec_prefix[len-1])))
***************
*** 3055,3061 ****
&& strncmp (temp + 1, "lib", 3) == 0
&& IS_DIR_SEPARATOR (temp[4])
&& strncmp (temp + 5, "gcc-lib", 7) == 0)
! len -= sizeof ("/lib/gcc-lib/") - 1;
}
set_std_prefix (gcc_exec_prefix, len);
--- 3056,3065 ----
&& strncmp (temp + 1, "lib", 3) == 0
&& IS_DIR_SEPARATOR (temp[4])
&& strncmp (temp + 5, "gcc-lib", 7) == 0)
! clen = len -= sizeof ("/lib/gcc-lib/") - 1;
! else
! /* this is not a /lib/gcc-lib/ ending */
! clen = 0;
}
set_std_prefix (gcc_exec_prefix, len);
***************
*** 3063,3068 ****
--- 3067,3088 ----
PREFIX_PRIORITY_LAST, 0, NULL);
add_prefix (&startfile_prefixes, gcc_exec_prefix, "GCC",
PREFIX_PRIORITY_LAST, 0, NULL);
+
+ /* Add the lib directory just under the root GCC installation
+ directory. This is the directory just above gcc_exec_prefix. This is
+ needed under MINGW32 because most of the libraries and the startup
+ files crt?.o, dllcrt?.o are put into this directory. */
+
+ if (clen != 0)
+ {
+ char *libdir = (char *) alloca (clen);
+
+ strcpy (libdir, gcc_exec_prefix);
+ libdir[len + 5] = '\0';
+
+ add_prefix (&startfile_prefixes, libdir, "",
+ PREFIX_PRIORITY_LAST, 0, NULL);
+ }
}
/* COMPILER_PATH and LIBRARY_PATH have values
>>
Please let me know if you need more information.
Pascal Obry.
Ada core Technologies.