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

cpp_source reports error with temp file path #194

Closed
renkun-ken opened this issue Jun 28, 2021 · 0 comments · Fixed by #198
Closed

cpp_source reports error with temp file path #194

renkun-ken opened this issue Jun 28, 2021 · 0 comments · Fixed by #198

Comments

@renkun-ken
Copy link
Contributor

cpp11::cpp_source() by default uses a temp directory to store the source files to compile. When an error occurs, however, the errors are also reported with a temp path like the following:

> cpp11::cpp_source("indention.cpp")                                                                                                                                                   
/tmp/RtmptYYXie/file3b9a74895bd2a/src/indention.cpp:6:47: error:xwas not declared in this scope
    6 | SEXP detect_comments(SEXP content, SEXP row = x)
      |                                               ^
make: *** [/usr/lib/R/etc/Makeconf:177: /tmp/RtmptYYXie/file3b9a74895bd2a/src/indention.o] Error 1
make: *** Waiting for unfinished jobs....
Error: Compilation failed.
Backtrace:
1: stop("Compilation failed.", call. = FALSE)
2: cpp11::cpp_source("indention.cpp")

where these files are immediately removed. If a code editor (e.g. VS Code) supports detecting file links in the terminal output, user could not jump to the line and column from these paths as they don't exist anymore.

I guess it might make more sense to show the original file paths in the error output.

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 a pull request may close this issue.

1 participant