HenrikBengtsson / affxparser

🔬 R package: This is the Bioconductor devel version of the affxparser package.
http://bioconductor.org/packages/devel/bioc/html/affxparser.html
7 stars 3 forks source link

PORTABILITY: Package assumes GNU make #10

Closed HenrikBengtsson closed 9 years ago

HenrikBengtsson commented 9 years ago
* checking for GNU extensions in Makefiles ... WARNING
Found the following file(s) containing GNU extensions:
  src/Makevars
Portable Makefiles do not use GNU extensions such as +=, :=, $(shell),
$(wildcard), ifeq ... endif. See section ‘Writing portable packages’ in
the ‘Writing R Extensions’ manual.

More details https://travis-ci.org/HenrikBengtsson/affxparser/jobs/47449797

This is currently "solved" by adding the following to the DESCRIPTION file:

SystemRequirements: GNU make

such that R CMD check instead gives:

* checking for GNU extensions in Makefiles ... NOTE
GNU make is a SystemRequirements.

which may be an unnecessary restriction. Is there a simple fix?

HenrikBengtsson commented 9 years ago

The offending lines are in src/Makevars:

L7: PKG_CPPFLAGS+=\ 

and in src/Makevars.win:

L1: PKG_LIBS+=-lws2_32
...
L9: PKG_CPPFLAGS+=\ 
HenrikBengtsson commented 9 years ago

Trying to replace the above with:

PKG_CPPFLAGS=$(PKG_CPPFLAGS)\ 

gives

*** Recursive variable `PKG_CPPFLAGS' references itself (eventually).  Stop.

on both Linux and Windows.

HenrikBengtsson commented 9 years ago

The solution is to use:

[...] use simply-expanded variables (‘:=’ or ‘::=’) or use the append operator (‘+=’)

Furthermore, the GNU make documentation suggests to use ::= (and not :=), because:

Simply expanded variables are defined by lines using ‘:=’ or ‘::=’ (see Setting Variables). Both forms are equivalent in GNU make; however only the ‘::=’ form is described by the POSIX standard (support for ‘::=’ was added to the POSIX standard in 2012, so older versions of make won’t accept this form either).

However, trying with:

PKG_CPPFLAGS ::= $(PKG_CPPFLAGS) \ 

gives R CMD INSTALL error:

make: *** No rule to make target `=', needed by `PKG_CPPFLAGS'.  Stop.

on both Linux and Windows whereas

PKG_CPPFLAGS := $(PKG_CPPFLAGS) \ 

works!

kasperdanielhansen commented 9 years ago

You can have great fun submitting a bug report complaining why R does not support a POSIX standard in its make system :)

Or you can be happy its working :)

On Wed, Apr 15, 2015 at 2:43 PM, Henrik Bengtsson notifications@github.com wrote:

The solution https://www.gnu.org/software/make/manual/html_node/Error-Messages.html is to use:

[...] use simply-expanded variables (‘:=’ or ‘::=’) or use the append operator (‘+=’)

Furthermore, the GNU make documentation suggests to use ::= (and not :=), because https://www.gnu.org/software/make/manual/html_node/Flavors.html#Flavors:

Simply expanded variables are defined by lines using ‘:=’ or ‘::=’ (see Setting Variables). Both forms are equivalent in GNU make; however only the ‘::=’ form is described by the POSIX standard (support for ‘::=’ was added to the POSIX standard in 2012, so older versions of make won’t accept this form either).

However, trying with:

PKG_CPPFLAGS ::= $(PKG_CPPFLAGS) \

gives R CMD INSTALL error:

make: *\ No rule to make target =', needed byPKG_CPPFLAGS'. Stop.

on both Linux and Windows whereas

PKG_CPPFLAGS := $(PKG_CPPFLAGS) \

works!

— Reply to this email directly or view it on GitHub https://github.com/HenrikBengtsson/affxparser/issues/10#issuecomment-93528540 .

HenrikBengtsson commented 9 years ago

Yeah, I know. I think I stay quiet :)

BTW, Makevars is an R invention, correct? I cannot find any documentation on it outside R.

kasperdanielhansen commented 9 years ago

I think so.

On Wed, Apr 15, 2015 at 3:01 PM, Henrik Bengtsson notifications@github.com wrote:

Yeah, I know. I think I stay quiet :)

BTW, Makevars is an R invention, correct? I cannot find any documentation on it outside R.

— Reply to this email directly or view it on GitHub https://github.com/HenrikBengtsson/affxparser/issues/10#issuecomment-93533070 .

HenrikBengtsson commented 9 years ago

Argh, too soon, it worked, but only because I forgot to remove 'SystemRequirements: GNU make`. So now we're back to:

* checking for GNU extensions in Makefiles ... WARNING
Found the following file(s) containing GNU extensions:
  src/Makevars
Portable Makefiles do not use GNU extensions such as +=, :=, $(shell),
$(wildcard), ifeq ... endif. See section 'Writing portable packages' in
the 'Writing R Extensions' manual.
HenrikBengtsson commented 9 years ago

I think I finally solved this; we never needed:

PKG_LIBS := $(PKG_LIBS) -lws2_32

It was enough with

PKG_LIBS = -lws2_32

See commit 6478d11. All Bioc checks and Travis CI checks gives OK for this approach.