2
votes

I am getting the following error in NS3 compiling(through waf):-

/usr/bin/ld: final link failed: File truncated

collect2: ld returned 1 exit status

What could be the possible reason for the same?

2

2 Answers

4
votes

One of the object files you're linking was not completed and is now either an empty file or truncated because the compilation terminated for some reason. Delete the file in question (the error message should contain the name) and rebuild.

0
votes

I am on a specific platform and building with GCC 4.1.2 i came across this error message while my code was compiling just fine. The solution to delete the file did not help.

In a header file a declared an array of big size.

sometype array[1000000000]; /* 1.000.000.000 */

The compiler produced the object files without warning nor error but the linker stopped with the error in question. To solve this problem I had to remove a single zero of this array declaration. Seems like I hit the bss segment limit.