Commit 7f1fb9f
authored
re-export tbbmalloc from RcppParallel.dll on windows (#262)
* re-export tbbmalloc from RcppParallel.dll on windows
downstream packages on windows link with '-lRcppParallel' alone, and so
can only use tbb symbols that RcppParallel.dll exports. the tbb runtime
symbols come along implicitly -- RcppParallel references them, so those
archive members are linked in and re-exported via their '-export:'
directives -- but nothing references the tbbmalloc entry points, so
packages using the scalable allocator (e.g. via RcppArmadillo's
ARMA_USE_TBB_ALLOC) fail to link with undefined references to
scalable_malloc and scalable_free.
link tbbmalloc with --whole-archive so its objects are always included
and re-exported. tbbmalloc must precede tbb on the link line: both
archives bundle an itt_notify object defining the same symbols, and
with tbbmalloc's copy already linked, tbb's is never pulled in.
older (non-oneTBB) toolchains like rtools42 keep the plain link: there,
tbb and tbbmalloc both define DllMain and so cannot be linked wholesale,
and their objects carry no '-export:' directives to re-export anyhow.
* add test for downstream use of the scalable allocator
generates a small package using scalable_malloc and scalable_free via
the RcppParallel::CxxFlags() / RcppParallelLibs() flags, installs it,
and confirms the allocator can be used. on windows, this exercises the
tbbmalloc re-export from RcppParallel.dll; elsewhere, the run-time
resolution of tbbmalloc symbols loaded by RcppParallel::.onLoad().
the test builds a package, so it runs only on CI (or with NOT_CRAN),
and only when the tbb backend is enabled.
* clear R_TESTS when building the test package
R CMD check sets R_TESTS=startup.Rs when running tests, which breaks R
sub-processes run with a different working directory. the Rscript
invocations in the test package's Makevars failed at startup because of
this, expanding CxxFlags() and RcppParallelLibs() to nothing, so
compilation failed with tbb/scalable_allocator.h not found.1 parent d637cbe commit 7f1fb9f
3 files changed
Lines changed: 154 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
3 | 9 | | |
4 | 10 | | |
5 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
228 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
229 | 263 | | |
230 | 264 | | |
231 | 265 | | |
232 | 266 | | |
233 | 267 | | |
234 | 268 | | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
| 269 | + | |
240 | 270 | | |
241 | 271 | | |
242 | 272 | | |
| |||
0 commit comments