[omniORB] omniidl does not generate code - I'm mystified...
Frank Goenninger
frgo at me.com
Sat Nov 14 22:03:57 GMT 2009
Hi Duncan,
glad you're jumping in on this !
Am 14.11.2009 um 21:18 schrieb Duncan Grisby:
> omniidl thinks your IDL file is empty. I don't know why. The fact that
> omniidl isn't seeing your IDL explains why it doesn't complain about
> the
> errors in the IDL.
>
> The empty generated code claims to come from omniORB 4.2 (the current
> development branch), yet you say you are using omniORB 4.1.4. What
> exactly are you doing, and how? Give step-by-step details of exactly
> what you have done.
I have to correct myself here: It actually is 4.2, the development
branch.
> How does the way you are running omniidl differ from the way omniidl
> is
> run when the echo example is compiled? If the echo example works,
> omniidl is clearly working fine.
Let's see:
1. I cloned the Echo example in my own little omniorb-test project:
$ more omniorb-test.idl
interface Echo
{
string echoString(in string mesg);
};
$ omniidl -bcxx omniorb-test.idl
produces fully intact files omniorb-test.hh and omniorb-testSK.cc
which I have successfully used to play with various aspects of POA and
Name Service.
I then went on to create my real project. I started with an new
directory "~/flexio/idl" and put the IDL file as given here:
-X-X-X-
#pragma prefix "flexio.goenninger.net"
module FlexIO
{
interface DeviceSelection;
interface LowLevelIO;
typedef long rc_t;
typedef unsigned long device_id_t;
typedef unsigned long bus_id_t;
struct FlexIOServerInfo
{
string ip_hostname;
unsigned long tcp_port;
};
typedef struct FlexIOServerInfo flexioserverinfo_t;
struct FlexIODeviceInfo
{
device_id_t id;
string name;
flexioserverinfo_t server;
bus_id_t bus_id;
};
typedef sequence<FlexIODeviceInfo> flexiodeviceinfoseq_t;
struct FlexIOInfo
{
long nr_devices;
flexiodeviceinfoseq_t device_info_list;
};
typedef struct FlexIOInfo flexioinfo_t;
interface DeviceSelection
{
rc_t get_flexio_info( out flexioinfo_t flex_io_info );
rc_t select_device( in device_id_t device_id );
};
typedef unsigned long flexio_op_id_t;
typedef unsigned long flexio_data_t;
interface LowLevelIO
{
rc_t read( in flexio_op_id_t operation,
in flexio_data_t data1,
in flexio_data_t data2,
out flexio_data_t return_value );
rc_t write( in flexio_op_id_t operation,
in flexio_data_t data1,
in flexio_data_t data2 );
};
};
-X-X-X-
Then:
$ cd ~/gnc/flexio/idl
$ ll
total 8
-rw-r--r--@ 1 frgo staff 2660 14 Nov 21:35 flexio.idl
Making sure I am using the right omniidl:
$ type omniidl
omniidl is hashed (/opt/orb/bin/omniidl)
Ok, this is where I installed it. So, let's call it for code
generation for flexio.idl:
$ omniidl -bcxx flexio.idl
gives:
$ ll
total 24
-rw-r--r-- 1 frgo staff 1552 14 Nov 21:41 flexio.hh
-rw-r--r--@ 1 frgo staff 2660 14 Nov 21:35 flexio.idl
-rw-r--r-- 1 frgo staff 347 14 Nov 21:41 flexioSK.cc
with flexio.hh and flexioSK.cc being the "empty" files.
I then went on to see what omniidl sees as preprocessing output:
$ omniidl -E -bcxx flexio.idl
gives:
# 1 "flexio.idl"
??#pragma prefix "flexio.goenninger.net"
module FlexIO
{
interface DeviceSelection;
interface LowLevelIO;
typedef long rc_t;
typedef unsigned long device_id_t;
typedef unsigned long bus_id_t;
struct FlexIOServerInfo
{
string ip_hostname;
unsigned long tcp_port;
};
typedef struct FlexIOServerInfo flexioserverinfo_t;
struct FlexIODeviceInfo
{
device_id_t id;
string name;
flexioserverinfo_t server;
bus_id_t bus_id;
};
typedef sequence<FlexIODeviceInfo> flexiodeviceinfoseq_t;
struct FlexIOInfo
{
long nr_devices;
flexiodeviceinfoseq_t device_info_list;
};
typedef struct FlexIOInfo flexioinfo_t;
interface DeviceSelection
{
rc_t get_flexio_info( out flexioinfo_t flex_io_info );
rc_t select_device( in device_id_t device_id );
};
typedef unsigned long flexio_op_id_t;
typedef unsigned long flexio_data_t;
interface LowLevelIO
{
rc_t read( in flexio_op_id_t operation,
in flexio_data_t data1,
in flexio_data_t data2,
out flexio_data_t return_value );
rc_t write( in flexio_op_id_t operation,
in flexio_data_t data1,
in flexio_data_t data2 );
};
};
The "??" appears whatever I have in the first line. Comparison with
the omniorb-test.idl file:
$ omniidl -E -bcxx omniorb-test.idl
# 1 "omniorb-test.idl"
interface Echo
{
string echoString(in string mesg);
};
Aha! No "??" at the beginning. Strange! Now: Let's see the file
contents at the byte level:
$ od -c omniorb-test.idl
0000000 i n t e r f a c e E c h o \n
Good. Now flexio.idl:
$ od -c flexio.idl
0000000 377 376 # \0 p \0 r \0 a \0 g \0 m \0 a \0
Aha! So: 2-byte coded file versus 1-byte coded file. Converting to 1-
byte coded file and re-issueing omniidl gives:
$ omniidl -bcxx flexio.idl
flexio.idl:19: Declaration of struct 'FlexIOServerInfo' clashes with
earlier declaration of struct 'FlexIOServerInfo'
flexio.idl:14: (struct 'FlexIOServerInfo' declared here)
flexio.idl:19: Syntax error in struct definition
flexio.idl:38: Declaration of struct 'FlexIOInfo' clashes with earlier
declaration of struct 'FlexIOInfo'
flexio.idl:33: (struct 'FlexIOInfo' declared here)
flexio.idl:38: Syntax error in struct definition
omniidl: 4 errors.
I have a valid output - this being errors, well ;-) Mystery solved.
Still: I think an error output and a hint in the docs would be
helpful. Note: I generated the file in Mac OS X's Xcode program, the
standard IDE on OS X. I have set the encoding default to UTF-8 which
caused this problem, not knowing omniidl wouldn't recognize UTF-8
encoded files. It may be in the docs somewhere (I didn't check) but it
sure would help if there was a warning or error message when running
omniidl and it nit generating any contents.
Thanks for putting me on the right track!
Cheers
Frank
More information about the omniORB-list
mailing list