Forum: wxRuby Help building wxRuby with VC8

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Miguel Muñoz Arancón (Guest)
on 2009-04-02 17:26
(Received via mailing list)
Hello,

I'm trying to build wxRuby-2.0.0 with Ruby 1.9.1-p0 and SWIG 1.3.39
using VC8, but so far I didn't manage to do it. First of all, is there
some information available online for building wxRuby with Visual
Studio?

Up to now I've found three problems: one that I could solve, another
that I could avoid and a third one that blocked me completely
(Goldilocks and the Three Compiler Errors! - ok, no more jokes, I
promise). I'd be grateful if anyone could help me with these problems.


The first problem was with a wxWidgets include file, "wx/filefn.h". When
compiling wxRuby, the following error was shown:

error C2628: '_off_t' followed by '__int64' is ilegal

I found online a solution for this, but I don't know if it's the correct
one. See http://forum.videolan.org/viewtopic.php?f=2&t=792. In filefn.h,
add the condition !defined(_OFF_T_DEFINED) before the definition of
off_t. The modified code is:

#if (!defined(_OFF_T_DEFINED) && defined(__VISUALC__) &&
!defined(__WXWINCE__)) || ( defined(__MWERKS__) && defined( __INTEL__) )
    typedef _off_t off_t;
...
#endif


The second problem was that the class wxGLCanvas was not defined when
compiling wxRuby. I edited manually the GLCanvas.cpp file generated by
SWIG and added "#define wxUSE_GLCANVAS 1". Could you tell me what is the
correct place to set this option?


And finally, the third problem is that when building wxRuby with Rake
some classes cannot be found by fixmodule.rb. I get the following
message:

Class: AboutDialogInfo
ERROR! swig/fixmodule.rb Didn't find swig class
rake aborted!
Command failed with status (1): [ruby swig/fixmodule.rb
src/AboutDialogInfo...]

I tried to modify fixmodule.rb and got everything to compile, but then
the linking failed with many undefined references to extern symbols like
cWxToplevelWindow. What am I doing wrong?


I don't think it's related, but I'm using a version of Rake built with
Ruby 1.8.6 and I'm trying to build wxRuby for Ruby 1.9.1.


Thanks in advance for your help.
Best regards,

Miguel
Chauk-Mean P. (Guest)
on 2009-04-04 11:00
(Received via mailing list)
Hi,

2009/4/2 Miguel Muñoz Arancón <removed_email_address@domain.invalid>:
> Hello,
>
> I'm trying to build wxRuby-2.0.0 with Ruby 1.9.1-p0 and SWIG 1.3.39 using
> VC8, but so far I didn't manage to do it. First of all, is there some
> information available online for building wxRuby with Visual Studio?

Your configuration is not (yet?) supported.

Currently on Windows :
- wxRuby-2.0 with ruby-1.8 can be built without any problems with VC6
and VC7.1
- wxRuby-2.0 with ruby-1.9 cannot be built with any version of VC
- wxRuby-2.0 with ruby-1.8 or ruby-1.9 can be built with MinGW

The wxRuby team currently favors MinGW build for Windows.

> #if (!defined(_OFF_T_DEFINED) && defined(__VISUALC__) &&
> !defined(__WXWINCE__)) || ( defined(__MWERKS__) && defined( __INTEL__) )
>     typedef _off_t off_t;
> ...
> #endif
>

I'll try that.

> The second problem was that the class wxGLCanvas was not defined when
> compiling wxRuby. I edited manually the GLCanvas.cpp file generated by SWIG
> and added "#define wxUSE_GLCANVAS 1". Could you tell me what is the correct
> place to set this option?

It seems that you have not built wxWidgets appropriately.
See http://wxruby.rubyforge.org/wiki/wiki.pl?HowToBuildWxWidgets for
build instructions of wxWidgets.


Cheers.

Chauk-Mean.
Miguel Muñoz Arancón (Guest)
on 2009-04-08 10:05
(Received via mailing list)
> From: Chauk-Mean P. <removed_email_address@domain.invalid>

Thanks for your answer.

> > I'm trying to build wxRuby-2.0.0 with Ruby 1.9.1-p0 and SWIG 1.3.39 using
> > VC8, but so far I didn't manage to do it. First of all, is there some
> > information available online for building wxRuby with Visual Studio?
>
> Your configuration is not (yet?) supported.

I was afraid of this. Unfortunately I cannot change to MinGW because I
need
to interface with a C++ application that I cannot port.

I know that this is not the list to discuss it, but I miss in Ruby
something like
Tcl's stubs: the interpreter exposes its API through a table of function
pointers
so that binary extensions are compatible across different versions of
the
interpreter. This would be very useful for a project like wxRuby.

> > The second problem was that the class wxGLCanvas was not defined when
> > compiling wxRuby. I edited manually the GLCanvas.cpp file generated by SWIG
> > and added "#define wxUSE_GLCANVAS 1". Could you tell me what is the correct
> > place to set this option?
>
> It seems that you have not built wxWidgets appropriately.
> See http://wxruby.rubyforge.org/wiki/wiki.pl?HowToBuildWxWidgets for
> build instructions of wxWidgets.

Aha! I hadn't see this page. This fixes the wxGLCanvas problem.

> > Class: AboutDialogInfo
> > ERROR! swig/fixmodule.rb Didn't find swig class

Regarding the third problem, it seems that fixmodule.rb looks for some
declarations
of swig_class variables that don't exist. It seems that they are not
generated at
all by SWIG, so there could be some problem before VC8 does anything.
Which
exact version of SWIG is proven to work with wxRuby? (The build
instructions say
only "any recent version").

In case that it's useful to diagnose my problem, I'll add some more
information. I
got wxRuby 2.0.0 to build against Ruby 1.8.7 with the following
modifications:

- remove the call to fixmodule.rb in rake/rakewx.rb; this script looks
for declarations
like "swig_class cXXXXX" that are not extern, but there are no such
declarations in
my SWIG generated code.

- add some variable declarations in swig/wx.i:
swig_class cWxWindow;

swig_class cWxTopLevelWindow;

swig_class cWxSize;

swig_class cWxEvent;

swig_class cWxEvtHandler;


I installed wxRuby and set the executable manifest as explained in the
wiki, but
when I run "require 'Wx'" the interpreter crashes with an unhandled
exception, so
obviously that's not the correct solution.

Cheers,

Miguel
Alex F. (Guest)
on 2009-04-15 03:27
(Received via mailing list)
Hi Miguel

Sorry for being slow to reply. I think you might be onto something with
SWIG versions...

Miguel Muñoz Arancón wrote:
> > Your configuration is not (yet?) supported.
>
> I was afraid of this. Unfortunately I cannot change to MinGW because I
> need
> to interface with a C++ application that I cannot port.

That's a shame. As I mentioned in another email, I'm open to working on
supporting MSVC9 if it becomes clear that that's the preferred basis for
Ruby 1.9 on Windows.

> instructions say
> only "any recent version").

Rake should test that you have a recent enough version of SWIG to work
with your version of Ruby - it's near the top of wxRuby's rakefile
(SWIG_MINIMUM_VERSION).

I just had a look at SWIG's website and they've released versions 1.3.38
and 1.3.39 since wxRuby 2.0 was released. I did a quick diff on the ruby
changes and they look significant enough that these new versions might
break wxRuby. I would strongly suggest dropping back to 1.3.37 and
seeing if that helps.

We used to test for SWIG_MAXIMUM_VERSION as SWIG makes no guarantees
about backwards or forwards compatibility between versions. I guess we
may need to go back to this.

>
> exception, so
> obviously that's not the correct solution.

As you guessed, the kind of error "no class found" you're getting from
fixmodule.rb is a sign that something has gone wrong in generating the
code for that class - it's either a SWIG version problem or something
that needs fixing elsewhere.

alex
This topic is locked and can not be replied to.