cancel
Showing results for 
Search instead for 
Did you mean: 

Server Processors

gmichelitsch
Journeyman III

linker error in AOCC-2.1.0 because of stime removal in glibc-2.31

Dear community,

I just installed the aocc-compiler and it compiles my code but at the linker stage exits with the following error:

ld.lld: error: /opt/aocc/bin/../lib/libflang.so: undefined reference to stime
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)

From what I gather this happens because of the deprecation and removal of stime in glibc-2.31 and has been fixed upstream in flang [0]. Is there a workaround or do we know when an updated version of the compiler will be released?

Thanks in advance,

Georg

[0] Replaced deprecated function stime which is removed in glibc 2.31 by arjunsuresh1987 · Pull Request ... 

0 Likes
2 Replies

One alternative is to create a C function stime and link this C file with flang.

 

-- stime.c ---

 

#include <time.h>

int stime(const time_t *t)

{

  struct timespec ts = {};

  ts.tv_sec = *t;

  return clock_settime(CLOCK_REALTIME, &ts); }

 

$ flang test.f90 stime.c

 

Please let us know if above helps.

Hah, brilliant idea. It works as a workaround for a small toy project on which I tested Thanks!

0 Likes