Hi,
I'm compiling OpenBLAS 0.3.9 with AOCC 2.1.0 on Zen 2 (3600X), on Ubuntu 20.04 LTS. It fails when linking the test executables with the following error message:
flang -O1 -frecursive -Wall -fopenmp -o cblat1 cblat1.o ../libopenblas_zenp-r0.3.9.dev.a -lm -lpthread -lm -lpthread -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/usr/lib/x86_64-linux-gnu/../../lib64 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. -L/opt/AMD/aocc-compiler-2.1.0/bin/../lib -L/lib -L/usr/lib -L/opt/AMD/aocc-compiler-2.1.0/lib -L/opt/AMD/aocc-compiler-2.1.0/lib32 -lpthread -lc
clang-9: warning: argument unused during compilation: '-frecursive' [-Wunused-command-line-argument]
ld.lld: error: /opt/AMD/aocc-compiler-2.1.0/bin/../lib/libflang.so: undefined reference to stime
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Makefile:167: zblat1] Error 1
make[1]: *** Waiting for unfinished jobs....
ld.lld: error: /opt/AMD/aocc-compiler-2.1.0/bin/../lib/libflang.so: undefined reference to stime
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Makefile:164: cblat1] Error 1
I invoked make with the following options:
$ make -j 12 CC=clang FC=flang USE_OPENMP=1
Googling around gives a hint that stime was removed in Glibc 2.31; see this page, for instance.
Is this a bug in OpenBLAS or in AOCC?
Compiling with GCC 9.3.0 (the default version from Ubuntu 20.04 repositories) works just fine.
edit: Added specific CPU model
Definitely AOCC's issue, not OpenBLAS
Strange that I did not notice this, but would indeed be related to glibc version. There is nothing in OpenBLAS that would need to call stime(), so AOCC bug as isuruf wrote.
I sent AMD support an email, and here's the reply. I'm putting this out here for anyone else that might be affected:
Thanks for your mail.
The issue is reproducible with AOCC 2.1 on Ubuntu 20.04 LTS which comes with GLIBC v2.31. The fix will be available with upcoming release of AOCC Compiler version 2.2.
We will inform you once the latest compiler is released.We encourage you to use AOCL2.1 libraries (you can find latest version here: https://developer.amd.com/amd-aocl/) with AOCC2.1.
Regards
Toolchain Support
Here's a follow-up email from AMD toolchain support, describing a workaround until AOCC 2.2 gets released.
The issue is because the library function stime is removed from GLIBC version of ubuntu 20.04 and flang is referencing the library function.
One alternative is to create a C function
stimeand link this C file withflang.--
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
Edit: AOCC 2.2 has been released.
Most helpful comment
https://github.com/flang-compiler/flang/pull/886