Created
August 15, 2014 22:45
-
-
Save kevinushey/69e454895376ab7792f3 to your computer and use it in GitHub Desktop.
Find packages that may have binary incompatibilities on Mac OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
otool <- Sys.which("otool") | |
if (otool == "") { | |
stop("This utility requires 'otool' to run") | |
} | |
allPackages <- list.files(.libPaths(), full.names = TRUE) | |
stdLibsUsed <- lapply(allPackages, function(path) { | |
pkgName <- basename(path) | |
libPath <- file.path(path, "libs", paste0(pkgName, ".so")) | |
if (!file.exists(libPath)) { | |
return(character()) | |
} | |
otoolOutput <- system2("otool", args = c("-L", libPath), stdout = TRUE) | |
c( | |
"libc++"[any(grepl("libc++", otoolOutput, fixed = TRUE))], | |
"libstdc++"[any(grepl("libstdc++", otoolOutput, fixed = TRUE))] | |
) | |
}) | |
pkgsWithLibStdCpp <- allPackages[sapply(stdLibsUsed, function(x) { | |
"libstdc++" %in% x | |
})] | |
pkgsWithLibCpp <- allPackages[sapply(stdLibsUsed, function(x) { | |
"libc++" %in% x | |
})] | |
list( | |
"libstdc++" = pkgsWithLibStdCpp, | |
"libc++" = pkgsWithLibCpp | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you see some packages linked to
libstdc++
and others linked tolibc++
, you're probably going to have a bad time -- you should ensure all packages are using the same implementation of the C++ standard library.