From mgleahy at alumni.uwaterloo.ca  Fri Apr  7 23:35:10 2006
From: mgleahy at alumni.uwaterloo.ca (Mike Leahy)
Date: Fri, 07 Apr 2006 17:35:10 -0400
Subject: [Rd] Compiling PL/R against R.dll in Win32/MinGW
In-Reply-To: <4436C8B8.6020402@joeconway.com>
References: <4436C162.8080106@alumni.uwaterloo.ca>
	<4436C8B8.6020402@joeconway.com>
Message-ID: <4436DB0E.5040406@alumni.uwaterloo.ca>

Ok...well I've been hacking around with the PL/R source a bit more, and
I found that that substituting 'Rf_initEmbeddedR' with 'InitDynload'
seemed to make code compile further - this was just a total guess based
on the functions that are listed in the R.dll with dependency-walker.
Now it appears that it's an issue compiling against postgres, rather
than R.dll (see below).  Should I pursue this any further, or should I
accept that it just won't happen and give up for now?

$ R_HOME=c:/Progra~1/R/R-2.3.0alpha make -f Makefile.pgxs
-Ic:/msys/src/pgsql/src/include

sed 's,MODULE_PATHNAME,$libdir/plr,g' plr.sql.in >plr.sql
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline
-Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
  -I. -Ic:/Progra~1/R/R-2.3.0alpha/include
-Ic:/Progra~1/R/R-2.3.0alpha/include -I. -Ic:/MinGW/include/server
-Ic:/MinGW/incl
ude/internal -I./src/include/port/win32 -DEXEC_BACKEND
"-Ic:/msys/pgsql/lib/pgxs/src/MAKEFI~1/../../src/include/port/win32"
-Ic:/MinGW/include/server/port/win32 -Ic:/msys/pgsql/include/server
-Ic:/msys/pgsql/include/server/port/win32 -Lc:/msys/pgsql
/lib -Lc:/msys/pgsql/bin -DPKGLIBDIR=\"c:/MinGW/lib\"
-DDLSUFFIX=\".dll\"  -c -o plr.o plr.c
plr.c: In function `plr_init':
plr.c:288: warning: implicit declaration of function `InitDynload'
plr.c: In function `fetchArgNames':
plr.c:1366: warning: passing arg 7 of `deconstruct_array' from
incompatible pointer type
plr.c:1366: warning: passing arg 8 of `deconstruct_array' makes pointer
from integer without a cast
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline
-Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
  -I. -Ic:/Progra~1/R/R-2.3.0alpha/include
-Ic:/Progra~1/R/R-2.3.0alpha/include -I. -Ic:/MinGW/include/server
-Ic:/MinGW/incl
ude/internal -I./src/include/port/win32 -DEXEC_BACKEND
"-Ic:/msys/pgsql/lib/pgxs/src/MAKEFI~1/../../src/include/port/win32"
-Ic:/MinGW/include/server/port/win32 -Ic:/msys/pgsql/include/server
-Ic:/msys/pgsql/include/server/port/win32 -Lc:/msys/pgsql
/lib -Lc:/msys/pgsql/bin -DPKGLIBDIR=\"c:/MinGW/lib\"
-DDLSUFFIX=\".dll\"  -c -o pg_conversion.o pg_conversion.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline
-Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
  -I. -Ic:/Progra~1/R/R-2.3.0alpha/include
-Ic:/Progra~1/R/R-2.3.0alpha/include -I. -Ic:/MinGW/include/server
-Ic:/MinGW/incl
ude/internal -I./src/include/port/win32 -DEXEC_BACKEND
"-Ic:/msys/pgsql/lib/pgxs/src/MAKEFI~1/../../src/include/port/win32"
-Ic:/MinGW/include/server/port/win32 -Ic:/msys/pgsql/include/server
-Ic:/msys/pgsql/include/server/port/win32 -Lc:/msys/pgsql
/lib -Lc:/msys/pgsql/bin -DPKGLIBDIR=\"c:/MinGW/lib\"
-DDLSUFFIX=\".dll\"  -c -o pg_backend_support.o pg_backend_support.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline
-Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
  -I. -Ic:/Progra~1/R/R-2.3.0alpha/include
-Ic:/Progra~1/R/R-2.3.0alpha/include -I. -Ic:/MinGW/include/server
-Ic:/MinGW/incl
ude/internal -I./src/include/port/win32 -DEXEC_BACKEND
"-Ic:/msys/pgsql/lib/pgxs/src/MAKEFI~1/../../src/include/port/win32"
-Ic:/MinGW/include/server/port/win32 -Ic:/msys/pgsql/include/server
-Ic:/msys/pgsql/include/server/port/win32 -Lc:/msys/pgsql
/lib -Lc:/msys/pgsql/bin -DPKGLIBDIR=\"c:/MinGW/lib\"
-DDLSUFFIX=\".dll\"  -c -o pg_userfuncs.o pg_userfuncs.c
pg_userfuncs.c: In function `plr_array_push':
pg_userfuncs.c:144: warning: passing arg 9 of `array_set' makes integer
from pointer without a cast
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline
-Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
  -I. -Ic:/Progra~1/R/R-2.3.0alpha/include
-Ic:/Progra~1/R/R-2.3.0alpha/include -I. -Ic:/MinGW/include/server
-Ic:/MinGW/incl
ude/internal -I./src/include/port/win32 -DEXEC_BACKEND
"-Ic:/msys/pgsql/lib/pgxs/src/MAKEFI~1/../../src/include/port/win32"
-Ic:/MinGW/include/server/port/win32 -Ic:/msys/pgsql/include/server
-Ic:/msys/pgsql/include/server/port/win32 -Lc:/msys/pgsql
/lib -Lc:/msys/pgsql/bin -DPKGLIBDIR=\"c:/MinGW/lib\"
-DDLSUFFIX=\".dll\"  -c -o pg_rsupport.o pg_rsupport.c
dlltool --export-all  --output-def plr.def plr.o pg_conversion.o
pg_backend_support.o pg_userfuncs.o pg_rsupport.o
dllwrap  -o libplr.dll --dllname libplr.dll  --def plr.def plr.o
pg_conversion.o pg_backend_support.o pg_userfuncs.o pg_rsupp
ort.o -Lc:/Progra~1/R/R-2.3.0alpha/bin -Lc:/Progra~1/R/R-2.3.0alpha/bin
-Lc:/MinGW/lib -Lc:/MinGW/lib -lR -lpostgres
Info: resolving _pkglib_path by linking to __imp__pkglib_path (auto-import)
Info: resolving _Dynamic_library_path by linking to
__imp__Dynamic_library_path (auto-import)
fu000062.o(.idata$3+0xc): undefined reference to `libpostgres_a_iname'
fu000063.o(.idata$3+0xc): undefined reference to `libpostgres_a_iname'
fu000065.o(.idata$3+0xc): undefined reference to `libpostgres_a_iname'
nmth000061.o(.idata$4+0x0): undefined reference to `_nm__pkglib_path'
nmth000064.o(.idata$4+0x0): undefined reference to
`_nm__Dynamic_library_path'
collect2: ld returned 1 exit status
c:\MinGW\bin\dllwrap.exe: c:\MinGW\bin\gcc exited with status 1
make: *** [libplr.a] Error 1

Joe Conway wrote:
> Mike Leahy wrote:
>> Hello list,
>>
>> I've been trying to get the PostgreSQL PL/R library to compile on
>> windows (http://www.joeconway.com/plr/).  The author of this library
>> says the problem is likely because the distributed R.dll isn't
>> compiled as a shared dll.  Is this the case?  If so, is there any way
>> to compile it such that it is shared?  If that's not the case, than
>> maybe someone on this list has a better understanding of the errors
>> I'm getting (below).
> 
> Just to clarify, I based my comment on this thread:
>     http://tolstoy.newcastle.edu.au/R/help/03a/1690.html
> 
> which may no longer be true. I have made no specific attempt to make
> PL/R compile under Windows because I did not think it was supported. If
> R.dll can be used under Windows in the same manner as libR.so on Linux,
> I'd bee happy to hear about it.
> 
> Joe
> 
> 
>



[Rd] Compiling PL/R against R.dll in Win32/MinGW
Mike Leahy