From marko.robnik at fri.uni-lj.si  Sat Nov 20 20:25:11 2010
From: marko.robnik at fri.uni-lj.si (=?UTF-8?Q?Marko_Robnik-=C5=A0ikonja?=)
Date: Sat, 20 Nov 2010 20:25:11 +0100
Subject: [Rd] gomp library with Rtools212
In-Reply-To: <201011191311.14009.cubranic@stat.ubc.ca>
References: <001c01cb8802$a3055960$e9100c20$@fri.uni-lj.si>
	<201011191311.14009.cubranic@stat.ubc.ca>
Message-ID: <003a01cb88e8$a6443830$f2cca890$@fri.uni-lj.si>


> On November 19, 2010 07:58:40 am Marko Robnik-?ikonja wrote:
> > I am a maintainer of the CORElearn package which uses OpenMP
> > multithreading to speed up some computations. When producing a new
> > release we tested the package with the latest R 2.12.0. On Linux the
> > package works normally. On Windows we installed a recommended
> version of Rtools (Rtools212) but the linker fails with the messages below.
> [...]
> > Suspecting that errors may be caused by a wrong underscore convention
> > I experimented with the SYMPAT variable in etc/Makeconf, but without
> > success. My guess is that gomp library provided with
> > Rtools212 is using a different underscore convention as the rest of
> > the gcc. Can you suggest some solution, please?
> 
> On November 19, 2010 22:12 Davor Cubranic wrote:
> The cause is that Rtools does not include libthread, which libgomp depends
> on. I ran into the same problem as you (see the thread:
> http://article.gmane.org/gmane.comp.lang.r.devel/25764/). It didn't look
> like libthread will be allowed into RTools, so now we turn OpenMP off on
> Windows. Please let me know if you figure out a better solution.

Thank you, Davor for your suggestion, as well as Prof Ripley for his explanation posted to r-windows list. 
I have discovered TDM MinGW toolchain http://tdm-gcc.tdragon.net/ which does contain pthreads in both 32 and 64 bit version of the package. Using Makevars.win below I can produce both 32 and 64 bit version of the package. 

ARCH_FLAG = -m32
ifeq ($(R_ARCH),/x64)
  ARCH_FLAG = -m64
endif
PKG_CXXFLAGS = $(ARCH_FLAG) -fopenmp
PKG_LIBS = $(ARCH_FLAG) -fopenmp

As long as Rtools do not support openMP I will publish multithreaded Windows packages only on my website and diasble it on  CRAN.

Greetings, 

Marko



[Rd] gomp library with Rtools212
=?UTF-8?Q?Marko_Robnik-=C5=A0ikonja?=