krlmlr / duckdbneo

New Bindings for the DuckDB Database Management System
Other
10 stars 0 forks source link

Fix compilation on Windows #2

Open krlmlr opened 1 week ago

krlmlr commented 1 week ago

https://github.com/krlmlr/duckdbneo/actions/runs/9668075440/job/26671492149

Contents of 00install.out :

* installing *source* package 'duckdbneo' ...
** using staged installation
** libs
using C++ compiler: 'G__~1.EXE (GCC) 13.2.0'
using C++20
g++  -std=gnu++20 -I"C:/R/include" -DNDEBUG     -I"C:/rtools44/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c duckdb_r.cpp -o duckdb_r.o
In file included from C:/rtools44/x86_64-w64-mingw32.static.posix/include/combaseapi.h:155,
                 from C:/rtools44/x86_64-w64-mingw32.static.posix/include/objbase.h:14,
                 from C:/rtools44/x86_64-w64-mingw32.static.posix/include/ole2.h:17,
                 from C:/rtools44/x86_64-w64-mingw32.static.posix/include/wtypes.h:13,
                 from C:/rtools44/x86_64-w64-mingw32.static.posix/include/winscard.h:10,
                 from C:/rtools44/x86_64-w64-mingw32.static.posix/include/windows.h:97,
                 from duckdb_r.cpp:14:
C:/rtools44/x86_64-w64-mingw32.static.posix/include/objidlbase.h:1065:18: error: macro "Realloc" requires 3 arguments, but only 2 given
 1065 |         SIZE_T cb) = 0;
      |                  ^
In file included from C:/R/include/Rdefines.h:38,
                 from duckdb_r.cpp:2:
C:/R/include/R_ext/RS.h:54: note: macro "Realloc" defined here
   54 | #define Realloc(p,n,t) (t *) R_chk_realloc( (void *)(p), (R_SIZE_T)((n) * sizeof(t)) )
      | 
duckdb_r.cpp:17: warning: "RTLD_LOCAL" redefined
   17 | #define RTLD_LOCAL 0
      | 
In file included from duckdb_r.cpp:3:
C:/rtools44/x86_64-w64-mingw32.static.posix/include/dlfcn.h:54: note: this is the location of the previous definition
   54 | #define RTLD_LOCAL  (1 << 2)
      | 
C:/rtools44/x86_64-w64-mingw32.static.posix/include/objidlbase.h:1063:5: error: 'Realloc' declared as a 'virtual' field
 1063 |     virtual void * STDMETHODCALLTYPE Realloc(
      |     ^~~~~~~
C:/R/include/R_ext/RS.h:55:37: error: expected identifier before '(' token
   55 | #define Free(p)        (R_chk_free( (void *)(p) ), (p) = NULL)
      |                                     ^
C:/R/include/R_ext/RS.h:55:37: error: 'parameter' declared as function returning a function
C:/R/include/R_ext/RS.h:55:50: error: expected ')' before ',' token
   55 | #define Free(p)        (R_chk_free( (void *)(p) ), (p) = NULL)
      |                        ~                         ^
C:/R/include/R_ext/RS.h:55:37: error: expected identifier before '(' token
   55 | #define Free(p)        (R_chk_free( (void *)(p) ), (p) = NULL)
      |                                     ^
C:/R/include/R_ext/RS.h:55:37: error: 'parameter' declared as function returning a function
C:/R/include/R_ext/RS.h:55:50: error: expected ')' before ',' token
   55 | #define Free(p)        (R_chk_free( (void *)(p) ), (p) = NULL)
      |                        ~                         ^
duckdb_r.cpp: In function 'void* dlopen(const char*, int)':
duckdb_r.cpp:19:9: error: 'D_ASSERT' was not declared in this scope; did you mean 'C_ASSERT'?
   19 |         D_ASSERT(file);
      |         ^~~~~~~~
      |         C_ASSERT
duckdb_r.cpp:20:22: error: 'WindowsUtil' has not been declared
   20 |         auto fpath = WindowsUtil::UTF8ToUnicode(file);
      |                      ^~~~~~~~~~~
duckdb_r.cpp: In function 'void* dlsym(void*, const char*)':
duckdb_r.cpp:25:9: error: 'D_ASSERT' was not declared in this scope; did you mean 'C_ASSERT'?
   25 |         D_ASSERT(handle);
      |         ^~~~~~~~
      |         C_ASSERT
duckdb_r.cpp: At global scope:
duckdb_r.cpp:29:13: error: 'string' in namespace 'std' does not name a type
   29 | inline std::string GetDLError(void) {
      |             ^~~~~~
duckdb_r.cpp:15:1: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
   14 | #include <windows.h>
  +++ |+#include <string>
   15 | 
duckdb_r.cpp: In function 'SEXPREC* duckdb_copy_buffer(SEXP, SEXP)':
duckdb_r.cpp:60:33: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
   60 |                 ptr = (void*) *((uintptr_t*) &ptr_dbl);
      |                                ~^~~~~~~~~~~~~~~~~~~~~~
In file included from C:/rtools44/x86_64-w64-mingw32.static.posix/include/windef.h:9,
                 from C:/rtools44/x86_64-w64-mingw32.static.posix/include/windows.h:69:
value_conversion.h: In static member function 'static SEXPREC* duckdb_r::PointerWrapper<T, NAME>::Wrap(void*)':
value_conversion.h:39:70: error: expected unqualified-id before numeric constant
   39 |                 R_RegisterCFinalizerEx(ptr_sexp, Finalize, Rboolean::FALSE);
      |                                                                      ^~~~~
duckdb_r.cpp: In function 'void R_init_duckdbneo(DllInfo*)':
duckdb_r.cpp:83:34: error: invalid conversion from 'int' to 'Rboolean' [-fpermissive]
   83 |         R_useDynamicSymbols(dll, FALSE);
      |                                  ^~~~~
      |                                  |
      |                                  int
In file included from duckdb_r.cpp:1:
C:/R/include/R_ext/Rdynload.h:85:54: note:   initializing argument 2 of 'Rboolean R_useDynamicSymbols(DllInfo*, Rboolean)'
   85 | Rboolean R_useDynamicSymbols(DllInfo *info, Rboolean value);
      |                                             ~~~~~~~~~^~~~~
duckdb_r.cpp:84:29: error: invalid conversion from 'int' to 'Rboolean' [-fpermissive]
   84 |         R_forceSymbols(dll, TRUE);
      |                             ^~~~
      |                             |
      |                             int
C:/R/include/R_ext/Rdynload.h:86:49: note:   initializing argument 2 of 'Rboolean R_forceSymbols(DllInfo*, Rboolean)'
   86 | Rboolean R_forceSymbols(DllInfo *info, Rboolean value);
      |                                        ~~~~~~~~~^~~~~
make: *** [C:/R/etc/x64/Makeconf:296: duckdb_r.o] Error 1
ERROR: compilation failed for package 'duckdbneo'
* removing 'D:/a/duckdbneo/duckdbneo/check/duckdbneo.Rcheck/duckdbneo'

@Antonov548: Can you please take a look?

krlmlr commented 1 week ago

I've turned off CI/CD on Windows for now, need to remove Config/gha/filter from DESCRIPTION to reenable.

krlmlr commented 1 week ago

Also need to rerun .github/workflows/versions-matrix/action.R now.