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

patch about windows build #23

Closed
armgong opened this issue Jan 27, 2014 · 5 comments
Closed

patch about windows build #23

armgong opened this issue Jan 27, 2014 · 5 comments

Comments

@armgong
Copy link

armgong commented Jan 27, 2014

hello radford , following patch need apply to build pqR on windows .

diff --git a/src/gnuwin32/Makefile b/src/gnuwin32/Makefile
index d7563fa..2eab999 100644
--- a/src/gnuwin32/Makefile
+++ b/src/gnuwin32/Makefile
@@ -144,21 +144,31 @@ fixed/fixdesc:

 dllversion.o: ../include/Rversion.h

+ifeq "$(WIN)" "64"
 R.dll: $(OBJS) $(OBJS-EXTRA) $(MAINLIBS) $(EXTRALIBS) dllversion.o
    @$(ECHO) EXPORTS > R.def
-   @$(NM) $^ | $(SED) -n  $(SYMPAT)  | $(SORT) | uniq > R0.def
-   @comm -23 R0.def Rdll.hide >> R.def
+   @$(NM) $^ | $(SED) -n  $(SYMPAT) | LC_COLLATE=C $(SORT) | uniq > R0.def
+   @$(SED) -e's/@.*//' Rdll.hide | LC_COLLATE=C $(SORT) > R1.def
+   @LC_COLLATE=C comm -23 R0.def R1.def >> R.def
    $(DLL) -shared $(DLLFLAGS) $($*-DLLFLAGS) -o $@ R.def $^ $($*-DLLLIBS) $(DLLLIBS)
-   @$(RM) R.def R0.def
+   @$(RM) R.def R0.def R1.def
+else
+R.dll: $(OBJS) $(OBJS-EXTRA) $(MAINLIBS) $(EXTRALIBS) dllversion.o
+   @$(ECHO) EXPORTS > R.def
+   @$(NM) $^ | $(SED) -n  $(SYMPAT) | LC_COLLATE=C $(SORT) | uniq > R0.def
+   @LC_COLLATE=C $(SORT) Rdll.hide > R1.def
+   @LC_COLLATE=C comm -23 R0.def R1.def >> R.def
+   $(DLL) -shared $(DLLFLAGS) $($*-DLLFLAGS) -o $@ R.def $^ $($*-DLLLIBS) $(DLLLIBS)
+   @$(RM) R.def R0.def R1.def
+endif

 R.exp: $(OBJS) $(OBJS-EXTRA) $(MAINLIBS) $(EXTRALIBS) dllversion.o
    @$(ECHO) LIBRARY R.dll > R.exp
    @$(ECHO) EXPORTS >> R.exp
-   @$(NM) $^ | $(SED) -n $(SYMPAT) | $(SORT) | uniq > R0.def
-   @comm -23 R0.def Rdll.hide >> R.exp
+   @$(NM) $^ | $(SED) -n $(SYMPAT) | LC_COLLATE=C $(SORT) | uniq > R0.def
+   @LC_COLLATE=C comm -23 R0.def Rdll.hide >> R.exp
    @$(RM) R0.def

-
 Rdll: makeMakedeps libRblas.dll.a ../../$(BINDIR)/R.dll

 ../../$(BINDIR)/R.dll: FORCE
@@ -207,10 +217,10 @@ front-ends:
    $(MK) -C ../extra/xz -f Makefile.win

 ../extra/helpers/libhelpers.a:
-  $(MK) -C ../extra/helpers -f Makefile.win
+   $(MK) -C ../extra/helpers -f Makefile.win

 ../extra/matprod/libmatprod.a:
-  $(MK) -C ../extra/matprod -f Makefile.win
+   $(MK) -C ../extra/matprod -f Makefile.win

 NEWSdocs:
    @$(MK) -C ../../doc -f Makefile.win

diff --git a/src/gnuwin32/fixed/h/config.h b/src/gnuwin32/fixed/h/config.h
index 16aa745..d5fd06d 100644:
--- a/src/gnuwin32/fixed/h/config.h
+++ b/src/gnuwin32/fixed/h/config.h
@@ -521,14 +521,15 @@
 #define R_MAT_MULT_WITH_BLAS_IN_HELPERS_OK 1

 /* Define this to make mat_mult_with_BLAS default to TRUE. */
-/* #undef R_MAT_MULT_WITH_BLAS_BY_DEFAULT */
+#define R_MAT_MULT_WITH_BLAS_BY_DEFAULT 1
+//#define R_INLINE 1

 /* Define this to enable deferred evaluation / helpers. */
 #define R_DEFERRED_EVAL 1

 /* Define this to enable helper threads. */
 #define R_HELPER_THREADS 1
-
+#define R_TASK_MERGING 1
 /* Define to 1 if you have pangocairo. */
 /* #undef HAVE_PANGOCAIRO */


diff --git a/src/main/platform.c b/src/main/platform.c
index b425c45..d252e5b 100644
--- a/src/main/platform.c
+++ b/src/main/platform.c
@@ -1336,6 +1336,9 @@ static SEXP do_filechoose(SEXP call, SEXP op, SEXP args, SEXP rho)
    error(_("file name too long"));
     return mkString(R_ExpandFileName(buf));
 }
+#else
+extern SEXP do_filechoose(SEXP call, SEXP op, SEXP args, SEXP rho);
+
 #endif

 /* needed for access, and perhaps for realpath */
diff --git a/src/main/util.c b/src/main/util.c
index 732ff62..f8cae6f 100644
--- a/src/main/util.c
+++ b/src/main/util.c
@@ -1219,6 +1219,8 @@ static SEXP do_normalizepath(SEXP call, SEXP op, SEXP args, SEXP rho)
     UNPROTECT(1);
     return ans;
 }
+#else
+extern SEXP do_normalizepath(SEXP call, SEXP op, SEXP args, SEXP rho);
 #endif
@radfordneal
Copy link
Owner

Thanks for finding these problems. I'll put fixes for them similar to yours above in the new release (which should be out in a day or so), except that I think I won't change the default for R_MAT_MULT_WITH_BLAS_BY_DEFAULT.

Here's a diff of my current version:

diff --git a/src/gnuwin32/Makefile b/src/gnuwin32/Makefile
index d7563fa..86a13c7 100644
--- a/src/gnuwin32/Makefile
+++ b/src/gnuwin32/Makefile
@@ -147,15 +147,20 @@ dllversion.o: ../include/Rversion.h
 R.dll: $(OBJS) $(OBJS-EXTRA) $(MAINLIBS) $(EXTRALIBS) dllversion.o
        @$(ECHO) EXPORTS > R.def
        @$(NM) $^ | $(SED) -n  $(SYMPAT)  | $(SORT) | uniq > R0.def
-       @comm -23 R0.def Rdll.hide >> R.def
+ifeq "$(WIN)" "64"
+       @$(SED) -e's/@.*//' Rdll.hide | $(SORT) > R1.def
+else
+       @$(SORT) <Rdll.hide >R1.def
+endif
+       @$(COMM) -23 R0.def R1.def >> R.def
        $(DLL) -shared $(DLLFLAGS) $($*-DLLFLAGS) -o $@ R.def $^ $($*-DLLLIBS) $(DLLLIBS)
-       @$(RM) R.def R0.def
+       @$(RM) R.def R0.def R1.def

 R.exp: $(OBJS) $(OBJS-EXTRA) $(MAINLIBS) $(EXTRALIBS) dllversion.o
        @$(ECHO) LIBRARY R.dll > R.exp
        @$(ECHO) EXPORTS >> R.exp
        @$(NM) $^ | $(SED) -n $(SYMPAT) | $(SORT) | uniq > R0.def
-       @comm -23 R0.def Rdll.hide >> R.exp
+       @$(COMM) -23 R0.def Rdll.hide >> R.exp
        @$(RM) R0.def


@@ -207,10 +212,10 @@ front-ends:
        $(MK) -C ../extra/xz -f Makefile.win

 ../extra/helpers/libhelpers.a:
-  $(MK) -C ../extra/helpers -f Makefile.win
+       $(MK) -C ../extra/helpers -f Makefile.win

 ../extra/matprod/libmatprod.a:
-  $(MK) -C ../extra/matprod -f Makefile.win
+       $(MK) -C ../extra/matprod -f Makefile.win

 NEWSdocs:
        @$(MK) -C ../../doc -f Makefile.win
diff --git a/src/gnuwin32/MkRules.rules b/src/gnuwin32/MkRules.rules
index 2dfb033..0b94546 100644
--- a/src/gnuwin32/MkRules.rules
+++ b/src/gnuwin32/MkRules.rules
@@ -69,7 +69,8 @@ RESCOMP=$(BINPREF)windres $(RC_ARCH)
 # as set by make
 RM=rm -f
 SED=sed
-SORT=sort
+SORT=LC_COLLATE=C sort
+COMM=LC_COLLATE=C comm

 .SUFFIXES:
 .SUFFIXES: .c .cc .cpp .C .f .o .a .def .exp .dll .exe .d .f90 .f95 .m .S
diff --git a/src/gnuwin32/fixed/h/config.h b/src/gnuwin32/fixed/h/config.h
index 16aa745..f140b3e 100644
--- a/src/gnuwin32/fixed/h/config.h
+++ b/src/gnuwin32/fixed/h/config.h
@@ -529,6 +529,9 @@
 /* Define this to enable helper threads. */
 #define R_HELPER_THREADS 1

+/* Define this to enable task merging. */
+#define R_TASK_MERGING 1
+
 /* Define to 1 if you have pangocairo. */
 /* #undef HAVE_PANGOCAIRO */

diff --git a/src/main/platform.c b/src/main/platform.c
index b425c45..f47ab0b 100644
--- a/src/main/platform.c
+++ b/src/main/platform.c
@@ -1323,7 +1323,9 @@ static SEXP do_fileexists(SEXP call, SEXP op, SEXP args, SEXP rho)

 #define CHOOSEBUFSIZE 1024

-#ifndef Win32
+#ifdef Win32 /* Windows version is in src/gnuwin32/extra.c */
+extern SEXP do_filechoose(SEXP call, SEXP op, SEXP args, SEXP rho);
+#else
 static SEXP do_filechoose(SEXP call, SEXP op, SEXP args, SEXP rho)
 {
     int _new, len;
diff --git a/src/main/util.c b/src/main/util.c
index cfba02c..72759d3 100644
--- a/src/main/util.c
+++ b/src/main/util.c
@@ -1144,7 +1144,9 @@ static SEXP do_dirname(SEXP call, SEXP op, SEXP args, SEXP rho)
 #endif


-#ifndef Win32 /* Windows version is in src/gnuwin32/extra.c */
+#ifdef Win32 /* Windows version is in src/gnuwin32/extra.c */
+extern SEXP do_normalizepath(SEXP call, SEXP op, SEXP args, SEXP rho);
+#else
 #ifndef HAVE_DECL_REALPATH
 extern char *realpath(const char *path, char *resolved_path);
 #endif

@radfordneal
Copy link
Owner

Above patch is now in the new release of 2014-02-23.

@armgong
Copy link
Author

armgong commented Jul 9, 2014

on windows makefile still need modify ,you patch have problem,define sort and comm add LC_COLLATE=C behind them not slove it,must like following

--- a/src/gnuwin32/Makefile
+++ b/src/gnuwin32/Makefile
@@ -144,26 +144,33 @@ fixed/fixdesc:

 dllversion.o: ../include/Rversion.h

+ifeq "$(WIN)" "64"
 R.dll: $(OBJS) $(OBJS-EXTRA) $(MAINLIBS) $(EXTRALIBS) dllversion.o
    @$(ECHO) EXPORTS > R.def
-   @$(NM) $^ | $(SED) -n  $(SYMPAT)  | $(SORT) | uniq > R0.def
-ifeq "$(WIN)" "64"
-   @$(SED) -e's/@.*//' Rdll.hide | $(SORT) > R1.def    
+   @$(NM) $^ | $(SED) -n  $(SYMPAT) | LC_COLLATE=C $(SORT) | uniq > R0.def
+   @$(SED) -e's/@.*//' Rdll.hide | LC_COLLATE=C $(SORT) > R1.def
+   @LC_COLLATE=C comm -23 R0.def R1.def >> R.def
+   $(DLL) -shared $(DLLFLAGS) $($*-DLLFLAGS) -o $@ R.def $^ $($*-DLLLIBS) $(DLLLIBS)
+   @$(RM) R.def R0.def R1.def
 else
-   @$(SORT) <Rdll.hide >R1.def
-endif
-   @$(COMM) -23 R0.def R1.def >> R.def
+R.dll: $(OBJS) $(OBJS-EXTRA) $(MAINLIBS) $(EXTRALIBS) dllversion.o
+   @$(ECHO) EXPORTS > R.def
+   @$(NM) $^ | $(SED) -n  $(SYMPAT) | LC_COLLATE=C $(SORT) | uniq > R0.def
+   @LC_COLLATE=C $(SORT) Rdll.hide > R1.def
+   @LC_COLLATE=C comm -23 R0.def R1.def >> R.def
    $(DLL) -shared $(DLLFLAGS) $($*-DLLFLAGS) -o $@ R.def $^ $($*-DLLLIBS) $(DLLLIBS)
    @$(RM) R.def R0.def R1.def
+endif

 R.exp: $(OBJS) $(OBJS-EXTRA) $(MAINLIBS) $(EXTRALIBS) dllversion.o
    @$(ECHO) LIBRARY R.dll > R.exp
    @$(ECHO) EXPORTS >> R.exp
-   @$(NM) $^ | $(SED) -n $(SYMPAT) | $(SORT) | uniq > R0.def
-   @$(COMM) -23 R0.def Rdll.hide >> R.exp
+   @$(NM) $^ | $(SED) -n $(SYMPAT) | LC_COLLATE=C $(SORT) | uniq > R0.def
+   @LC_COLLATE=C comm -23 R0.def Rdll.hide >> R.exp
    @$(RM) R0.def


+
 Rdll: makeMakedeps libRblas.dll.a ../../$(BINDIR)/R.dll

 ../../$(BINDIR)/R.dll: FORCE

diff --git a/src/gnuwin32/MkRules.rules b/src/gnuwin32/MkRules.rules
index 0b94546..989975b 100644
--- a/src/gnuwin32/MkRules.rules
+++ b/src/gnuwin32/MkRules.rules
@@ -69,8 +69,8 @@ RESCOMP=$(BINPREF)windres $(RC_ARCH)
 # as set by make
 RM=rm -f
 SED=sed
-SORT=LC_COLLATE=C sort
-COMM=LC_COLLATE=C comm
+SORT=sort
+COMM=comm

@radfordneal
Copy link
Owner

Thanks. I think I tried to be too clever in setting the COLLATE stuff.

I plan to try Windows building myself soon, so I can catch these things.

Radford

On 9 July 2014 06:37, Yu Gong notifications@github.com wrote:

on windows makefile still need modify ,you patch have problem
--- a/src/gnuwin32/Makefile
+++ b/src/gnuwin32/Makefile
@@ -144,26 +144,33 @@ fixed/fixdesc:

dllversion.o: ../include/Rversion.h

+ifeq "$(WIN)" "64"
R.dll: $(OBJS) $(OBJS-EXTRA) $(MAINLIBS) $(EXTRALIBS) dllversion.o
@$(ECHO) EXPORTS > R.def

  • @$(NM) $^ | $(SED) -n $(SYMPAT) | $(SORT) | uniq > R0.def -ifeq
    "$(WIN)" "64"

  • @$(SED) -e's/@.*//' Rdll.hide | $(SORT) > R1.def

    • @$(NM) $^ | $(SED) -n $(SYMPAT) | LC_COLLATE=C $(SORT) | uniq >
      R0.def
  • @$(SED) -e's/@.*//' Rdll.hide | LC_COLLATE=C $(SORT) > R1.def

  • @LC_COLLATE=C comm -23 R0.def R1.def >> R.def

  • $(DLL) -shared $(DLLFLAGS) $($-DLLFLAGS) -o $@ R.def $^ $($-DLLLIBS)
    $(DLLLIBS)

  • @$(RM) R.def R0.def R1.def else

  • @$(SORT) R1.def -endif

  • @$(COMM) -23 R0.def R1.def >> R.def +R.dll: $(OBJS) $(OBJS-EXTRA)
    $(MAINLIBS) $(EXTRALIBS) dllversion.o

  • @$(ECHO) EXPORTS > R.def

  • @$(NM) $^ | $(SED) -n $(SYMPAT) | LC_COLLATE=C $(SORT) | uniq >
    R0.def

  • @LC_COLLATE=C $(SORT) Rdll.hide > R1.def

    @LC_COLLATE=C comm -23 R0.def R1.def >> R.def
    $(DLL) -shared $(DLLFLAGS) $($-DLLFLAGS) -o $@ R.def $^ $($-DLLLIBS)
    $(DLLLIBS)
    @$(RM) R.def R0.def R1.def
    +endif

    R.exp: $(OBJS) $(OBJS-EXTRA) $(MAINLIBS) $(EXTRALIBS) dllversion.o
    @$(ECHO) LIBRARY R.dll > R.exp
    @$(ECHO) EXPORTS >> R.exp

    • @$(NM) $^ | $(SED) -n $(SYMPAT) | $(SORT) | uniq > R0.def
  • @$(COMM) -23 R0.def Rdll.hide >> R.exp

  • @$(NM) $^ | $(SED) -n $(SYMPAT) | LC_COLLATE=C $(SORT) | uniq >
    R0.def

  • @LC_COLLATE=C comm -23 R0.def Rdll.hide >> R.exp @$(RM) R0.def

Rdll: makeMakedeps libRblas.dll.a ../../$(BINDIR)/R.dll

../../$(BINDIR)/R.dll: FORCE

diff --git a/src/gnuwin32/MkRules.rules b/src/gnuwin32/MkRules.rules
index 0b94546..989975b 100644
--- a/src/gnuwin32/MkRules.rules
+++ b/src/gnuwin32/MkRules.rules
@@ -69,8 +69,8 @@ RESCOMP=$(BINPREF)windres $(RC_ARCH)

as set by make

RM=rm -f
SED=sed
-SORT=LC_COLLATE=C sort
-COMM=LC_COLLATE=C comm
+SORT=sort
+COMM=comm

Reply to this email directly or view it on GitHub
#23 (comment).

@armgong
Copy link
Author

armgong commented Jul 9, 2014

great,on windows i recommened Msys2 and mingw-build, better than rtools

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