From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23139 invoked by alias); 1 Feb 2011 16:20:38 -0000 Received: (qmail 23125 invoked by uid 22791); 1 Feb 2011 16:20:36 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_BG,TW_IB,TW_LR X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 01 Feb 2011 16:20:31 +0000 From: "jb at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/47571] [4.6 Regression] undefined reference to clock_gettime in Linux build of 02/01/2011 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jb at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jb at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Tue, 01 Feb 2011 16:20:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-02/txt/msg00131.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47571 --- Comment #11 from Janne Blomqvist 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.