Created attachment 1629 [details]
Patch to add extern back to R_running_as_main_program
R_running_as_main_program lost its extern when it was migrated from 'src/main/Rmain.c' to 'src/include/Rinterface.h'.
If this was intentional, close this; otherwise I've attached a patch to change.
Reason: applications embedding R which include Rinterface.h in multiple components will have linker errors due to duplicate symbols.
--- Rinterface.h (revision 66251)
+++ Rinterface.h (working copy)
@@ -84,7 +84,7 @@
/* in unix/system.c */
+extern int R_running_as_main_program;
/* duplicating Defn.h */
Is there a resolution for this (R 3.2, on Ubuntu Precise)
Is there a resolution for this (R 3.2, on OS X Yosemite)?
Your patch seems to make sense. It's unfortunate that we do not have
a (hopefully small) reproducible example which shows the problem and shows that the change solves that problem.
I've committed the change to R-devel (-> R 3.3 in 2016)
and will port it to "R 3.2 patched" later -- notably if you can confirm it solves your problem.
+1 for fix.
I just helped one of my coworkers use this patch to fix a build problem using R and Rcpp and a large pile of code.
He's using Ubuntu 12.04 with r-base-core 3.2.0-1precise from http://cran.r-project.org/bin/linux/ubuntu/ precise/
We were having duplicate R_running_as_main_program symbols which I fixed by editing Rinterface.h and adding the extern, and recompiling the project.
His code has a bunch of object files loaded into a static library and then that was linked against a main.o, and with the broken implementation there was a conflict with every .o in static library.
from what i can see it’s in 3.2.1 (so it was backported)