I did as the R extension documentation to set

PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CFLAGS)

in the src/Makevars file.

On linux it builds fine while on windows it gets various errors like:

undefined reference to `omp_get_num_threads'
undefined reference to `omp_get_thread_num'
undefined reference to `GOMP_barrier'

From the documentation I feel openmp is supported on Windows now. Is it right? How to solve the errors if it is supported by official Rtools?

An old post related: using openmp in windows R, does rtools support openmp? , which says openmp not supported on windows at that time.

有帮助吗?

解决方案

The error is actually caused by UTF-8 BOM in the src/Makevars.win file, removing BOM fixed it for me.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top