Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build under Windows #3

Open
jonathan-g opened this issue Jul 5, 2019 · 1 comment
Open

Cannot build under Windows #3

jonathan-g opened this issue Jul 5, 2019 · 1 comment

Comments

@jonathan-g
Copy link

Under windows, with go 1.12.6 (AMD 64) with R 3.6.0, I cannot build this.

I created a Makevars.win with the following:

.PHONY: go

CGO_CFLAGS = "$(ALL_CPPFLAGS)"
CGO_LDFLAGS = "$(PKG_LIBS) $(SHLIB_LIBADD) $(LIBR)"
GOPATH = $(CURDIR)/go
GCCPATH = $(abspath $(shell $(R_HOME)/bin$(R_ARCH_BIN)/R CMD config CC))
GCCDIR = $(dir $(GCCPATH))

export PATH := $(PATH):$(GCCDIR)

go:
	rm -f gotest.h
	CGO_CFLAGS=$(CGO_CFLAGS) CGO_LDFLAGS=$(CGO_LDFLAGS) GOPATH=$(GOPATH)  go build -o $(SHLIB) -x -buildmode=c-shared main

If I run devtools::install(args="--no-multiarch"), the go build process executes without reporting errors, but R complains

** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for 'gotest' in inDL(x, as.logical(local), as.logical(now), ...):
 unable to load shared object 'C:/Users/<username>/Documents/R-dev/00LOCK-gotest/00new/gotest/libs/x64/gotest.dll':
  LoadLibrary failure:  A dynamic link library (DLL) initialization routine failed.

Error: loading failed
Execution halted
ERROR: loading failed
* removing 'C:/Users/<username>/Documents/R-dev/gotest'

I realize that this is an experimental package, not a supported product, so I'm not expecting anyone else to solve my problem, but if you have any suggestions to help me start to try figuring out what the problem is, I would be grateful.

Session info is:


- Session info ----------------------------------------------------------------------------------------------------------
setting  value                         
version  R version 3.6.0 (2019-04-26)  
os       Windows 10 x64                
system   x86_64, mingw32               
ui       RStudio                       
language (EN)                          
collate  English_United States.1252    
ctype    English_United States.1252    
tz       America/New_York              
date     2019-07-05                    

- Packages ---------------------------------------------------------------------------------------------
package     * version date       lib source          
assertthat    0.2.1   2019-03-21 [2] CRAN (R 3.6.0)  
backports     1.1.4   2019-04-10 [2] CRAN (R 3.6.0)  
callr         3.3.0   2019-07-04 [2] CRAN (R 3.6.0)  
cli           1.1.0   2019-03-19 [2] CRAN (R 3.6.0)  
commonmark    1.7     2018-12-01 [2] CRAN (R 3.6.0)  
crayon        1.3.4   2017-09-16 [2] CRAN (R 3.6.0)  
desc          1.2.0   2018-05-01 [2] CRAN (R 3.6.0)  
devtools    * 2.0.2   2019-04-08 [2] CRAN (R 3.6.0)  
digest        0.6.20  2019-07-04 [2] CRAN (R 3.6.0)  
fs            1.3.1   2019-05-06 [2] CRAN (R 3.6.0)  
glue          1.3.1   2019-03-12 [2] CRAN (R 3.6.0)  
magrittr      1.5     2014-11-22 [2] CRAN (R 3.6.0)  
memoise       1.1.0   2017-04-21 [2] CRAN (R 3.6.0)  
packrat       0.5.0   2018-11-14 [2] CRAN (R 3.6.0)  
pkgbuild      1.0.3   2019-03-20 [2] CRAN (R 3.6.0)  
pkgload       1.0.2   2018-10-29 [2] CRAN (R 3.6.0)  
prettyunits   1.0.2   2015-07-13 [2] CRAN (R 3.6.0)  
processx      3.4.0   2019-07-03 [2] CRAN (R 3.6.0)  
ps            1.3.0   2018-12-21 [2] CRAN (R 3.6.0)  
purrr         0.3.2   2019-03-15 [2] CRAN (R 3.6.0)  
R6            2.4.0   2019-02-14 [2] CRAN (R 3.6.0)  
rcmdcheck     1.3.3   2019-05-07 [2] CRAN (R 3.6.0)  
Rcpp          1.0.1   2019-03-17 [2] CRAN (R 3.6.0)  
remotes       2.1.0   2019-06-24 [2] CRAN (R 3.6.0) 
rlang         0.4.0   2019-06-25 [2] CRAN (R 3.6.0)  
roxygen2      6.1.1   2018-11-07 [2] CRAN (R 3.6.0) 
rprojroot     1.3-2   2018-01-03 [2] CRAN (R 3.6.0)  
rstudioapi    0.10    2019-03-19 [2] CRAN (R 3.6.0)  
sessioninfo   1.1.1   2018-11-05 [2] CRAN (R 3.6.0)  
stringi       1.4.3   2019-03-12 [2] CRAN (R 3.6.0)  
stringr       1.4.0   2019-02-10 [2] CRAN (R 3.6.0)  
testthat      2.1.1   2019-04-23 [2] CRAN (R 3.6.0)  
usethis     * 1.5.1   2019-07-04 [2] CRAN (R 3.6.0)  
withr         2.1.2   2018-03-15 [2] CRAN (R 3.6.0)  
xml2          1.2.0   2018-01-24 [2] CRAN (R 3.6.0)  
xopen         1.0.0   2018-09-17 [2] CRAN (R 3.6.0)  

[1] C:/Users/<username>/Documents/R-dev 
[2] C:/Users/<username>/Documents/R/win-library/3.6 
[3] C:/Program Files/R/R-3.6.0/library
--
@paithiov909
Copy link

paithiov909 commented Oct 3, 2020

I think this package still can be installed on Windows.

If you need to write your own Makevars.win, that would be somthing like this.

.PHONY: go

CGO_CFLAGS = "$(ALL_CPPFLAGS)"
CGO_LDFLAGS = "$(PKG_LIBS) $(SHLIB_LIBADD) $(LIBR)"
GOPATH = $(CURDIR)/go

go:
	rm -f gotest.h
	export PATH="$(PATH):$(shell $(R_HOME)/bin$(R_ARCH_BIN)/Rcmd config CC))"
	CGO_CFLAGS=$(CGO_CFLAGS) CGO_LDFLAGS=$(CGO_LDFLAGS) GOPATH=$(GOPATH) go build -o $(SHLIB) -x -buildmode=c-shared main

However, this package requires no Windows specific considerations when building, it is optional to write Makevars.win.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants