Compiling PL/R against R.dll in Win32/MinGW

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Compiling PL/R against R.dll in Win32/MinGW

Mike Leahy
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).

Thanks in advance for any suggestions.

Mike

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/src/pgsql/src/include
-Ic:/msys/src/pgsql/src/include/port/win32 -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)
plr.o(.text+0xe3):plr.c: undefined reference to `Rf_initEmbeddedR'
pg_conversion.o(.text+0x12d3):pg_conversion.c: undefined reference to
`ARR_OVERHEAD'
fu000061.o(.idata$3+0xc): undefined reference to `libpostgres_a_iname'
fu000062.o(.idata$3+0xc): undefined reference to `libpostgres_a_iname'
fu000064.o(.idata$3+0xc): undefined reference to `libpostgres_a_iname'
nmth000060.o(.idata$4+0x0): undefined reference to `_nm__pkglib_path'
nmth000063.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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Compiling PL/R against R.dll in Win32/MinGW

Joe Conway
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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Compiling PL/R against R.dll in Win32/MinGW

Mike Leahy
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
>
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Compiling PL/R against R.dll in Win32/MinGW

Joe Conway
Mike Leahy wrote:
> 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?

>
> -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

This looks like you're trying to compile with PostgreSQL cvs HEAD
(8.2devel), correct? That won't work as I've not yet adjusted PL/R to
handle NULL elements in arrays (which is brand new in HEAD). But this is
is now off topic here...

Getting back on topic, unless someone can tell us that R.dll or some
other mechanism exposes the same API as the libR shared object, I'd have
to say it is probably hopeless.

Joe

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Compiling PL/R against R.dll in Win32/MinGW

Mike Leahy
OK - I did try this with PostgreSQL 8.1.3 and got the same results.  To
use the CVS HEAD for PostgreSQL, I did have to make a couple changes to
get it to compile, but it ends with the same results.

Joe Conway wrote:

> Mike Leahy wrote:
>> 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?
>
>>
>> -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
>
> This looks like you're trying to compile with PostgreSQL cvs HEAD
> (8.2devel), correct? That won't work as I've not yet adjusted PL/R to
> handle NULL elements in arrays (which is brand new in HEAD). But this is
> is now off topic here...
>
> Getting back on topic, unless someone can tell us that R.dll or some
> other mechanism exposes the same API as the libR shared object, I'd have
> to say it is probably hopeless.
>
> Joe
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel