gadget-framework/gadget3

run_tmb filename hash should include compiler args?

Closed this issue · 0 comments

In a gadget3-Ex.Rout from Uwe Ligges:

> ## No test: 
> ## Don't show: 
> # NB: Making / optimising a TMB function is slow
> ## End(Don't show)
> # Compile to a TMB ADFun
> tmb <- g3_tmb_adfun(cpp, tmb_param)
using C++ compiler: 'g++.exe (GCC) 12.2.0'
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG -I"D:/RCompile/CRANpkg/lib/4.4/TMB/include" -I"D:/temp/RtmpQjAP2p/RLIBS_cef82d23673b/RcppEigen/include"  -DTMB_SAFEBOUNDS -DTMB_EIGEN_DISABLE_WARNINGS -DLIB_UNLOAD=R_unload_g3_tmb_458a1133285cd8c476fc29fb52652123ab818ec2  -DTMB_LIB_INIT=R_init_g3_tmb_458a1133285cd8c476fc29fb52652123ab818ec2  -DCPPAD_FRAMEWORK    -I"d:/rtools43/x86_64-w64-mingw32.static.posix/include"     -std=gnu++11 -Wno-ignored-attributes -DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS -O1 -march=native -c d:/temp/Rtmp2fsOXN/g3_tmb_458a1133285cd8c476fc29fb52652123ab818ec2.cpp -o d:/temp/Rtmp2fsOXN/g3_tmb_458a1133285cd8c476fc29fb52652123ab818ec2.o
g++ -std=gnu++17 -shared -s -static-libgcc -o d:/temp/Rtmp2fsOXN/g3_tmb_458a1133285cd8c476fc29fb52652123ab818ec2.dll tmp.def d:/temp/Rtmp2fsOXN/g3_tmb_458a1133285cd8c476fc29fb52652123ab818ec2.o -Ld:/rtools43/x86_64-w64-mingw32.static.posix/lib/x64 -Ld:/rtools43/x86_64-w64-mingw32.static.posix/lib -LD:/RCompile/recent/R/bin/x64 -lR
Constructing atomic logspace_add
Constructing atomic logspace_add
> 
> # NB: TMB::gdbsource() requires both "R" and "gdb" to be available
> if (all(nzchar(Sys.which(c('gdb', 'R'))))) {
+ 
+   # Build the model in an isolated R session w/debugger
+   writeLines(TMB::gdbsource(g3_tmb_adfun(
+       cpp,
+       compile_flags = "-g",
+       output_script = TRUE)))
+ 
+ }
using C++ compiler: 'g++.exe (GCC) 12.2.0'
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG -I"D:/RCompile/CRANpkg/lib/4.4/TMB/include" -I"D:/temp/RtmpQjAP2p/RLIBS_cef82d23673b/RcppEigen/include"  -DTMB_SAFEBOUNDS -DTMB_EIGEN_DISABLE_WARNINGS -DLIB_UNLOAD=R_unload_g3_tmb_458a1133285cd8c476fc29fb52652123ab818ec2  -DTMB_LIB_INIT=R_init_g3_tmb_458a1133285cd8c476fc29fb52652123ab818ec2  -DCPPAD_FRAMEWORK    -I"d:/rtools43/x86_64-w64-mingw32.static.posix/include"     -std=gnu++11 -Wno-ignored-attributes -DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS -g -c d:/temp/Rtmp2fsOXN/g3_tmb_458a1133285cd8c476fc29fb52652123ab818ec2.cpp -o d:/temp/Rtmp2fsOXN/g3_tmb_458a1133285cd8c476fc29fb52652123ab818ec2.o
g++ -std=gnu++17 -shared -s -static-libgcc -o d:/temp/Rtmp2fsOXN/g3_tmb_458a1133285cd8c476fc29fb52652123ab818ec2.dll tmp.def d:/temp/Rtmp2fsOXN/g3_tmb_458a1133285cd8c476fc29fb52652123ab818ec2.o -Ld:/rtools43/x86_64-w64-mingw32.static.posix/lib/x64 -Ld:/rtools43/x86_64-w64-mingw32.static.posix/lib -LD:/RCompile/recent/R/bin/x64 -lR
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: cannot open output file d:/temp/Rtmp2fsOXN/g3_tmb_458a1133285cd8c476fc29fb52652123ab818ec2.dll: Permission denied
collect2.exe: error: ld returned 1 exit status

It's trying to re-compile the source, but with the same filename.