public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "geir at cray dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/32799]  New: Multiple definitions of __flockfile when compiling an openMP program
Date: Tue, 17 Jul 2007 19:21:00 -0000	[thread overview]
Message-ID: <bug-32799-13968@http.gcc.gnu.org/bugzilla/> (raw)

I see the following behavior when compiling an OpenMP program:

$ cat omp.c

extern void omp_set_num_threads (int);
#define NT 4

int main() {
    omp_set_num_threads(NT);
    return(0);
}

$ gcc --version
gcc (GCC) 4.2.0 20070514 (rpm:4)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc -static -fopenmp omp.c -lc
/usr/lib/../lib64/libpthread.a(lockfile.o)(.text+0xb0): In function
`__flockfile':
/usr/src/packages/BUILD/glibc-2.3/linuxthreads/lockfile.c:29: multiple
definition of `_IO_flockfile'
/usr/lib/../lib64/libc.a(flockfile.o)(.text+0x0):../linuxthreads/sysdeps/pthread/flockfile.c:30:
first defined here
/usr/bin/ld: Warning: size of symbol `_IO_flockfile' changed from 24 in
/usr/lib/../lib64/libc.a(flockfile.o) to 12 in
/usr/lib/../lib64/libc.a(flockfile.o)
/usr/lib/../lib64/libpthread.a(lockfile.o)(.text+0xb0): In function
`__flockfile':
/usr/src/packages/BUILD/glibc-2.3/linuxthreads/lockfile.c:29: multiple
definition of `__flockfile'
/usr/lib/../lib64/libc.a(flockfile.o)(.text+0x0):../linuxthreads/sysdeps/pthread/flockfile.c:30:
first defined here
/usr/bin/ld: Warning: size of symbol `__flockfile' changed from 24 in
/usr/lib/../lib64/libc.a(flockfile.o) to 12 in
/usr/lib/../lib64/libc.a(flockfile.o)
/usr/lib/../lib64/libpthread.a(lockfile.o)(.text+0xa0): In function
`__funlockfile':
/usr/src/packages/BUILD/glibc-2.3/linuxthreads/lockfile.c:39: multiple
definition of `_IO_funlockfile'
/usr/lib/../lib64/libc.a(funlockfile.o)(.text+0x0):../linuxthreads/sysdeps/pthread/funlockfile.c:30:
first defined here
/usr/bin/ld: Warning: size of symbol `_IO_funlockfile' changed from 24 in
/usr/lib/../lib64/libc.a(funlockfile.o) to 12 in
/usr/lib/../lib64/libc.a(funlockfile.o)
/usr/lib/../lib64/libpthread.a(lockfile.o)(.text+0xa0): In function
`__funlockfile':
/usr/src/packages/BUILD/glibc-2.3/linuxthreads/lockfile.c:39: multiple
definition of `__funlockfile'
/usr/lib/../lib64/libc.a(funlockfile.o)(.text+0x0):../linuxthreads/sysdeps/pthread/funlockfile.c:30:
first defined here
/usr/bin/ld: Warning: size of symbol `__funlockfile' changed from 24 in
/usr/lib/../lib64/libc.a(funlockfile.o) to 12 in
/usr/lib/../lib64/libc.a(funlockfile.o)collect2: ld returned 1 exit status
$

Problem does NOT occur if I don't include '-lc'.  I don't quite understand why
this is a factor, since gcc automatically specifies '-lc' when linking the
program.  Please enlighten me as to why adding this to the command line causes
the error.

Here is the version of Linux I am using:

$ uname -a
Linux guppy2 2.6.5-7.286-ss #6 SMP Wed Jul 11 14:28:20 PDT 2007 x86_64 x86_64
x86_64 GNU/Linux
$ cat /etc/SuSE-release
SUSE LINUX Enterprise Server 9 (x86_64)
VERSION = 9
PATCHLEVEL = 2
$

I am building a program for the Cray XT3, so static libraries must be used.


-- 
           Summary: Multiple definitions of __flockfile when compiling an
                    openMP program
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: geir at cray dot com


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


             reply	other threads:[~2007-07-17 19:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-17 19:21 geir at cray dot com [this message]
2007-07-17 19:21 ` [Bug c/32799] " geir at cray dot com
2007-07-17 19:23 ` geir at cray dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-32799-13968@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).