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

Better stacktraces for ccall libraries that do not exist #33820

Merged
merged 2 commits into from
Dec 22, 2019

Conversation

vchuravy
Copy link
Sponsor Member

After:

julia> f() = ccall((:time, "doesnotexit"), Int, ())
f (generic function with 1 method)

julia> h() = f()
h (generic function with 1 method)

julia> h()
ERROR: ccall: could not load library
 in library doesnotexit
Stacktrace:
 [1] f at ./REPL[1]:1 [inlined]
 [2] h() at ./REPL[2]:1
 [3] top-level scope at REPL[3]:1

Before:

julia> f() = ccall((:time, "doesnotexit"), Int, ())
f (generic function with 1 method)

julia> h() = f()
h (generic function with 1 method)

julia> h()
ERROR: error compiling h: could not load library "doesnotexit"
doesnotexit.so: cannot open shared object file: No such file or directory
Stacktrace:
 [1] top-level scope at REPL[3]:1
caused by [exception 1]
could not load library "doesnotexit"
doesnotexit.so: cannot open shared object file: No such file or directory
Stacktrace:
 [1] top-level scope at REPL[3]:1

julia> g() = h()
g (generic function with 1 method)

julia> g()
ERROR: error compiling g: could not load library "doesnotexit"
doesnotexit.so: cannot open shared object file: No such file or directory
Stacktrace:
 [1] top-level scope at REPL[5]:1
caused by [exception 1]
could not load library "doesnotexit"
doesnotexit.so: cannot open shared object file: No such file or directory
Stacktrace:
 [1] top-level scope at REPL[5]:1

Currently we lose the ability to report why the library couldn't be opened.

cc: @maleadt @simonbyrne

@vtjnash
Copy link
Sponsor Member

vtjnash commented Dec 17, 2019

SGTM, can you fix the tests and we can get this into the release?

@vtjnash vtjnash added compiler:codegen Generation of LLVM IR and native code status:forget me not PRs that one wants to make sure aren't forgotten labels Dec 17, 2019
@vchuravy
Copy link
Sponsor Member Author

Any idea on how to get a better error?

src/ccall.cpp Outdated Show resolved Hide resolved
@vchuravy vchuravy force-pushed the vc/backtrace_ccall branch 2 times, most recently from 57a8460 to efb4497 Compare December 19, 2019 17:38
@vchuravy vchuravy marked this pull request as ready for review December 19, 2019 17:38
Copy link
Sponsor Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't dynamic semantics great? You don't have to codegen the errors—just fallback on the existing runtime.

@vchuravy vchuravy merged commit f6ca73a into master Dec 22, 2019
@vchuravy vchuravy deleted the vc/backtrace_ccall branch December 22, 2019 09:03
@simeonschaub simeonschaub removed the status:forget me not PRs that one wants to make sure aren't forgotten label May 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:codegen Generation of LLVM IR and native code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants