Jim Hester
2015-May-11 16:28 UTC
[Rd] LDFLAGS defined in R_MAKEVARS_USER file is ignored for R CMD SHLIB on Windows
Example input and output to reproduce this can be found at https://gist.github.com/jimhester/b7f05f50794c88e44b17. I tested this attempting to compile the [digest]( http://cran.r-project.org/web/packages/digest/index.html) package, `run.sh` and `run.bat` were both run in the package source directory on Ubuntu 14.01 and Windows 7 respectively. In particular while the `CFLAGS` values were properly passed to the compiler on both Linux and Windows, the `LDFLAGS` value was only passed to the linker on Linux, which caused the subsequent linking errors on Windows. Perhaps this is intended behavior, if so is there a different compiler variable I can use to pass flags to the linker on Windows? [[alternative HTML version deleted]]
Jim Hester
2015-May-13 21:38 UTC
[Rd] LDFLAGS defined in R_MAKEVARS_USER file is ignored for R CMD SHLIB on Windows
I have tracked this discrepancy down to the use of `SHLIB_LD` rather than `SHLIB_LINK` in share/make/winshlib.mk <https://github.com/wch/r-source/blob/7348d71d1cb18e9c4b55950fd57198e8d2abcc8b/share/make/winshlib.mk>. This variable has been used in winshlib.mk since svn r47953 <https://github.com/wch/r-source/commit/3ebd185c0745bdc7cb8dd185bd7df5ff7f827f18>, however the corresponding shlib.mk for linux has always used `SHLIB_LINK` instead. The attached patch updates the variables in winshlib.mk to use `SHLIB_LINK` and makes the behavior consistent across platforms, which fixes my issue. On Mon, May 11, 2015 at 12:28 PM, Jim Hester <james.f.hester at gmail.com> wrote:> Example input and output to reproduce this can be found at > https://gist.github.com/jimhester/b7f05f50794c88e44b17. > > I tested this attempting to compile the [digest]( > http://cran.r-project.org/web/packages/digest/index.html) package, > `run.sh` and `run.bat` were both run in the package source directory on > Ubuntu 14.01 and Windows 7 respectively. > > In particular while the `CFLAGS` values were properly passed to the > compiler on both Linux and Windows, the `LDFLAGS` value was only passed to > the linker on Linux, which caused the subsequent linking errors on Windows. > > Perhaps this is intended behavior, if so is there a different compiler > variable I can use to pass flags to the linker on Windows? >-------------- next part -------------- A non-text attachment was scrubbed... Name: SHLIB_LINK.patch Type: text/x-patch Size: 1134 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20150513/bec77f6e/attachment.bin>