User forums > Help

crt2.o / Vista headaches, now with -v goodness.

(1/5) > >>

ironlizard:

--- Code: ---ld -Bdynamic -o bin\Debug\Hello Wrld.exe crt2.o crtbegin.o -LC:\MinGW\lib\gcc\mingw32\3.4.2 -LC:\MinGW\lib -L obj\Debug\main.o -lstdc++ -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt crtend.o
ld: crt2.o: No such file: No such file or directory
--- End code ---

Using mingw 3.4.2 and vista business. It started out with the usual menagerie of problems. Fixed those and then stuck at this little problem. After adding the -v to the linker I came up with this messy looking command line. According to http://www.gnu.org/software/binutils/manual/ld-2.9.1/html_node/ld_3.html#SEC3 this looks about right. The 'missing' file is located in C:\MinGW\lib. I've tried every fix I could find and come up blank. The same problem occurred with wxDev-Cpp so I assume this is pretty much a mingw problem as others have mentioned. Is there any cure for this yet besides reinstalling windows? How do I force this !#$%@# linker to recognize the search directories? There seem to be some options under other settings -> advanced options for the linker that I'll toy with next, but barring something new I'm stumped.

PS The two additional files required are both in the CodeBlocks directory, so that's definitely not it.

ironlizard:
Nevermind. I've found the answer(s).

1) My project MUST at least be located on the same drive as mingw. It may also need to be under the root directory like so: C:/projectname. If you're still having trouble with crt2.0, it's worth a shot.
2) Your project's name must be 'vistasucks'. If you'll look here:


--- Quote ---ld -Bdynamic -o bin\Debug\vistasucks.exe /mingw/lib/gcc/mingw32/3.4.2/crt2.o /mingw/lib/gcc/mingw32/3.4.2/crtbegin.o -LC:\MinGW\lib -LC:\MinGW\lib\gcc\mingw32\3.4.2 -L/mingw/lib/gcc/mingw32/3.4.2 -L/mingw/mingw32/lib -L/mingw/lib -L -L/mingw/lib obj\Debug\main.o -lstdc++ -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt /mingw/lib/gcc/mingw32/3.4.2/crtend.o
Process terminated with status 0 (0 minutes, 10 seconds)
0 errors, 0 warnings
--- End quote ---

As you can see, denigrating vista is the only way to appease mingw, which appears to have a serious dislike of living in close proximity to so much useless eye candy. Ming also wants as much root action as possible, having some serious megalomania issues. We now return you to your regularly scheduled compiler problems.

rickg22:

--- Quote ---Hello Wrld.exe

--- End quote ---

Rule #1 for MINGW projects: DO *NOT*, I repeat, ABSOLUTELY DO *NOT* USE S P A C E S.
(I'm just clarifying what the above poster tried to say).

ironlizard:
To be clear: I tried it without spaces on the D: (D is for D:ocuments) drive before moving to over to C: (C is for C:RAP) and it still didn't work until I put it in C:/vistasucks. But yes, spaces are a no no :)

mariocup:
Hi ironlizard,

we are using also mingw compilers. But the current version (3.4.x and 4.x) of compilers do not work under windows Vista, so we made a patch in gcc/gcc.c


--- Code: --- #ifdef WIN32
2381   /* VISTA patch:
2382       in vista the access with X_OK = 1 no longer works
2383       as a woarkaround we use F_OK (file exists) and at the
2384       extension .exe if necessary
2385   */
2386   static int
2387   __win32_access_check(const char *name, int mode)
2388   {
2389            char *tmp_name;
2390            int  len = strlen(name);
2391            const char *const file_suffix = ((mode & X_OK) != 0 ? HOST_EXECUTABLE_SUFFIX : "");
2392            int  suffix_len = strlen(file_suffix);
2393  
2394            if (mode == X_OK) {
2395                    if (len > suffix_len && suffix_len && !strcmp(&name[len-suffix_len],file_suffix))
2396                            return access(name,F_OK);
2397                    else
2398                    {
2399                            tmp_name = alloca(len+suffix_len);
2400                            strcpy (tmp_name,name);
2401                            strcat (tmp_name, file_suffix);
2402                            return access(tmp_name,F_OK);
2403                    }
2404            }
2405            else
2406                    return access(name,mode);
2407   }
2408   #endif
2409 static int static int
2410 access_check (const char *name, int mode) access_check (const char *name, int mode)
2411 { {
2412    if (mode == X_OK)    if (mode == X_OK)
2413      {      {
2414        struct stat st;        struct stat st;
2415  
2416        if (stat (name, &st) < 0        if (stat (name, &st) < 0
2417            || S_ISDIR (st.st_mode))            || S_ISDIR (st.st_mode))
2418          return -1;          return -1;
2419   #ifdef WIN32
2420            return __win32_access_check(name, mode);
2421   #endif
2422      }      }
2423  
2424    return access (name, mode);    return access (name, mode);
2425 }
}

--- End code ---

and in libiberty/make-relative-prefix.c


--- Code: ---          /* on WIN32 we test only file exists including the executable suffix */
86            /* workaround for VISTA */
87   #  undef X_OK
88   #  define X_OK  0
89 #else #else
90   #  define HOST_EXECUTABLE_SUFFIX ""
91 #  define PATH_SEPARATOR ':' #  define PATH_SEPARATOR ':'
92 #endif #endif

--- End code ---

and replace the line
          nstore = (char *) alloca (prefixlen + strlen (progname) + 1);     
with
        nstore = (char *) alloca (prefixlen + strlen (progname) + 1 + strlen(HOST_EXECUTABLE_SUFFIX));

in make-relative.c.

We made this patch and now the mingw based compilers work on vista. As we are still testing, we did not public this patch.

Bye

Navigation

[0] Message Index

[#] Next page

Go to full version