This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/47571] [4.6 Regression] undefined reference to clock_gettime in Linux build of 02/01/2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47571

--- Comment #11 from Janne Blomqvist <jb at gcc dot gnu.org> 2011-02-01 16:20:06 UTC ---
(In reply to comment #8)
> (In reply to comment #6)
> > > clock_gettime is defined in librt, so if libgfortran started using librt
> > > symbols, it needs to a) link against it dynamically for libgfortran.so
> > 
> > Yes, that's what it does
> 
> But why doesn't it work then, cf. comment 4? openSUSE 11.3 is neither old nor
> very special.

Because the original report links statically (as can be deduced from the
presence of libgfortran.a). As I mentioned, static linking is broken but
dynamic works. FWIW, I suspect the output of ldd in comment #4 refers to the
system provided libgfortran, as neither librt nor libquadmath is present.

> 
> > > b)
> > > arrange for gfortran driver to pass in -lrt when linking libgfortran
> > > statically.
> > Right, I haven't considered this part. Anyone have any idea how that could be
> > done?
> 
> Via libgfortran/libgfortran.spec.in and some configure script?
> 
> Cf. libgomp and libgomp/configure.ac's
> 
> # Set up the set of libraries that we need to link against for libgomp.
> # Note that the GOMP_SELF_SPEC in gcc.c will force -pthread for -fopenmp,
> # which will force linkage against -lpthread (or equivalent for the system).
> # That's not 100% ideal, but about the best we can do easily.
> if test $enable_shared = yes; then
>   link_gomp="-lgomp %{static: $LIBS}"
> else
>   link_gomp="-lgomp $LIBS"
> fi
> AC_SUBST(link_gomp)
> 
> 
> By the way, there is also -lrt added via libgomp/configure.tgt for HPUX.

Thanks, I'll have to take a look at this later tonight.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]