egcs 1.1a problem and solution
Don Badrak
dbadrak@geo.census.gov
Thu Sep 3 17:42:00 GMT 1998
EGCS interested parties,
I've run into a problem with egcs-1.1a. And a solution.
version: gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
configure:
[IRIX]
configure --prefix=/opt/gnu --exec-prefix=/opt/gnu-irix \
--enable-threads
[Solaris]
configure --prefix=/opt/gnu --exec-prefix=/opt/gnu-solaris \
--enable-threads --with-stabs
machine(s): mips-sgi-irix6.2 (SGI Indigo2 IRIX 6.2)
mips-sgi-irix6.5 (SGI Octane IRIX 6.5)
sparc-solaris2.6 (Sun UltraSparc Solaris 2.6)
description:
After configuring as listed above, and then installing, a "gcc -v" gives
"using builtin specs". Then, when compiling, it can't find cpp or anything
else installed under the binary directory
/opt/gnu-irix/lib/gcc-lib/mips-sgi-irix62/egcs-2.91/57. It doesn't matter
what OS, it does it on both IRIX and Solaris.
I had this exact same problem with gcc 2.8.1, which is when I went to
egcs 1.0.3a (this didn't have the newer code in it). I reported this to
the newsgroup, not sure how big a problem it was, but I didn't email the
bug report in.
I did some poking around this time, to see if I could figure it out. I
believe I've found the problem.
In the code update_path() in gcc/prefix.c (line 293), if prefix passed in
starts with the compiled-in prefix, the compiled-in prefix replaces it.
Since I configure with prefix=/opt/gnu and exec_prefix=/opt/gnu-irix, this
matches, and it gets replaced. For me, this is a problem. Anyone else
who uses an exec_prefix that is starts with the prefix will also have this
problem (most people probably put it in one directory).
This is called in gcc/gcc.c when trying to determine the standard_exec_prefix.
If the prefix is a substring of exec_prefix, this breaks. All the software
gets installed in the right places, but the compiler won't call it.
You can set the GCC_EXEC_PREFIX to the correct directory, but you also have
to set the COMPILER_PATH variable for it to pick up the system-specific
include files. Arg. What a mess.
I've included a patch that will replace the path only if there is a substring
match AND the character following the compiled-in prefix, if there is one,
is null, a /, or a directory separator.
This code may not be the best way to do it. Please change it as necessary
to fit into the coding style.
Thanks.
###
### prefix.patch
###
--- gcc/prefix.c.orig Sat Apr 4 12:38:22 1998
+++ gcc/prefix.c Thu Sep 3 19:39:06 1998
@@ -294,7 +294,12 @@
char *path;
char *key;
{
- if (! strncmp (path, std_prefix, strlen (std_prefix)) && key != 0)
+ if ( strncmp (path, std_prefix, strlen (std_prefix)) == 0 &&
+ ( path[strlen (std_prefix)] == 0 || path[strlen (std_prefix)] == '/'
+#ifdef DIR_SEPARATOR
+ || path[strlen (std_prefix)] == DIR_SEPARATOR
+#endif
+ ) && key != 0)
{
if (key[0] != '$')
key = concat ("@", key, NULL_PTR);
--
Don Badrak <dbadrak@census.gov> 301.457.1125 work MWThF
Geography Division 301.457.2157 work Tu
U.S. Bureau of the Census 301.457.4710 fax
Upper Marlboro MD, USA
More information about the Gcc-bugs
mailing list