-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extra undefined symbols when compiling with flang-new
#5131
Comments
These appear to belong to flang's runtime library - I am not aware of any compiler flags to embed or suppress them, and OpenBLAS is certainly not trying to call any of those directly. Perhaps asking numpy to change their dlopen flags, or opening an issue ticket in llvm/llvm-project could be useful |
I'm a bit confused - grep'ing for _FortranACharacterCompareScalar1 in the library directory of my "official tarball" installation of LLVM-19.1.7 turns up only a single hit in libFortranRuntime.a, as if this static library was the only linking option. Does yours have a libFortranRuntime.so as well, by any chance ? |
I also see only a static libFortranRuntime.a in the binary release tarball of LLVM-20.1-rc2, so my conclusion for now is that you probably built LLVM from source with (possibly default) build options leading to the additional creation of a libFortranRuntime.so that subsequentially becomes the preferential pick for the linker when building any other software with this toolchain. (Building my own binaries of the compiler was certainly what I did at the time of my quoted comment) |
Thanks a lot for looking into this. I am indeed compiling LLVM from scratch. I will try to investigate more to understand what is happening under the hood and why this symbols are left as undefined |
Hmm, does your "home-built" libFortranRuntime.a contain any symbol records that start with |
Yes i've checked the symbols are there
i think for some reason the runtime library is not being linked everywhere it should but I've yet to pinpoint why.
It seems the runtime is being linked properly, have to check what could be causing it not to during the build process here
|
Interesting. Could it be something "simple" like whether the final link is initiated from flang or clang ? There is nothing in the build system of OpenBLAS that should expressly remove any reference to libFortranRuntime... btw are you building OpenBLAS with gmake, CMake, or - seeing that you're actually after Numpy - from numpy's Meson scripts ? |
Reproduced as a build difference between gmake and CMake - the gmake build of the shared library did not embed the flang-new runtime as a special build rule for "classic" flang was not applied to flang-new as well. Should be fixed by #5138 now. Note the static library contains only OpenBLAS' own symbols in either case, so always needs additional libraries linked |
Thanks, i can confirm this was indeed the problem
For the record I am experimenting with a full build of LLVM to see how far the new Weirdly it was not being caught by the build+tests of FlexiBLAS itself, will investigate that. Thank you very much for looking into this and the quick fix |
Thanks for confirming - I ran a couple of builds with different configurations last night until enlightenment came :) |
I've tried to compile OpenBLAS 0.3.27 and 0.3.29 with LLVM 19.1.1 and 20.1.0-rc1
clang/flang-new
.Everything works fine, test suite included, but there seems to be some extra undefined symbols that are usually not present when compiling with GCC
This is causing a problem in the specific when building numpy 1.26.4 on top of OpenBLAS, which seems to be triggered by the library being
dlopen
ed without the RTLD_LAZY flag triggering the undefined symbol error (_FortranACharacterCompareScalar1
in the specific case).It also seems to be related by the problem reported in #4868, specifically the comment by @martin-frbg #4868 (comment).
Not sure if there are some flags for building with
flang-new
that I am missing, or if this is not the right venue to report this.The text was updated successfully, but these errors were encountered: