Skip to content

Generate dSYM file in install() on macOS #2598

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

Merged
merged 2 commits into from
Apr 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ Config/testthat/edition: 3
Encoding: UTF-8
Language: en-US
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# devtools (development version)

* On macOS, `install()` now generates `dSYM` sidecar files for native libraries by default.

* Functions that use httr now explicitly check that it is installed
(@catalamarti, #2573).

Expand Down
19 changes: 19 additions & 0 deletions R/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@
#' @param keep_source If `TRUE` will keep the srcrefs from an installed
#' package. This is useful for debugging (especially inside of RStudio).
#' It defaults to the option `"keep.source.pkgs"`.
#' @param generate_dsym (macOS only) If `TRUE`, and if the package includes a
#' native library (a `.so` file), a `dSYM` sidecar file is generated and
#' installed alongside the library. This file contains source and line
#' information that allows a debugger to step through original sources.
#'
#' Note that since `install()` operates from a temporary directory, the source
#' paths will point to dangling locations. You will need to remap these paths
#' to the actual sources on your disk, e.g. with lldb:
#'
#' ```
#' # Get information about the dangling temporary path for a function in your
#' # library
#' image lookup -vn my_function
#'
#' # Remap the dangling location to the actual package path
#' settings set target.source-map /private/tmp/Rtmpnl5XgE/R.INSTALLe5133dcc3211/mypackage /path/to/mypackage
#' ```
#' @param ... additional arguments passed to [remotes::install_deps()]
#' when installing dependencies.
#' @family package installation
Expand All @@ -50,6 +67,7 @@ install <-
build_vignettes = FALSE,
keep_source = getOption("keep.source.pkgs"),
force = FALSE,
generate_dsym = TRUE,
...) {
pkg <- as.package(pkg)

Expand All @@ -70,6 +88,7 @@ install <-

opts <- c(
if (keep_source) "--with-keep.source",
if (is_macos && generate_dsym) "--dsym",
"--install-tests"
)
if (quick) {
Expand Down
1 change: 1 addition & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ compact <- function(x) {
}

is_windows <- isTRUE(.Platform$OS.type == "windows")
is_macos <- isTRUE(tolower(Sys.info()[["sysname"]]) == "darwin")

sort_ci <- function(x) {
withr::with_collate("C", x[order(tolower(x), x)])
Expand Down
18 changes: 18 additions & 0 deletions man/install.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.