Skip to content

Building package under windows which links against a cygwin library

7 messages · Duncan Murdoch, Cameron Bracken

#
I am developing a package
(http://r-forge.r-project.org/projects/swfdevice/)?which links against
the ming C library. The package builds fine under Mac OS X and Linux.
I am really out of my element on windows, but I know there is a cygwin
package for libming.

My question is, does anyone have advice/examples on linking R packages
against cygwin libraries?  Is this even possible? ?How would I go
about writing a configure.win script to do this?

Cheers,
-Cameron
#
On 11/11/2009 4:41 PM, Cameron Bracken wrote:
I suspect it's not going to work.  Linking to any Cygwin library will 
pull in the rest, and I would guess that will conflict with something 
else in R, which does not use Cygwin.

What you could do is include a copy of the source to the ming library, 
and get the regular R compilers to compile it.  I just tried, and it 
compiled without errors (though there were a few warnings).  Then you 
can write your R interface to it, and everything may just work.

The tricky bit might be getting the Makevars or Makefile right, but 
theirs is really simple, so that shouldn't be so bad.

Duncan Murdoch
#
On Wed, Nov 11, 2009 at 4:36 PM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
I figured that would be the case.
Hey, that is great! I thought about doing this but decided arbitrarily
that it would be too hard.  Do I just plop a copy of the ming source
in the src/ directory of my package (then adjust Makevars
accordingly)?  Did you run the whole ming configure script as well?

-Cameron
#
On 11/11/2009 6:49 PM, Cameron Bracken wrote:
I just ran make.  I don't think there is any configure script.

I'd probably put their stuff in a subdir of src, just to keep it cleanly 
separated from yours.  This also gives you the option of *not* compiling 
it on systems like Linux and MacOS that already have it.  Then make up a 
Makevars.win file that builds it as a static or dynamic lib on Windows 
and links to it, and a Makevars file that just links to it on other 
platforms.  (You might want to do a static compile on the other systems 
just so you're protected against version changes.)

Duncan Murdoch
#
On Wed, Nov 11, 2009 at 5:15 PM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
Thanks for the feedback, I agree that would be the easiest and
preferable way.  But which version of ming are you using that only has
a makefile? The version I need (0.4.0 beta5) has a fairly involved
configure script.  I would have to pick out the components I need for
my package and create a custom makefile for it to be easily usable
(which I may end up doing, thank goodness for open source).

-Cameron
#
On 11/11/2009 8:03 PM, Cameron Bracken wrote:
I was looking at ming-0.2a.  It might not be the same library at all!

Duncan Murdoch
#
On Wed, Nov 11, 2009 at 8:06 PM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
That is the same library but it is a very old version which has most,
but not all of the features I need (unfortunately).  You are correct
that it does only have a makefile though. On the other hand, I don't
really need the full functionality of the library, so I think I can
strip out a lot of things and create a custom makefile and build just
what I need.

Cheers,
-Cameron