Skip to content
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

Elaborate 'ccall' requires the compiler error message #45857

Closed
wants to merge 1 commit into from

Conversation

sunho
Copy link
Contributor

@sunho sunho commented Jun 29, 2022

Recently, I was building julia with USE_BINARYBUILDER_LLVM=0 in order to try out my own llvm fork. Since I had a higher glibc in my local machine, libllvm failed to load as libstdc++ inside julia/usr/lib was outdated.

However, since the error message from load_library was intentioanlly silenced (err paramter is 0), there was no helpful error message printed out. The actual error message I got was in the screenshot below. As it points to completely unreleated direction, I had to spend lot of hours to track down what was going on.

image

This pr makes it better by priting warning message to stdout when codegen library failed to load so that we can identify this kind of llvm load error right away.

@vchuravy
Copy link
Member

Hm, I understand your motivation, but Julia is supposed to be able to start without Codegen available. So maybe we can instead make the ccall error message better?

@sunho
Copy link
Contributor Author

sunho commented Jun 29, 2022

Hmm, clarifying ccall error is definitely an option. It would be nice if we can differentiate library not found error and other unexpected error, though. In glibc error case, we can confidently tell it to user right?

@vchuravy
Copy link
Member

Yeah that would be fine. If the library is present and we failed to load it we should definitely warn the user about it.

@haampie
Copy link
Contributor

haampie commented Jun 29, 2022

See #45641 (comment) and below, libstdc++ detection in julia is incorrect: it locates libstdc++ in the implicit link directories of the fortran compiler assuming this can only be gfortran. But when using clang as a c++ compiler, it links to the libstdc++ of the most recent gcc it can find on the system (or in some cases llvm is compiled with a fixed, specific gcc toolchain), not the "default" gcc in the PATH. Same can happen when gfortran is from an older GCC than g++

@maleadt
Copy link
Member

maleadt commented Jun 30, 2022

Hm, I understand your motivation, but Julia is supposed to be able to start without Codegen available.

load_library could differentiate between "library does not exist" and "library is not loadable", the former is unlikely to be intentional.

FWIW, I also lost an hour on this yesterday, so would be in favor of better reporting. Especially during build, where we don't ever want to load a stubs library. So alternatively, we could introduce an -fno-stubs and use that during build?

@sunho sunho changed the title Print warning when codegen library failed to load. Elaborate 'ccall' requires the compiler error message Jul 1, 2022
@sunho
Copy link
Contributor Author

sunho commented Jul 1, 2022

I have editted the pr to just elaborate ccall error message. Good thing is even outside the boostrap, the ccall error message will pop up when codegen library failed to load.

@vtjnash
Copy link
Member

vtjnash commented Oct 25, 2022

we will fix this as the load_library layer

@vtjnash vtjnash closed this Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants