Support #16

Cannot load an IDL file with #include

Added by Jean-Christophe Cota over 2 years ago. Updated over 2 years ago.

Status:ClosedStart date:06/15/2016
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:-
Target version:-

Description

Hello,

I fail in loading correctly a file that has a #include cpp clause, while I succeed if not.

Please note that I encountered an issue loading the corba module right from the begining, and somehow fixed it by enriching the loadpath with the directory containing the missing file libr2tao.

I installed r2corba onto a fresh Ruby installation (ruby 2.1.9p490 (2016-03-30 revision 54437) [x86_64-linux]), compiled from scratch on our Linux x86_64 platform.
r2corba was installed using 'gem install r2corba’, which eventually compiled a fresh version of TAO.

Running 'r2corba test’ yielded a satisfactory output, with at the end:

Finished tests in 40.361849s, 0.8176 tests/s, 0.0000 assertions/s.

33 tests, 0 assertions, 0 failures, 0 errors, 0 skips

ruby -v: ruby 2.1.9p490 (2016-03-30 revision 54437) [x86_64-linux]

With no #include:

cot:(medon)$ irb
irb(main):001:0> $: << '/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/ext’
⇒ ["/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/site_ruby/2.1.0", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/site_ruby/2.1.0/x86_64-linux", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/site_ruby", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/vendor_ruby/2.1.0", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/vendor_ruby/2.1.0/x86_64-linux", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/vendor_ruby", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/2.1.0", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/2.1.0/x86_64-linux", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/ext"]
irb(main):002:0> require 'corba’
⇒ true
irb(main):003:0> CORBA.implement('/development/infra-project/cot/TESTS/testWhole.idl’)
⇒ nil
irb(main):004:0> TestManaged
⇒ TestManaged
irb(main):005:0> Test
⇒ Test
irb(main):006:0>

but with #include here are the symptoms:

cot:(medon)$ irb
irb(main):001:0> $: << '/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/ext’
⇒ ["/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/site_ruby/2.1.0", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/site_ruby/2.1.0/x86_64-linux", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/site_ruby", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/vendor_ruby/2.1.0", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/vendor_ruby/2.1.0/x86_64-linux", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/vendor_ruby", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/2.1.0", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/2.1.0/x86_64-linux", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/ext"]
irb(main):002:0> require 'corba’
⇒ true
irb(main):003:0> CORBA.implement('/development/infra-project/cot/TESTS/test.idl’)
IDL::ParseError: Cannot open include file 'testManaged.idl’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/ridl-2.5.6/lib/ridl/scanner.rb:346:in `parse_error’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/ridl-2.5.6/lib/ridl/scanner.rb:297:in `enter_include’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/ridl-2.5.6/lib/ridl/scanner.rb:915:in `parse_directive’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/ridl-2.5.6/lib/ridl/scanner.rb:962:in `next_token’
from parser.ry:923:in `next_token’
from racc/parser.rb:99:in `_racc_do_parse_c’
from racc/parser.rb:99:in `do_parse’
from parser.ry:872:in `parse’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/lib/ridlbe/ruby/config.rb:51:in `parse0’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/lib/ridlbe/ruby/config.rb:67:in `eval’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/lib/corba/common/IDL.rb:54:in `implement’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/lib/corba/idl/IDL.rb:17:in `implement’
from (irb):3
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/bin/irb:11:in `<main>'
irb(main):004:0> CORBA.implement('/development/infra-project/cot/TESTS/test.idl’, {:includepaths ⇒ ['/development/infra-project/cot/TESTS’]})
⇒ nil
irb(main):005:0> Test
NameError: uninitialized constant Test
from (irb):5
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/bin/irb:11:in `<main>'
irb(main):006:0>

Interesting to see that command #4 upwards has no effect, besides it returns nil. The parsing error seems to be still there:

cot:(medon)$ irb
irb(main):001:0> $: << '/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/ext’
⇒ ["/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/site_ruby/2.1.0", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/site_ruby/2.1.0/x86_64-linux", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/site_ruby", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/vendor_ruby/2.1.0", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/vendor_ruby/2.1.0/x86_64-linux", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/vendor_ruby", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/2.1.0", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/2.1.0/x86_64-linux", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/ext"]
irb(main):002:0> require 'corba’
⇒ true
irb(main):003:0> CORBA.implement('/development/infra-project/cot/TESTS/test.idl’, {:includepaths ⇒ ['/development/infra-project/cot/TESTS’]})
IDL::ParseError: Cannot open include file 'testManaged.idl’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/ridl-2.5.6/lib/ridl/scanner.rb:346:in `parse_error’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/ridl-2.5.6/lib/ridl/scanner.rb:297:in `enter_include’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/ridl-2.5.6/lib/ridl/scanner.rb:915:in `parse_directive’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/ridl-2.5.6/lib/ridl/scanner.rb:962:in `next_token’
from parser.ry:923:in `next_token’
from racc/parser.rb:99:in `_racc_do_parse_c’
from racc/parser.rb:99:in `do_parse’
from parser.ry:872:in `parse’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/lib/ridlbe/ruby/config.rb:51:in `parse0’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/lib/ridlbe/ruby/config.rb:67:in `eval’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/lib/corba/common/IDL.rb:54:in `implement’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/lib/corba/idl/IDL.rb:17:in `implement’
from (irb):3
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/bin/irb:11:in `<main>'
irb(main):004:0>

The IDL files are :

testManaged.idl:

module TestManaged {
  interface Managed {
    oneway void shutdown ();
  };
};

test.idl:

#include "testManaged.idl" 

module Test
{
  interface Echo : TestManaged::Managed
  {
    string echo_string (in string input);
  };
};

testWhole.idl:

module TestManaged {

  interface Managed {
    oneway void shutdown ();
  };
};

module Test
{
  interface Echo : TestManaged::Managed
  {
    string echo_string (in string input);
  };
};

Thanks,
JC.

require.rb Magnifier (883 Bytes) Martin Corino, 06/19/2016 06:37 pm

History

#1 Updated by Johnny Willemsen over 2 years ago

Which linux distribution are you using?

#2 Updated by Johnny Willemsen over 2 years ago

  • Description updated (diff)

#3 Updated by Jean-Christophe Cota over 2 years ago

Red Hat Enterprise Linux 6 update 6

Linux medon 2.6.32-504.3.3.el6.x86_64 #1 SMP Fri Dec 12 16:05:43 EST 2014 x86_64 x86_64 x86_64 GNU/Linux

#4 Updated by Johnny Willemsen over 2 years ago

The test test/IDL_Test does test includes and according to the output of r2corba test it does succeed when running the test suite. By default RHEL 6.6 ruby version is 1.8.7, so it sounds you installed your own Ruby version.

It is probably something in the setup of your environment but not sure yet what exactly. Which ruby version did you install and how, looks something we should be able to reproduce with RHEL 6.6 at our side.

#5 Updated by Jean-Christophe Cota over 2 years ago

My system does not have Ruby RPM installed.

I have installed MRI Ruby 2.1.9 (ruby 2.1.9p490 (2016-03-30 revision 54437) [x86_64-linux]) in my own work area (not the defaul /usr/local/bin). Indeed, your R2CORBA page specifies support of the latest MRI Ruby versions (now supports MRI 1.9.3-2.2.0).

My Ruby bundle has the following MD5 hash:
d9d2109d3827789344cc3aceb8e1d697 ruby-2.1.9.tar.gz

I then executed:
./configure --prefix=/development/infra-project/cot/COTS/installed/ruby-2.1.9
make
make install DESTDIR=/ (apparently DESTDIR defaults to prefix)

I then set the path to /development/infra-project/cot/COTS/installed/ruby-2.1.9/bin and executed:
gem install r2corba

That’s all! Hope it will help.

#6 Updated by Johnny Willemsen over 2 years ago

Could you try to start irb in the /development/infra-project/cot/TESTS directory as temporary workaround?

#7 Updated by Jean-Christophe Cota over 2 years ago

This seems to be working (still the problem of loadpath at the begining):

cot:(medon)$ irb
irb(main):001:0> require 'corba’
LoadError: cannot load such file – libr2tao
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/lib/corba/cbase/require.rb:15:in `<top (required)>'
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/lib/corba/require.rb:15:in `<top (required)>'
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/lib/corba.rb:14:in `<top (required)>'
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require’
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require’
from (irb):1
from /development/infra-project/cot/COTS/installed/ruby-2.1.9/bin/irb:11:in `<main>'
irb(main):002:0> $: << '/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/ext’
⇒ ["/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/ridl-2.5.6/lib", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0-static/r2corba-1.5.1", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/lib", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/site_ruby/2.1.0", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/site_ruby/2.1.0/x86_64-linux", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/site_ruby", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/vendor_ruby/2.1.0", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/vendor_ruby/2.1.0/x86_64-linux", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/vendor_ruby", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/2.1.0", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/2.1.0/x86_64-linux", "/development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1/ext"]
irb(main):003:0> require 'corba’
⇒ true
irb(main):004:0> CORBA.implement('test.idl’)
⇒ nil
irb(main):005:0> Test
⇒ Test
irb(main):006:0> TestManaged
⇒ TestManaged
irb(main):007:0>

#8 Updated by Martin Corino over 2 years ago

Hello Jean-Christophe,

Just back from a short trip.
Thanks for reporting these issues.

To fix the issue with the loadpath please replace your installed copy of lib/corba/cbase/require.rb (at /development/infra-project/cot/COTS/installed/ruby-2.1.9/lib/ruby/gems/2.1.0/gems/r2corba-1.5.1) with the file attached here.

The include problem is caused by an incorrect parameter key. Instead of :includepaths you should use :xincludepaths for additional non-system includepaths (i.e. used for either ".." or <..> style includes). The :includepaths key adds to the system include search paths which are used only for <..> style includes (and for the toplevel IDL source if a relative filename is supplied).
Also when adding include paths as parameter of the CORBA#implement method (either key) you should make sure to have each supplied path end with the path separator character /.

So, assuming the paths are correct the following should work (after replacing the file mentioned above)

require 'corba'
CORBA.implement('/development/infra-project/cot/TESTS/test.idl’, {xincludepaths: %w{ /development/infra-project/cot/TESTS/ } })

Alternatively you could also use

require 'corba'
CORBA.implement('test.idl', { includepaths: %w{ /development/infra-project/cot/TESTS/ }, xincludepaths: %w{ /development/infra-project/cot/TESTS/ } })

#9 Updated by Martin Corino over 2 years ago

  • Status changed from New to In Progress
  • Assignee set to Martin Corino

#10 Updated by Martin Corino over 2 years ago

  • % Done changed from 0 to 90

#11 Updated by Jean-Christophe Cota over 2 years ago

Hello Martin,

thanks for the tips and fix. This works fine now. You can close this issue.

#12 Updated by Johnny Willemsen over 2 years ago

  • Status changed from In Progress to Closed
  • Assignee deleted (Martin Corino)
  • % Done changed from 90 to 100

Also available in: Atom PDF