public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* which object file is fstat64/stat64 located
@ 2018-12-17  5:06 Yubin Ruan
  2018-12-17  5:21 ` Marc Glisse
  2018-12-17 20:51 ` Florian Weimer
  0 siblings, 2 replies; 6+ messages in thread
From: Yubin Ruan @ 2018-12-17  5:06 UTC (permalink / raw)
  To: gcc-help

Hi,

I am seeking help here since I got error of "undefined reference to
fstat64/stat64" when linking without libstdc++ in a C++ program. I was
trying to use libcxx, so I added -nodefaultlibs when compiling the
program. To get necessary symbols from libc, I added -lc  (and also
-lm -lgcc_s -lgcc). But I still got the undefined reference error.

Note that I never use fstat64/stat64 in my program. I only use fstat/stat.

From the man page[1] it is said that on Linux fstat/stat is a wrapper
around fstat64/stat64. So these two symbols must locate at some object
file I don't know.

[1]: http://man7.org/linux/man-pages/man2/stat.2.html

--
Yubin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: which object file is fstat64/stat64 located
  2018-12-17  5:06 which object file is fstat64/stat64 located Yubin Ruan
@ 2018-12-17  5:21 ` Marc Glisse
  2018-12-17  7:34   ` Yubin Ruan
  2018-12-17 20:51 ` Florian Weimer
  1 sibling, 1 reply; 6+ messages in thread
From: Marc Glisse @ 2018-12-17  5:21 UTC (permalink / raw)
  To: Yubin Ruan; +Cc: gcc-help

On Mon, 17 Dec 2018, Yubin Ruan wrote:

> I am seeking help here since I got error of "undefined reference to
> fstat64/stat64" when linking without libstdc++ in a C++ program. I was
> trying to use libcxx, so I added -nodefaultlibs when compiling the
> program. To get necessary symbols from libc, I added -lc  (and also
> -lm -lgcc_s -lgcc). But I still got the undefined reference error.
>
> Note that I never use fstat64/stat64 in my program. I only use fstat/stat.
>
> From the man page[1] it is said that on Linux fstat/stat is a wrapper
> around fstat64/stat64. So these two symbols must locate at some object
> file I don't know.

Could it be that you are using those -l* flags in the wrong order?

-- 
Marc Glisse

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: which object file is fstat64/stat64 located
  2018-12-17  5:21 ` Marc Glisse
@ 2018-12-17  7:34   ` Yubin Ruan
  0 siblings, 0 replies; 6+ messages in thread
From: Yubin Ruan @ 2018-12-17  7:34 UTC (permalink / raw)
  To: gcc-help

On Mon, Dec 17, 2018 at 1:06 PM Marc Glisse <marc.glisse@inria.fr> wrote:
>
> On Mon, 17 Dec 2018, Yubin Ruan wrote:
>
> > I am seeking help here since I got error of "undefined reference to
> > fstat64/stat64" when linking without libstdc++ in a C++ program. I was
> > trying to use libcxx, so I added -nodefaultlibs when compiling the
> > program. To get necessary symbols from libc, I added -lc  (and also
> > -lm -lgcc_s -lgcc). But I still got the undefined reference error.
> >
> > Note that I never use fstat64/stat64 in my program. I only use fstat/stat.
> >
> > From the man page[1] it is said that on Linux fstat/stat is a wrapper
> > around fstat64/stat64. So these two symbols must locate at some object
> > file I don't know.
>
> Could it be that you are using those -l* flags in the wrong order?

I don't think so. They are all added at the very end.

Or, are you sure that fstat64/stat64 are located in libc.so ? Using
"nm -gC /usr/lib64/libc.so |grep fstat64" give no output.

--
Yubin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: which object file is fstat64/stat64 located
  2018-12-17  5:06 which object file is fstat64/stat64 located Yubin Ruan
  2018-12-17  5:21 ` Marc Glisse
@ 2018-12-17 20:51 ` Florian Weimer
  2018-12-18  6:42   ` Yubin Ruan
  1 sibling, 1 reply; 6+ messages in thread
From: Florian Weimer @ 2018-12-17 20:51 UTC (permalink / raw)
  To: Yubin Ruan; +Cc: gcc-help

* Yubin Ruan:

> I am seeking help here since I got error of "undefined reference to
> fstat64/stat64" when linking without libstdc++ in a C++ program. I was
> trying to use libcxx, so I added -nodefaultlibs when compiling the
> program. To get necessary symbols from libc, I added -lc  (and also
> -lm -lgcc_s -lgcc). But I still got the undefined reference error.

What's your target?

Thanks,
Florian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: which object file is fstat64/stat64 located
  2018-12-17 20:51 ` Florian Weimer
@ 2018-12-18  6:42   ` Yubin Ruan
  2018-12-18  8:57     ` Florian Weimer
  0 siblings, 1 reply; 6+ messages in thread
From: Yubin Ruan @ 2018-12-18  6:42 UTC (permalink / raw)
  To: Florian Weimer; +Cc: gcc-help

On Mon, Dec 17, 2018 at 7:32 PM Florian Weimer <fweimer@redhat.com> wrote:
>
> * Yubin Ruan:
>
> > I am seeking help here since I got error of "undefined reference to
> > fstat64/stat64" when linking without libstdc++ in a C++ program. I was
> > trying to use libcxx, so I added -nodefaultlibs when compiling the
> > program. To get necessary symbols from libc, I added -lc  (and also
> > -lm -lgcc_s -lgcc). But I still got the undefined reference error.
>
> What's your target?

My target is a C++ program(mysqld) which use fstat/stat and other C++
standard library functions. Normally libstdc++ is used and everything
is fine. But I want to switch to libcxx.

--
Yubin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: which object file is fstat64/stat64 located
  2018-12-18  6:42   ` Yubin Ruan
@ 2018-12-18  8:57     ` Florian Weimer
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Weimer @ 2018-12-18  8:57 UTC (permalink / raw)
  To: Yubin Ruan; +Cc: gcc-help

* Yubin Ruan:

> On Mon, Dec 17, 2018 at 7:32 PM Florian Weimer <fweimer@redhat.com> wrote:
>>
>> * Yubin Ruan:
>>
>> > I am seeking help here since I got error of "undefined reference to
>> > fstat64/stat64" when linking without libstdc++ in a C++ program. I was
>> > trying to use libcxx, so I added -nodefaultlibs when compiling the
>> > program. To get necessary symbols from libc, I added -lc  (and also
>> > -lm -lgcc_s -lgcc). But I still got the undefined reference error.
>>
>> What's your target?
>
> My target is a C++ program(mysqld) which use fstat/stat and other C++
> standard library functions. Normally libstdc++ is used and everything
> is fine. But I want to switch to libcxx.

With target I meant something like Windows, MacOS, or GNU/Linux, and the
processor architecture.

But for libcxx support, you should ask on a libcxx mailing list, not on
a GNU mailing list.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-12-18  6:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-17  5:06 which object file is fstat64/stat64 located Yubin Ruan
2018-12-17  5:21 ` Marc Glisse
2018-12-17  7:34   ` Yubin Ruan
2018-12-17 20:51 ` Florian Weimer
2018-12-18  6:42   ` Yubin Ruan
2018-12-18  8:57     ` Florian Weimer

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).