Bug 16919 - Makeconf sets BINPREF incorrectly when building packages from source
Summary: Makeconf sets BINPREF incorrectly when building packages from source
Alias: None
Product: R
Classification: Unclassified
Component: Windows GUI / Window specific (show other bugs)
Version: R 3.3.*
Hardware: Other Windows 64-bit
: P5 minor
Assignee: R-core
Depends on:
Reported: 2016-05-22 16:43 UTC by duncan
Modified: 2018-01-05 14:44 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description duncan 2016-05-22 16:43:06 UTC
Building packages from source fails on Windows because BINPREF is set incorrectly when compiling both 32 and 64 bit versions.

1) Build package from source 
   > R CMD build X && R CMD INSTALL X

2) 64-bit build fails


Makeconf (both 32- and 64-bit) use conditional assignment for BINPREF (set-if-not-set):

BINPREF ?= X:/.../mingw_32/bin
BINPREF ?= X:/.../mingw_64/bin

This results in a problem.  When compiling for both architectures, BINPREF gets set on the 32-bit compile and then does not get reset for the 64-bit compile.  As a result the 64-bit compile will fail.

Since there is already a BINPREF64 field, perhaps set BINPREF to BINPREF64 if (and only if) BINPREF64 is set:

BINPREF ?= X:/.../mingw_64/bin
ifdef BINPREF64
Comment 1 Uwe Ligges 2016-05-22 17:16:53 UTC
Not true, otherwise we would not have have
Comment 2 Uwe Ligges 2016-05-22 17:19:20 UTC
Not true, otherwise we would not have have < 100 ERRORS on Windows for > 8000 packages on CRAN. You may want to ask your question on an appropriate mailing list including in example of your code that reproduces the problem you see.
Comment 3 duncan 2016-05-22 20:04:50 UTC
You're right, I mischaracterized the problem, sorry about that.  I was attempting to generalize it.  It is a problem, though.  Let me explain it like this:

I have tools in a nonstandard location.  There is no way for me to do a multiarchitecture build without editing Makeconf.  That's a change from 3.2. In the new build system, if you set BINPREF in your environment before building, the same value will be reused in 32- and 64- bit builds, which will not work.  (If you don't set BINPREF then you can't build).

I raised this as an issue because it is a change from 3.2 and seems like it is not what was intended.  If it is what was intended, then fine, I can work around it.  

Why do the 8000 packages build? Presumably because the build host has tools in the default location.
Comment 4 Joshua Ulrich 2018-01-05 14:44:20 UTC
I also encountered this issue. Since Rtools is not installed in C:/Rtools, BINPREF must be set for compilation to succeed. But 64-bit builds fail if you set BINPREF to .../Rtools/mingw_32/bin/ and BINPREF64 to .../Rtools/mingw_64/bin/ because BINPREF64 is not used for the x64 architecture build.

A minor change to Duncan's proposed solution worked for me. I added the following to $R_HOME/etc/x64/Makeconf:

ifdef BINPREF64