i’m regularly using ruby on a win32 environment, and i’d like to know if
any of you has some general indications on how to build extensions in a
MINGW32 environment, so as to get mswin compatible binaries without the
cost of a Visual Studio Licence.
I found that WATANABE Hirofumi, aka eban, has ported many packages and
gives access to compiled binaries [1] and I believe he built these
packages on a linux box.
If these indication allowed me to cross compile from linux to windows,
it would be enough for me. I’d just like to be able to have the
equivalent ability on both platforms.
–
Pierre Baillet
Our bodies are given life from the midst of nothingness. Existing where there
is nothing is the meaning of the phrase, “form is emptiness.” That all things
are provided for by nothingness is the meaning of the phrase, “Emptiness is
form.” One should not think that these are two separate things.
Ghost Dog - The Way of the Samouraï
I can only give an extremely general indication, and that is that
everything should work fine. The dependencies are:
gcc
make
ruby
and they’re all present if (perhaps not only if) you build Ruby with
mingw (that way, Ruby’s insternal config knows what compiler, what
directories, etc.)
I vaguely remember having some trouble compiling stuff under mingw
when my “ruby” was the native windows one. Building Ruby under mingw
is easy and should lead to the path of happiness.
Gavin
···
On Tuesday, February 18, 2003, 10:41:29 AM, Pierre wrote:
Hello,
i’m regularly using ruby on a win32 environment, and i’d like to know if
any of you has some general indications on how to build extensions in a
MINGW32 environment, so as to get mswin compatible binaries without the
cost of a Visual Studio Licence.
I probably wasn’t clear enough as what i want is to build binary extensions
(such as xmlparser) with MINGW that are compatible with the mswin32
build.
Suppose I have a working mswin32 ruby installation, and a ruby extension
source. How can i use and ask extconf.rb so that it builds a .so using
MINGW that works with my mswin32 ruby.
···
On Tue, Feb 18, 2003, Pierre Baillet wrote:
Hello,
i’m regularly using ruby on a win32 environment, and i’d like to know if
any of you has some general indications on how to build extensions in a
MINGW32 environment, so as to get mswin compatible binaries without the
cost of a Visual Studio Licence.
I found that WATANABE Hirofumi, aka eban, has ported many packages and
gives access to compiled binaries [1] and I believe he built these
packages on a linux box.
If these indication allowed me to cross compile from linux to windows,
it would be enough for me. I’d just like to be able to have the
equivalent ability on both platforms.
Pierre Baillet
Our bodies are given life from the midst of nothingness. Existing where there
is nothing is the meaning of the phrase, “form is emptiness.” That all things
are provided for by nothingness is the meaning of the phrase, “Emptiness is
form.” One should not think that these are two separate things.
Ghost Dog - The Way of the Samouraï
–
Pierre Baillet
If it doesn’t work, force it. If it breaks, it needed replacing anyway.
Maybe you already got a detailed answer but a very simple solution, that I
use myself, is:
Install cygwin, www.cygwin.com, and make sure you install gcc 3.2 and
mingw includes (check ‘develop’ subcategory during cygwin install and
make sure you check all packages with mingw in the name)
downloaded the source for your Ruby version of choice, unpack and go
in there
dl, unpack and build your ruby extensions the normal way
Note that for ruby extensions that rely on external libs you have to
separately build and install the libs since the cygwin-installed ones
cannot be used with your mingw ruby. Thus you typically need to use the
“–with-xxx-dir=your/path/here” option when creating makefiles with
extconf.rb.
Hope this helps!
/Robert Feldt
···
On Tue, 18 Feb 2003, Gavin Sinclair wrote:
On Tuesday, February 18, 2003, 10:41:29 AM, Pierre wrote:
Hello,
i’m regularly using ruby on a win32 environment, and i’d like to know if
any of you has some general indications on how to build extensions in a
MINGW32 environment, so as to get mswin compatible binaries without the
cost of a Visual Studio Licence.
Downloaded and installed latest MinGw (2.0.0) & MSYS (1.0.9) without
cygwin package.
The only trick in building Ruby with MinGW was to replace the LDSHARED
line with: dllwrap --target=mingw32 --export-all -s
and after compiling (on Win98) I had to run: make ruby.exe since it was
not created. Make test reports success.
I found this answer in the archives.
Building Swig went without any problem.
Sincerely,
Gour
···
On Tuesday, February 18, 2003, 10:41:29 AM, Pierre wrote:
i’m regularly using ruby on a win32 environment, and i’d like to know if
any of you has some general indications on how to build extensions in a
MINGW32 environment, so as to get mswin compatible binaries without the
cost of a Visual Studio Licence.
–
Gour
gour@mail.inet.hr
Registered Linux User #278493
class CSITick {
public:
unsigned long date;
float open;
float high;
float low;
float close;
long volume;
};
class CSIChart {
public:
CSITick* getTick(long date); // CAN return NULL!!!
CSITick* ticks;
long numticks;
//…
};
where ‘ticks’ is an array of CSITick’s, created with:
ticks = new CSITick[numticks];
I can't seem to figure out how to make SWIG access this
‘ticks’ pointer as if it were an Array in Ruby, with length
equal to numticks. I would like it to be read-only as well.
The '%typemap' SWIG directive doesn't seem right, as
this is the only place where I want to treat a CSITick* as an
Array… otherwise, I would like a CSITick* to just be a reference
to an instance of CSITick. Am I making any sense?
I'm using SWIG-1.3.17 and ruby 1.6.8 (2002-12-24) [i586-mswin32]
%include “CSIChart.h”
%extend CSIChart {
CSITick* ticks(int index) {
while (index < 0) index += self->numticks; // wrap-around
if (index >= self->numticks) {
printf(“ERROR: index (%d) out of range for ticks array: 0…%d\n”,
index, self->numticks);
return 0;
}
return &self->ticks[index];
}
};
This works, but is there a way to turn this into a Ruby Array
so that ‘ticks’ could be accessed with the ‘’ notation?
Thanks!
– Glenn Lewis
Glenn M. Lewis wrote:
I've got these C++ classes:
class CSITick {
public:
unsigned long date;
float open;
float high;
float low;
float close;
long volume;
};
class CSIChart {
public:
CSITick* getTick(long date); // CAN return NULL!!!
CSITick* ticks;
long numticks;
//…
};
where ‘ticks’ is an array of CSITick’s, created with:
ticks = new CSITick[numticks];
I can't seem to figure out how to make SWIG access this
‘ticks’ pointer as if it were an Array in Ruby, with length
equal to numticks. I would like it to be read-only as well.
The '%typemap' SWIG directive doesn't seem right, as
this is the only place where I want to treat a CSITick* as an
Array… otherwise, I would like a CSITick* to just be a reference
to an instance of CSITick. Am I making any sense?
I'm using SWIG-1.3.17 and ruby 1.6.8 (2002-12-24) [i586-mswin32]