User forums > Help

slooooow linking

<< < (4/6) > >>

Ceniza:
The linking stage can take a fairly huge amount of time. It all depends on the options, libraries and code itself.

At work I am using Intel C++ to compile the release version of the project I am working on (Visual C++'s linker either crashes with some decent optimizations, or it produces wrong code that crashes at runtime). For the release version I have some aggressive options set, including /Qipo and generating both generic code and target optimized code. Just compiling the source code can take a few minutes, but the linking stage takes more than 20 minutes. It takes it time to load all needed information (eating more than 1 GB of RAM in the process), and then it takes it more time to produce the DLL. Add to that that it does it twice (I guess once for each target).

Linkers are not always as dumb as one may think, and that costs time.

wilcomir:
hi all!

here's the command line displayed while compiling and linking

mingw32-g++.exe    -c "C:\Documents and Settings\Vladi\Documenti\cpp\prova.cpp" -o "C:\Documents and Settings\Vladi\Documenti\cpp\prova.o"
mingw32-g++.exe  -o "C:\Documents and Settings\Vladi\Documenti\cpp\prova.exe" "C:\Documents and Settings\Vladi\Documenti\cpp\prova.o"  
Process terminated with status 0 (1 minutes, 19 seconds)
0 errors, 0 warnings

I do not think my hard drive is heavily fragmented, the laptop is new, less than a month, and the hard disk is practically empty. however I'm trying to link without cb, I'll let you know.

thanks!

EDIT I've tried linking from cmd, and it's as slow as with cb. moreover, it produced an error:

collect2: cannot find '1d'

that disappeared as I've added the minigw bin path to the ambient variable PATH

any other ideas?

thanks again!

koso:
Thats very strange, especialy when prova.o isn't extremly large.

Can you provide some minimal example / source code? And also compiler version .. "mingw32-g++ -v"

zabzonk:
> I've tried linking from cmd, and it's as slow as with cb

So it looks like this is not a CB issue - I still suspect that it as an AV or similar issue with your specific laptop hardware and/or software. You may well be better off asking this question in a forum where you will get a wider audience than you will here - I suggest trying StackOverflow at  http://stackoverflow.com.

wilcomir:
hi all!
here's what's produced when I write mingw32-g++ -v:

--- Code: ---C:\Documents and Settings\Vladi>mingw32-g++ -v
Reading specs from C:/Programmi/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/sp
ecs
Configured with: ../gcc-3.4.5/configure --with-gcc --with-gnu-ld --with-gnu-as -
-host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --
enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shar
ed --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --ena
ble-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-sync
hronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.5 (mingw-vista special)
--- End code ---

and here's what I always compile & link:


--- Code: ---#include <iostream>
using namespace std;

int main () {
    cout << "insert a number";
    int n;
    cin >> n;
    cout << 2*n;
}

--- End code ---

the .o file is about 2kb, while the generated .exe is nearly 500kb

thanks!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version