Bug 37564 - collect2: ld returned 1 exit status make[3]: *** [libgfortran.la] Error 1
collect2: ld returned 1 exit status make[3]: *** [libgfortran.la] Error 1
Status: RESOLVED DUPLICATE of bug 35619
Product: gcc
Classification: Unclassified
Component: libfortran
4.3.1
: P3 normal
: ---
Assigned To: Not yet assigned to anyone
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-09-17 16:02 UTC by Reuben Kraft
Modified: 2008-09-17 19:08 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
x86_64-unknown-linux-gnu/libgfortran/config.log (344.79 KB, text/plain)
2008-09-17 16:04 UTC, Reuben Kraft
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Reuben Kraft 2008-09-17 16:02:18 UTC
Hello,

From the terminal, I many lines that look similar to:
.libs/in_unpack_generic.o(.text+0x820): In function `getline':
/usr/include/bits/stdio.h:103: multiple definition of `getline'
.libs/backtrace.o(.text+0xbc0):/usr/include/bits/stdio.h:103: first defined here
.libs/in_unpack_generic.o(.text+0x830): In function `putchar_unlocked':
/usr/include/bits/stdio.h:94: multiple definition of `putchar_unlocked'
.libs/backtrace.o(.text+0xbd0):/usr/include/bits/stdio.h:94: first defined here
...
...
...


After that terminal output says:

collect2: ld returned 1 exit status
make[3]: *** [libgfortran.la] Error 1
make[3]: Leaving directory `/home/rkraft/apps/gcc-4.3.1/x86_64-unknown-linux-gnu/libgfortran'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/rkraft/apps/gcc-4.3.1/x86_64-unknown-linux-gnu/libgfortran'
make[1]: *** [all-target-libgfortran] Error 2
make[1]: Leaving directory `/home/rkraft/apps/gcc-4.3.1'
make: *** [all] Error 2

I get this same error for gcc4.3.2 also.  What cause this and how do I fix it? Configure log from x86_64-unknown-linux-gnu/libgfortran/ attached.

Thanks for your time.
Comment 1 Reuben Kraft 2008-09-17 16:04:30 UTC
Created attachment 16346 [details]
x86_64-unknown-linux-gnu/libgfortran/config.log
Comment 2 Andrew Pinski 2008-09-17 18:53:09 UTC
Did you compile in the source directory?  If so, don't.  It is not well supported and it is currently known to be broken for this same reason, see PR 35619.
Comment 3 Reuben Kraft 2008-09-17 19:04:09 UTC
Do you mean do not run "make" from gcc-4.3.1 ?  Or do mean do not set prefix to gcc-4.3.1 ? 

Currently I run make from /home/rkraft/apps/gcc-4.3.1 and I set prefix to /home/rkraft/apps/gcc4

Here is my configure:

./configure --prefix=/home/rkraft/apps/gcc4 --with-mpfr=/home/rkraft/apps/mpfr-2.3.2 --disable-multilib --enable-languages=fortran,c,c++ --with-gmp=/home/rkraft/apps/gmp-4.2.3  --with-gmp-lib=/home/rkraft/apps/gmp-4.2.3/lib --with-mpfr-lib=/home/rkraft/apps/mpfr-2.3.2/lib:
Comment 4 Andrew Pinski 2008-09-17 19:07:41 UTC
Please read http://gcc.gnu.org/install/configure.html:
First, we highly recommend that GCC be built into a separate directory than the sources which does not reside within the source tree. This is how we generally build GCC; building where srcdir == objdir should still work, but doesn't get extensive testing; building where objdir is a subdirectory of srcdir is unsupported.




*** This bug has been marked as a duplicate of 35619 ***
Comment 5 Tobias Burnus 2008-09-17 19:08:55 UTC
> Currently I run make from /home/rkraft/apps/gcc-4.3.1
>
> Here is my configure:
> 
> ./configure --prefix=/home/rkraft/apps/gcc4

Try:

cd /home/rkraft/apps/
mkdir gcc-4.3.1-build
cd gcc-4.3.1-build
../gcc-4.3.1/configure --prefix=/home/rkraft/apps/gcc4  \
    --with-mpfr=/home/rkraft/apps/mpfr-2.3.2 --disable-multilib \
    --enable-languages=fortran,c,c++ --with-gmp=/home/rkraft/apps/gmp-4.2.3 \
    --with-gmp-lib=/home/rkraft/apps/gmp-4.2.3/lib \
    --with-mpfr-lib=/home/rkraft/apps/mpfr-2.3.2/lib:

As Andrew already wrote: You should not build in the source directory but you should build into another, empty directory like I did in the example above.
Comment 6 Brian Dessent 2008-09-17 19:38:11 UTC
Subject: Re:  collect2: ld returned 1 exit status make[3]: 
 *** [libgfortran.la] Error 1

Even worse, you may have to start over with a clean source tree.  See
pr32272 for an example of where a previous attempt at configuring in the
source directory caused later failures when properly building in a
separate directory.