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.hes...@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?
>
Index: share/make/winshlib.mk
===================================================================
--- share/make/winshlib.mk	(revision 68364)
+++ share/make/winshlib.mk	(working copy)
@@ -10,13 +10,13 @@
 $(SHLIB): $(OBJECTS)
 	@if test "z$(OBJECTS)" != "z"; then \
 	  if test -e "$(BASE)-win.def"; then \
-	    echo $(SHLIB_LD) -shared $(DLLFLAGS) -o $@ $(BASE)-win.def $(OBJECTS) $(ALL_LIBS); \
-	    $(SHLIB_LD) -shared $(DLLFLAGS) -o $@ $(BASE)-win.def $(OBJECTS) $(ALL_LIBS); \
+	    echo $(SHLIB_LINK) -shared $(DLLFLAGS) -o $@ $(BASE)-win.def $(OBJECTS) $(ALL_LIBS); \
+	    $(SHLIB_LINK) -shared $(DLLFLAGS) -o $@ $(BASE)-win.def $(OBJECTS) $(ALL_LIBS); \
 	  else \
 	    echo EXPORTS > tmp.def; \
 	    $(NM) $^ | $(SED) -n $(SYMPAT) $(NM_FILTER) >> tmp.def; \
-	    echo $(SHLIB_LD) -shared $(DLLFLAGS) -o $@ tmp.def $(OBJECTS) $(ALL_LIBS); \
-	    $(SHLIB_LD) -shared $(DLLFLAGS) -o $@ tmp.def $(OBJECTS) $(ALL_LIBS); \
+	    echo $(SHLIB_LINK) -shared $(DLLFLAGS) -o $@ tmp.def $(OBJECTS) $(ALL_LIBS); \
+	    $(SHLIB_LINK) -shared $(DLLFLAGS) -o $@ tmp.def $(OBJECTS) $(ALL_LIBS); \
 	    $(RM) tmp.def; \
 	  fi \
 	fi
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to