public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* how to fix "arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `clock_gettime@GLIBC_2.17'?
@ 2020-03-10 14:13 kipade
  2020-03-10 14:13 ` Florian Weimer
  0 siblings, 1 reply; 9+ messages in thread
From: kipade @ 2020-03-10 14:13 UTC (permalink / raw)
  To: gcc-help

 Hello, I use linaro gcc 5.3 to compile cpp files using -std=gnu++14, and I got an link error:


"/opt/arm-toolchain/linux/linaro/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/5.3.1/../../../.
./arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `clock_gettime@GLIBC_2.17'


I have read the man page that, clock_gettime is no longer exists until glibc 2.17, so, i removed clock_gettime from my own code, however,
I still got such error from the compiler. but the compiler can compile some other projects ok.
I hope somebody know how to resolve such problem.
thanks all.

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

* Re: how to fix "arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `clock_gettime@GLIBC_2.17'?
  2020-03-10 14:13 how to fix "arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `clock_gettime@GLIBC_2.17'? kipade
@ 2020-03-10 14:13 ` Florian Weimer
  2020-03-10 14:22   ` kipade
  0 siblings, 1 reply; 9+ messages in thread
From: Florian Weimer @ 2020-03-10 14:13 UTC (permalink / raw)
  To: kipade; +Cc: gcc-help

* kipade:

>  Hello, I use linaro gcc 5.3 to compile cpp files using -std=gnu++14, and I got an link error:
>
>
> "/opt/arm-toolchain/linux/linaro/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/5.3.1/../../../.
> ./arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `clock_gettime@GLIBC_2.17'

What's the full linker command line?

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

* Re:Re: how to fix "arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `clock_gettime@GLIBC_2.17'?
  2020-03-10 14:13 ` Florian Weimer
@ 2020-03-10 14:22   ` kipade
  2020-03-10 14:24     ` Florian Weimer
  0 siblings, 1 reply; 9+ messages in thread
From: kipade @ 2020-03-10 14:22 UTC (permalink / raw)
  To: Florian Weimer; +Cc: gcc-help

thanks for your reply. my link cmd is:
arm-linux-gnueabihf-g++ main.o -L ../arm_common/build/lib/ -larmcomm -pthread -lelf  -ldl -lrt



here, arm_common is my own lib for my use. because I use shm_xxx functions for shared memory,
so I have to link rt.


At 2020-03-10 22:13:54, "Florian Weimer" <fw@deneb.enyo.de> wrote:
>* kipade:
>
>>  Hello, I use linaro gcc 5.3 to compile cpp files using -std=gnu++14, and I got an link error:
>>
>>
>> "/opt/arm-toolchain/linux/linaro/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/5.3.1/../../../.
>> ./arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `clock_gettime@GLIBC_2.17'
>
>What's the full linker command line?

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

* Re: how to fix "arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `clock_gettime@GLIBC_2.17'?
  2020-03-10 14:22   ` kipade
@ 2020-03-10 14:24     ` Florian Weimer
  2020-03-10 14:35       ` kipade
  2020-03-10 15:01       ` kipade
  0 siblings, 2 replies; 9+ messages in thread
From: Florian Weimer @ 2020-03-10 14:24 UTC (permalink / raw)
  To: kipade; +Cc: gcc-help

* kipade:

>>> "/opt/arm-toolchain/linux/linaro/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/5.3.1/../../../.
>>> ./arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `clock_gettime@GLIBC_2.17'

> thanks for your reply. my link cmd is:
> arm-linux-gnueabihf-g++ main.o -L ../arm_common/build/lib/ -larmcomm -pthread -lelf  -ldl -lrt

This doesn't look particularly suspicious.

You need to double-check that your cross-compiler version matches the
glibc version you have installed for its use.  The error message
suggests that you are using an outdated glibc version that predates
the one that was used to build GCC and libstdc++.  (It's also possible
that you are not trying to link against glibc at all, but in that
case, more undefined symbols would show up, I think.)

(I assume this is a cross-compilation environment, so there's no risk
that there are Arm libraries on the host.)

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

* Re:Re: how to fix "arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `clock_gettime@GLIBC_2.17'?
  2020-03-10 14:24     ` Florian Weimer
@ 2020-03-10 14:35       ` kipade
  2020-03-10 14:39         ` Florian Weimer
  2020-03-10 15:01       ` kipade
  1 sibling, 1 reply; 9+ messages in thread
From: kipade @ 2020-03-10 14:35 UTC (permalink / raw)
  To: Florian Weimer; +Cc: gcc-help

And I checked the libstdc++.so, and really found the clock_gettime@GLIBC_2.17' reference call
with it. If so, was there a method to generate a smart method to fix that, for example, implement
my own function and exported it with the named symbol as clock_gettime@GLIBC_2.17 ?

At 2020-03-10 22:24:22, "Florian Weimer" <fw@deneb.enyo.de> wrote:
>* kipade:
>
>>>> "/opt/arm-toolchain/linux/linaro/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/5.3.1/../../../.
>>>> ./arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `clock_gettime@GLIBC_2.17'
>
>> thanks for your reply. my link cmd is:
>> arm-linux-gnueabihf-g++ main.o -L ../arm_common/build/lib/ -larmcomm -pthread -lelf  -ldl -lrt
>
>This doesn't look particularly suspicious.
>
>You need to double-check that your cross-compiler version matches the
>glibc version you have installed for its use.  The error message
>suggests that you are using an outdated glibc version that predates
>the one that was used to build GCC and libstdc++.  (It's also possible
>that you are not trying to link against glibc at all, but in that
>case, more undefined symbols would show up, I think.)
>
>(I assume this is a cross-compilation environment, so there's no risk
>that there are Arm libraries on the host.)

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

* Re: how to fix "arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `clock_gettime@GLIBC_2.17'?
  2020-03-10 14:35       ` kipade
@ 2020-03-10 14:39         ` Florian Weimer
       [not found]           ` <55b4e707.a652.170c4ecbadd.Coremail.kipade@163.com>
  0 siblings, 1 reply; 9+ messages in thread
From: Florian Weimer @ 2020-03-10 14:39 UTC (permalink / raw)
  To: kipade; +Cc: gcc-help

* kipade:

> And I checked the libstdc++.so, and really found the
> clock_gettime@GLIBC_2.17' reference call with it.

Would you be able to upload the libstdc++.so file and the
corresponding libc.so.6 file somewhere, preferably with the
corresponding source code?

Where do you get this GCC and glibc?

> If so, was there a method to generate a smart method to fix that,
> for example, implement my own function and exported it with the
> named symbol as clock_gettime@GLIBC_2.17 ?

It is possible to avoid the link error, but you will likely encounter
a run-time error after successful linking, so this is likely not going
to solve your issue.

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

* Re:Re: how to fix "arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `clock_gettime@GLIBC_2.17'?
  2020-03-10 14:24     ` Florian Weimer
  2020-03-10 14:35       ` kipade
@ 2020-03-10 15:01       ` kipade
  1 sibling, 0 replies; 9+ messages in thread
From: kipade @ 2020-03-10 15:01 UTC (permalink / raw)
  To: Florian Weimer; +Cc: gcc-help

Here, I attached my libstdc++.so.6.0.21, which is linked to libstdc++.so, and its a copy from my 
linaro compiler, which was download from linaro official website, named:
gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz



the so file is to large and failed to upload.
At 2020-03-10 22:24:22, "Florian Weimer" <fw@deneb.enyo.de> wrote:
>* kipade:
>
>>>> "/opt/arm-toolchain/linux/linaro/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/5.3.1/../../../.
>>>> ./arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `clock_gettime@GLIBC_2.17'
>
>> thanks for your reply. my link cmd is:
>> arm-linux-gnueabihf-g++ main.o -L ../arm_common/build/lib/ -larmcomm -pthread -lelf  -ldl -lrt
>
>This doesn't look particularly suspicious.
>
>You need to double-check that your cross-compiler version matches the
>glibc version you have installed for its use.  The error message
>suggests that you are using an outdated glibc version that predates
>the one that was used to build GCC and libstdc++.  (It's also possible
>that you are not trying to link against glibc at all, but in that
>case, more undefined symbols would show up, I think.)
>
>(I assume this is a cross-compilation environment, so there's no risk
>that there are Arm libraries on the host.)

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

* Re: how to fix "arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `clock_gettime@GLIBC_2.17'?
       [not found]           ` <55b4e707.a652.170c4ecbadd.Coremail.kipade@163.com>
@ 2020-03-10 15:12             ` Florian Weimer
  2020-03-10 15:20               ` kipade
  0 siblings, 1 reply; 9+ messages in thread
From: Florian Weimer @ 2020-03-10 15:12 UTC (permalink / raw)
  To: kipade; +Cc: gcc-help

* kipade:

> Here, I attached my libstdc++.so.6.0.21, which is linked to
> libstdc++.so, and its a copy from my linaro compiler, which was
> download from linaro official website.

There's nothing unusual about it.  What about the libc.so.6 file that
is pulled into the link?

Please upload it somewhere, and do not send it via email.  Also,
please make sure that they retrieve the right copy of the file (the
one that it is pulled into link).  g++ -v should show how GCC changes
the linker search paths.

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

* Re: how to fix "arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `clock_gettime@GLIBC_2.17'?
  2020-03-10 15:12             ` Florian Weimer
@ 2020-03-10 15:20               ` kipade
  0 siblings, 0 replies; 9+ messages in thread
From: kipade @ 2020-03-10 15:20 UTC (permalink / raw)
  To: Florian Weimer; +Cc: gcc-help

OK, I have to off line now. thanks.
I will prepare all details at a latter, time.


On 03/10/2020 23:12, Florian Weimer wrote:
* kipade:

> Here, I attached my libstdc++.so.6.0.21, which is linked to
> libstdc++.so, and its a copy from my linaro compiler, which was
> download from linaro official website.

There's nothing unusual about it.  What about the libc.so.6 file that
is pulled into the link?

Please upload it somewhere, and do not send it via email.  Also,
please make sure that they retrieve the right copy of the file (the
one that it is pulled into link).  g++ -v should show how GCC changes
the linker search paths.

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

end of thread, other threads:[~2020-03-10 15:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-10 14:13 how to fix "arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `clock_gettime@GLIBC_2.17'? kipade
2020-03-10 14:13 ` Florian Weimer
2020-03-10 14:22   ` kipade
2020-03-10 14:24     ` Florian Weimer
2020-03-10 14:35       ` kipade
2020-03-10 14:39         ` Florian Weimer
     [not found]           ` <55b4e707.a652.170c4ecbadd.Coremail.kipade@163.com>
2020-03-10 15:12             ` Florian Weimer
2020-03-10 15:20               ` kipade
2020-03-10 15:01       ` kipade

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