Author Topic: TDM's unofficial GCC 4.2.0 for MinGW (now with OpenMP, Fortran and Obj-C)  (Read 140351 times)

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Oops...make that " 2>errorlog.txt". Sorry.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

roland

  • Guest
Huge apologies for bug spam. I will start another topic if it is appropriate

" 2>errorlog.txt" creates a log file too big to post :P Nearly 500KB

here are are a few hundred lines starting from the beginning, should hopefully give you an idea...

[attachment deleted by admin]
« Last Edit: July 09, 2007, 10:31:54 pm by roland »

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Try adding another environment variable: "C_INCLUDE_PATH=C:\MinGW\lib\gcc\mingw32\4.2.0\include".
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

roland

  • Guest
Thanks. With that, I get a little further... some errors pop up a few minutes into the compile...


[attachment deleted by admin]

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
I should've seen that coming. New variable CPLUS_INCLUDE_PATH, same value as C_INCLUDE_PATH. (In case you're interested, I'm getting these from http://gcc.gnu.org/onlinedocs/gcc-4.2.0/gcc/Environment-Variables.html.)


Also, here's a little experiment I thought up that will help me understand a bit better how GCC is working under Vista. If you could try it out and post your results, I'd appreciate it.

1. Remove all GCC/MinGW related environment variables, including any PATH entries.

2. Rename the base folder of your current MinGW installation to something like "testmingw". The idea is to make sure "\MinGW" doesn't exist.

3. Create a new text file called "gcc.bat" which contains the following two lines:
     @ECHO OFF
     C:\testmingw\bin\gcc.exe %*
   where C:\testmingw corresponds to wherever your MinGW installation is.
   Save the file somewhere other than in your MinGW folder -- i.e. "C:\testbat\gcc.bat"

4. Add the location of gcc.bat to your PATH environment variable -- i.e. "<other stuff>;C:\testbat"

5. Create a simple test file called "test.cpp" somewhere with the following code:
Code
#include <cstdio>
#include <string>
int main()
{
    return 0;
}

6. Open up a command prompt and enter the following commands (assuming you saved test.cpp to C:\anothertestfolder):
Code
C:
cd \anothertestfolder
gcc -v -c test.cpp

Post the output (feel free to use the redirection trick to get something that's easier to copy'n'paste, but use 1> instead of 2> if you do).

Edit:
D'oh. <cstdio>, not <cstdio.h>...
« Last Edit: July 09, 2007, 11:16:16 pm by TDragon »
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

roland

  • Guest
I read, reread, triple-checked, and it does not seem to work.  :?

I then removed the environmental variable, renamed the folder to MinGW, opened the .cpp file in codeblocks and it compiles. Good thing codeblocks is smart enough to run without environmental variables ;) Now if I can only get other things to work... O__O
« Last Edit: July 10, 2007, 12:38:34 am by roland »

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
I read, reread, triple-checked, and it does not seem to work.  :?
What do you mean by that? Which part doesn't work? What error message do you get?
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

roland

  • Guest
What I mean is that it did nothing. It simply does not appear to detect gcc and returns the same error it would as if it did not exist at all:
Code
C:\>gcc -v -c testing.cpp 1> log.txt
'gcc' is not recognized as an internal or external command,
operable program or batch file.

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Gotcha. And if you then enter:
Code
echo %PATH%
you get a list of paths that includes the location of gcc.bat?

(Note: Any time you change a Windows environment variable, you need to exit and reopen any command shells for the change to take effect.)
« Last Edit: July 10, 2007, 01:06:59 am by TDragon »
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

roland

  • Guest
wait backup... silly me I should have followed your filenames exactly, I now see that "gcc.bat" is important :P I named it something else. okay, it works.

1> creates a blank text file

2> creates this:

Code
Using built-in specs.
Target: mingw32
Configured with: ../gcc-4.2.0/configure --prefix=/extra/crossgcc/win-gcc --build=i686-pc-linux-gnu --host=mingw32 --target=mingw32 --enable-languages=c,c++,fortran,objc,java --with-as=/extra/crossgcc/cross-gcc/bin/mingw32-as --with-ld=/extra/crossgcc/cross-gcc/bin/mingw32-ld --with-gcj=/extra/crossgcc/cross-gcc/bin/mingw32-gcj --disable-shared --with-gcc --with-gnu-as --with-gnu-ld --disable-debug --disable-nls --enable-threads=win32 --disable-win32-registry --enable-sjlj-exceptions --enable-fully-dynamic-string --disable-libstdcxx-pch --with-mtune=i686 --enable-libgomp --with-gmp=/extra/crossgcc/win-gmp-install --with-mpfr=/extra/crossgcc/win-mpfr-install --enable-libgcj --without-x --disable-java-awt
Thread model: win32
gcc version 4.2.0
 cc1plus -quiet -v -iprefix c:\testmingw\bin\../lib/gcc/mingw32/4.2.0/ testing.cpp -quiet -dumpbase testing.cpp -mtune=i386 -auxbase testing -version -o ./ccF2DNa1.s
gcc.exe: CreateProcess: No such file or directory

without using either 1> or 2>:
Code
C:\>gcc -v -c test.cpp
Using built-in specs.
Target: mingw32
Configured with: ../gcc-4.2.0/configure --prefix=/extra/crossgcc/win-gcc --build=i686-pc-linux-gnu -
-host=mingw32 --target=mingw32 --enable-languages=c,c++,fortran,objc,java --with-as=/extra/crossgcc/
cross-gcc/bin/mingw32-as --with-ld=/extra/crossgcc/cross-gcc/bin/mingw32-ld --with-gcj=/extra/crossg
cc/cross-gcc/bin/mingw32-gcj --disable-shared --with-gcc --with-gnu-as --with-gnu-ld --disable-debug
 --disable-nls --enable-threads=win32 --disable-win32-registry --enable-sjlj-exceptions --enable-ful
ly-dynamic-string --disable-libstdcxx-pch --with-mtune=i686 --enable-libgomp --with-gmp=/extra/cross
gcc/win-gmp-install --with-mpfr=/extra/crossgcc/win-mpfr-install --enable-libgcj --without-x --disab
le-java-awt
Thread model: win32
gcc version 4.2.0
 cc1plus -quiet -v -iprefix c:\testmingw\bin\../lib/gcc/mingw32/4.2.0/ test.cpp -quiet -dumpbase tes
t.cpp -mtune=i386 -auxbase test -version -o ./ccKV7mkz.s
gcc.exe: CreateProcess: No such file or directory

C:\>

and your following request...
Code
C:\>echo %PATH%
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\Pyth
on25\;C:\testbat\
« Last Edit: July 10, 2007, 01:16:24 am by roland »

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Right, thanks.

The point of this exercise, I guess, is that it is possible to avoid "pollution" of Windows' main set of environment variables by performing some trickery with batch files. However, for most users it's probably not worth all the additional work it would be.

The quickest solution for you right now is to restore all your GCC-related environment variables:
PATH=<whatever>;C:\MinGW\bin;C:\MinGW\mingw32\bin;C:\MinGW\libexec\gcc\mingw32\4.2.0
C_INCLUDE_PATH=C:\MinGW\include;C:\MinGW\lib\gcc\mingw32\4.2.0\include
CPLUS_INCLUDE_PATH=C:\MinGW\include;C:\MinGW\lib\gcc\mingw32\4.2.0\include;C:\MinGW\include\c++\4.2.0;C:\MinGW\include\c++\4.2.0\mingw32
LIBRARY_PATH=C:\MinGW\lib;C:\MinGW\lib\gcc\mingw32\4.2.0

I think those should be all that's necessary for doing command-line compilations (like building wxWidgets...), but if there are any others that you've found necessary, add them by all means.

If you run across more errors, toss 'em out and we'll knock 'em down. Meanwhile I'll try to sweet-talk someone into buying me a copy of Windows Vista.
« Last Edit: July 10, 2007, 01:27:28 am by TDragon »
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

roland

  • Guest
Thanks! Compiling now. About 15mins in... so far so good... will edit with results.

I have successfully compiled a monolithic dll and then compiled a sample wxwidgets program in codeblocks. Thanks!
« Last Edit: July 10, 2007, 02:05:16 am by roland »

Offline eloj

  • Single posting newcomer
  • *
  • Posts: 3
Will you do a 4.2.1? Looks like it'll be out of RC2 in about a week. I don't know if there are any relevant bug-fixes though.

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Will you do a 4.2.1? Looks like it'll be out of RC2 in about a week. I don't know if there are any relevant bug-fixes though.
As soon as it's released, definitely. There have been a few bug fixes, but the one I've been hoping would be fixed hasn't yet. There's still time, however, as it was mentioned in the most recent status report that the fix could make it in for an RC3.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline dwmcqueen

  • Multiple posting newcomer
  • *
  • Posts: 56
Something I noticed - and am having a weird time figuring out how.

I have this version installed to C:\MingW-4.2\.  However, the linker is pulling in libraries from my C:\MingW\lib directory even though it is not specified as a library path (and isn't in an environment variable).  It also pulls in from my C:\MingW-4.2\lib.  Anyone know how to get it to ignore my C:\MingW\lib directory?