Dear Kasper, Thank you very much. Using what you do in affxparser I can have the -O settings at will.
(It turns out that did not solve the "too many sections" problem though, as now the linker never exists; but that is a different story ---I am currently trying to see if I can get it to work with Rtools 40). Thanks again, R. On Fri, 24-May-2019, at 16:31:31, Kasper Daniel Hansen <kasperdanielhan...@gmail.com> wrote: > [ This is a crazy bug where you have to increase optimization. ] > > I some to add here. I am involved in at least two packages which requires > overriding the optimization switch to downgrade optimization. You have an > additional problem where you need to add additional flags. > > The solution in affxparser (see the source) is a custom compiler call where > we place -O0 before the system/package compiler flags. This is not a great > solution as it assumes that the compiler knows about -O notation (which is > true for GCC but not a true assumption everywhere). > > In Rgraphviz I have the same problem (but not solved yet because of ... > time). The issue here is that recent GCCs (v8 and higher) cannot be used > with -O3 but needs -O2. I have started to think about a better solution > than affxparser, to be used by the community, but have been a bit stumped. > Preferably I would like to use autoconf macro for detecting GCC, but when > we compile a package we are using the compiler encoded in R (aka $CC). So > somehow I want to run autoconf "detect which compiler is used" but for a > specific compiler. This is probably possible, but I don't know how right > now. > > Then, conditional on GCC I plan to do a regex which replaces -O3 with -O2. > This is not perfect either because the different -O3 optimizations can be > supplied as individual flags, and I don't know which flag it is which > breaks GCC. But it is must closer to the right solution. I don't know if > regex/sed'ing is better than overriding by changing the order as in > affxparser, but having the ability to do a conditional in Makevars would be > good. Of course, the autoconf route does not address Windows, but I think > we can assume / count on the fact that the RTools pipeline is used (aka, it > is always GCC). > > I would be happy to communicate more on this, to get this sorted out. It > has been a todo list item for me, for a while, and I should really try to > resolve it. > > But for a quick fix, look at affxparser. > > Best, > Kasper > > On Fri, May 24, 2019 at 10:16 AM Ramon Diaz-Uriarte <rdia...@gmail.com> > wrote: > >> >> Dear All, >> >> For a package we develop, OncoSimulR >> (https://bioconductor.org/packages/release/bioc/html/OncoSimulR.html), we >> have added new functionality >> (https://github.com/rdiaz02/OncoSimul/tree/freq-dep-fitness) that uses the >> ExprTk library[1] for parsing and evaluation of mathematical >> expressions. This works fine under Linux. But it is known[2] that ExprTk >> can fail when using MinGW with the "too many sections" error. >> >> >> A solution that has been suggested is to use -Wa,-mbig-obj with -O3 [3]. >> But I am unable to have R compile the package with -O3; -O3 is never >> placed at the right of the default -O2 no matter what I set in >> Makevars.win[4]. >> >> >> >> Any suggestions? >> >> Thanks, >> >> >> R. >> >> >> >> [1] http://www.partow.net/programming/exprtk/index.html >> [2] https://sourceforge.net/p/mingw-w64/discussion/723797/thread/c6b70624/ >> . >> [3] https://github.com/MrKepzie/Natron/blob/master/Engine/ExprTk.cpp >> "// exprtk requires -Wa,-mbig-obj on mingw, but there is a bug that >> prevents linking if not using -O3" >> >> See also, for example, >> https://discourse.mc-stan.org/t/too-many-sections/6261 >> >> [4] >> >> https://stackoverflow.com/questions/23414448/r-makevars-file-to-overwrite-r-cmds-default-g-options >> >> Our package has >> >> CXX_STD = CXX11 >> >> >> And I've tried: >> >> >> ## To the left of -O2 >> PKG_CXXFLAGS = -Wa,-mbig-obj -O3 >> >> ## To the left of -O2 >> PKG_CXXFLAGS += -Wa,-mbig-obj -O3 >> >> >> ## Also to the left of -O2 >> PKG_CPPFLAGS = -Wa,-mbig-obj -O3 >> >> ## Also to the left of -O2 >> PKG_CPPFLAGS += -Wa,-mbig-obj -O3 >> >> ## Ignored >> PKG_CXX11FLAGS = -Wa,-mbig-obj -O3 >> ## Ignored >> PKG_CXX11FLAGS += -Wa,-mbig-obj -O3 >> >> >> >> >> -- >> Ramon Diaz-Uriarte >> Department of Biochemistry, Lab B-25 >> Facultad de Medicina >> Universidad Autónoma de Madrid >> Arzobispo Morcillo, 4 >> 28029 Madrid >> Spain >> >> Phone: +34-91-497-2412 >> >> Email: rdia...@gmail.com >> ramon.d...@iib.uam.es >> >> http://ligarto.org/rdiaz >> >> _______________________________________________ >> Bioc-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/bioc-devel >> -- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-25 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain Phone: +34-91-497-2412 Email: rdia...@gmail.com ramon.d...@iib.uam.es http://ligarto.org/rdiaz _______________________________________________ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel