ORBit2 problems



Hi,

I'm building GNOME 2 on Solaris using the Forte C compiler.
I had a number of build issues with ORBit2. (see the patch below)

First, src/orb/orb-core/corba-typecode.c didn't compile. The error message
was something like "can't take the size of void". After some investigation
of the macros that call those macros that call.... I found the following:

#define _CDR_get(x, y) CDR_get(x, (guchar *)(y), sizeof(*(y)), TRUE)

This is called from MEMBER_LOOPER_DEC (through CDR_get_##getname) and
y is t->sublabels[i]._value.

t is a CORBA_TypeCode, sublabels[] is CORBA_any*, _value in CORBA_any is
a gpointer, which is a void *, so sizeof(*(y)) will in fact try to
get the size of a void. Gcc will compile this and the result will be 1,
more strict compilers will stop with an error. (Also I'm not quite sure
if CDR_get() will do The Right Thing with len=1.)

To be able to go further I changed the definition of CORBA_any._value to char *
so it behaves the same way as with gcc (i.e. the size of *_value is 1).
I don't know what the nice way would be to do this.

The next error was in the same file: 
TC_CORBA_{##nom##, null, void}_struct thingies are defined const in the
header but the const is missing in the C file.

Next is include/orbit/GIOP/giop-recv-buffer.h: extern inline functions
are not supported in Forte. I put this in #ifdef __GNUC__ to continue.

Next problem: include/orbit/orb-core/allocators.h
When ORBIT_DEBUG is not defined ORBIT_MEM_MAGICDEF(name) is defined as nothing,
so later in the file
  ORBIT_MEM_MAGICDEF(magic);
resolves to 
  ;

Forte doesn't tolerate ";"-s hanging around (gcc does).
I changed this so that the ; is included in the #define of ORBIT_MEM_MAGICDEF
and deleted from the end of the ORBIT_MEM_MAGICDEF(magic) lines.

Almost done now (-;
test/test-dynany.c:

-#define CHECK_OK(ev)           (g_assert ((ev)->_major == CORBA_NO_EXCEPTION))
+#define CHECK_OK(ev)           g_assert ((ev)->_major == CORBA_NO_EXCEPTION)

The extra ( ) make Forte C mad, gcc doesn't mind.

Finally, test/test-dynany.c uses fabs(), so I needed -lm in LDADD.

At this point it almost builds, except for test/inhibit.
The generated baa.h looks broken (attached).

It contains this line:

#pragma	include_defs foo.h# 5#if !defined(ORBIT_DECL_Foo_Child) && !defined(_Foo_Child_defined)

and an unmatched #endif (I guess the pair of the #if in the line above)
at the end:

/**INDENT** Error@73: Unmatched #endif */
#endif

If I add a line break at the #-s it still doesn't compile, lacking the
definition of POA_Foo_Parent__epv from foo. With some more dirty hacking
it finally compiles and even make check works.

Not so in test/everything. make check reports:

Local server test passed
13791 Segmentation Fault - core dumped

Here's the stack trace of server:

  [1] strcpy(0x0, 0xffbeee7c, 0x0, 0x302e302e, 0x0, 0x0), at 0xfedb2f4c
  [2] inet_ntop4(0x0, 0x0, 0x401, 0x401, 0x5c3a4, 0x920), at 0xfeeb8204
  [3] _inet_ntop_native(0x2, 0x56a2c, 0x0, 0x401, 0xfef1ae40, 0xffbeef5c), at 0xff064f5c
  [4] getnameinfo(0x56a28, 0x0, 0xffbef0cf, 0x100, 0x83a8, 0x0), at 0xff064dd0
=>[5] sys_getnameinfo(sa = 0x56a28, sa_len = 16U, host = 0xffbef1cf "0.0.0.0", hostlen = 1025U, serv = 0xffbef0cf "^P\x", servlen = 256U, flags = 8), line 436
in "linc-protocols.c"
  [6] linc_getnameinfo(sa = 0x56a28, sa_len = 16U, host = 0xffbef1cf "0.0.0.0", hostlen = 1025U, serv = 0xffbef0cf "^P\x", servlen = 256U, flags = 8), line 107
in "linc-protocols.c"
  [7] linc_server_setup(cnx = 0x5b930, proto_name = 0xff377c4c "IPv4", local_host_info = 0xffbef1cf "0.0.0.0", local_serv_info = (nil), create_options =
LINC_CONNECTION_NONBLOCKING), line 311 in "linc-server.c"
  [8] giop_server_new(giop_version = GIOP_1_2, proto_name = 0xff377c4c "IPv4", local_host_info = (nil), local_serv_info = (nil), create_options =
LINC_CONNECTION_NONBLOCKING, create_orb_data = 0x5a608), line 18 in "giop-server.c"
  [9] ORBit_start_servers(orb = 0x5a608), line 167 in "corba-object.c"
  [10] IOP_generate_profiles(obj = 0x5ada8), line 431 in "iop-profiles.c"
  [11] ORBit_marshal_object(buf = 0x5add8, obj = 0x5ada8), line 390 in "corba-object.c"
  [12] CORBA_ORB_object_to_string(_obj = 0x5a608, obj = 0x5ada8, ev = 0xffbef978), line 88 in "corba-orb.c"
  [13] dump_ior(orb = 0x5a608, fname = 0x37d68 "iorfile", ev = 0xffbef978), line 240 in "server.c"
  [14] main(argc = 1, argv = 0xffbef9fc), line 344 in "server.c"

Any ideas how to go on?
PLEASE, Cc: me, I'm not on the list.

Thanks,

Laca

--------patch follows----------
Index: include/orbit/GIOP/giop-recv-buffer.h
===================================================================
RCS file: /sgnome/cvsroots/GNOME/ORBit2/include/orbit/GIOP/giop-recv-buffer.h,v
retrieving revision 1.13
diff -u -r1.13 giop-recv-buffer.h
--- include/orbit/GIOP/giop-recv-buffer.h	2001/06/19 15:01:23	1.13
+++ include/orbit/GIOP/giop-recv-buffer.h	2001/07/12 17:30:10
@@ -69,6 +69,7 @@
 
 guint giop_recv_buffer_reply_status(GIOPRecvBuffer *buf);
 
+#ifdef __GNUC__
 extern inline guint giop_recv_buffer_reply_status(GIOPRecvBuffer *buf)
 {
   switch(buf->msg.header.version[1])
@@ -86,6 +87,8 @@
 
   return 0;
 }
+#endif
+
 CORBA_unsigned_long giop_recv_buffer_get_request_id(GIOPRecvBuffer *buf);
 char *giop_recv_buffer_get_opname(GIOPRecvBuffer *buf);
 CORBA_sequence_CORBA_octet *giop_recv_buffer_get_objkey(GIOPRecvBuffer *buf);
Index: include/orbit/orb-core/allocators.h
===================================================================
RCS file: /sgnome/cvsroots/GNOME/ORBit2/include/orbit/orb-core/allocators.h,v
retrieving revision 1.9
diff -u -r1.9 allocators.h
--- include/orbit/orb-core/allocators.h	2001/06/19 15:01:24	1.9
+++ include/orbit/orb-core/allocators.h	2001/07/12 17:30:10
@@ -28,8 +28,8 @@
 
 #ifdef ORBIT_DEBUG
 #define ORBIT_MAGIC_MEMPREFIX		0x1234fedc
-#define	ORBIT_MEM_MAGICDEF(name)	gulong name 
-#define ORBIT_MEM_MAGICSET(name)	(name) = ORBIT_MAGIC_MEMPREFIX
+#define	ORBIT_MEM_MAGICDEF(name)	gulong name;
+#define ORBIT_MEM_MAGICSET(name)	(name) = ORBIT_MAGIC_MEMPREFIX;
 #else
 #define ORBIT_MEM_MAGICDEF(name)
 #define ORBIT_MEM_MAGICSET(name)
@@ -46,19 +46,19 @@
 
 #define ORBIT_MEMHOW_TYPECODE	(3<<24)
 typedef struct ORBit_MemPrefix_TypeCode_type {
-    ORBIT_MEM_MAGICDEF(magic);
+    ORBIT_MEM_MAGICDEF(magic)
     CORBA_TypeCode	tc;
 } ORBit_MemPrefix_TypeCode;
 
 #define ORBIT_MEMHOW_KIDFNC1	(4<<24)
 typedef struct ORBit_MemPrefix_KidFnc1_type {
-    ORBIT_MEM_MAGICDEF(magic);
+    ORBIT_MEM_MAGICDEF(magic)
     ORBit_free_kidvals	freekids;
 } ORBit_MemPrefix_KidFnc1;
 
 #define ORBIT_MEMHOW_FREEFNC1	(5<<24)
 typedef struct ORBit_MemPrefix_FreeFnc1_type {
-    ORBIT_MEM_MAGICDEF(magic);
+    ORBIT_MEM_MAGICDEF(magic)
     ORBit_free_blk	freeblk;
 } ORBit_MemPrefix_FreeFnc1;
 
Index: include/orbit/orb-core/corba-any-type.h
===================================================================
RCS file: /sgnome/cvsroots/GNOME/ORBit2/include/orbit/orb-core/corba-any-type.h,v
retrieving revision 1.4
diff -u -r1.4 corba-any-type.h
--- include/orbit/orb-core/corba-any-type.h	2000/11/09 00:43:24	1.4
+++ include/orbit/orb-core/corba-any-type.h	2001/07/12 17:30:10
@@ -5,7 +5,7 @@
 
 struct _CORBA_any {
   CORBA_TypeCode _type;
-  gpointer _value;
+  char * _value;
   CORBA_boolean _release;
 };
 
Index: src/orb/orb-core/corba-typecode.c
===================================================================
RCS file: /sgnome/cvsroots/GNOME/ORBit2/src/orb/orb-core/corba-typecode.c,v
retrieving revision 1.10
diff -u -r1.10 corba-typecode.c
--- src/orb/orb-core/corba-typecode.c	2001/06/19 15:01:30	1.10
+++ src/orb/orb-core/corba-typecode.c	2001/07/12 17:30:11
@@ -124,7 +124,7 @@
 };
 
 #define DEF_TC_BASIC(nom) \
-struct CORBA_TypeCode_struct TC_CORBA_##nom##_struct = { \
+const struct CORBA_TypeCode_struct TC_CORBA_##nom##_struct = { \
   {&ORBit_TypeCode_epv, ORBIT_REFCOUNT_STATIC}, \
   CORBA_tk_##nom, \
   #nom, \
@@ -139,14 +139,14 @@
 #define CORBA_tk_unsigned_short CORBA_tk_ushort
 #define CORBA_tk_long_double CORBA_tk_longdouble
 
-struct CORBA_TypeCode_struct TC_null_struct = {
+const struct CORBA_TypeCode_struct TC_null_struct = {
   {&ORBit_TypeCode_epv, ORBIT_REFCOUNT_STATIC},
   CORBA_tk_null,
   "null",
   "Null",
   0, 0, NULL, NULL, NULL, CORBA_OBJECT_NIL, -1, 0, 0, 0
 };
-struct CORBA_TypeCode_struct TC_void_struct = {
+const struct CORBA_TypeCode_struct TC_void_struct = {
   {&ORBit_TypeCode_epv, ORBIT_REFCOUNT_STATIC},
   CORBA_tk_void,
   "void",
Index: test/Makefile.am
===================================================================
RCS file: /sgnome/cvsroots/GNOME/ORBit2/test/Makefile.am,v
retrieving revision 1.10
diff -u -r1.10 Makefile.am
--- test/Makefile.am	2001/06/26 00:06:01	1.10
+++ test/Makefile.am	2001/07/12 17:30:11
@@ -14,7 +14,7 @@
 
 TESTS = test-dynany
 
-LDADD = $(top_builddir)/src/orb/libORBit-2.la
+LDADD = $(top_builddir)/src/orb/libORBit-2.la -lm
 
 TEST_ANY_IDLOUT=test-any.h test-any-common.c test-any-stubs.c test-any-skels.c
 test_any_client_SOURCES=test-any-client.c $(TEST_ANY_IDLOUT)
Index: test/test-dynany.c
===================================================================
RCS file: /sgnome/cvsroots/GNOME/ORBit2/test/test-dynany.c,v
retrieving revision 1.2
diff -u -r1.2 test-dynany.c
--- test/test-dynany.c	2001/06/19 15:01:33	1.2
+++ test/test-dynany.c	2001/07/12 17:30:11
@@ -6,7 +6,7 @@
 #include <orbit/orbit.h>
 #include "dynany.h"
 
-#define CHECK_OK(ev)           (g_assert ((ev)->_major == CORBA_NO_EXCEPTION))
+#define CHECK_OK(ev)           g_assert ((ev)->_major == CORBA_NO_EXCEPTION)
 #define CHECK_TYPE_MISMATCH(ev) \
 	do { \
 		g_assert ((ev)->_major == CORBA_USER_EXCEPTION && \
--------patch ends----------
/*
 * This file was generated by orbit-idl - DO NOT EDIT!
 */
#include <foo.h>
#ifndef baa_H
#define baa_H 1
#include <glib.h>
#define ORBIT_IDL_SERIAL 10
#include <orbit/orbit-types.h>
#ifdef __cplusplus
extern "C" {
#endif				/* __cplusplus */
   /** typedefs **/
#pragma	include_defs foo.h
# 5
#if !defined(ORBIT_DECL_Foo_Child) && !defined(_Foo_Child_defined)
#define ORBIT_DECL_Foo_Child 1
#define _Foo_Child_defined 1
#define Foo_Child__freekids CORBA_Object__freekids
   typedef CORBA_Object Foo_Child;
   extern CORBA_unsigned_long Foo_Child__classid;
#if !defined(TC_IMPL_TC_Foo_Child_0)
#define TC_IMPL_TC_Foo_Child_0 'b'
#define TC_IMPL_TC_Foo_Child_1 'a'
#define TC_IMPL_TC_Foo_Child_2 'a'
   extern const struct CORBA_TypeCode_struct TC_Foo_Child_struct;
#define TC_Foo_Child ((CORBA_TypeCode)&TC_Foo_Child_struct)
#endif
#endif
   /** POA structures **/
#ifndef _defined_POA_Foo_Child
#define _defined_POA_Foo_Child 1
   typedef struct {
      void *_private;
      void (*bar) (PortableServer_Servant _servant, CORBA_Environment * ev);
   } POA_Foo_Child__epv;
   typedef struct {
      PortableServer_ServantBase__epv *_base_epv;
      POA_Foo_Parent__epv *Foo_Parent_epv;
      POA_Foo_Child__epv *Foo_Child_epv;
   } POA_Foo_Child__vepv;
   typedef struct {
      void *_private;
      POA_Foo_Child__vepv *vepv;
   } POA_Foo_Child;
   extern void POA_Foo_Child__init(PortableServer_Servant servant, CORBA_Environment * ev);
   extern void POA_Foo_Child__fini(PortableServer_Servant servant, CORBA_Environment * ev);
#endif				/* _defined_POA_Foo_Child */
   /** skel prototypes **/
   void _ORBIT_skel_small_Foo_Child_bar(POA_Foo_Child * _ORBIT_servant, gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx, CORBA_Environment * ev, void (*_impl_bar) (PortableServer_Servant _servant, CORBA_Environment * ev));
   /** stub prototypes **/
#define Foo_Child_foo Foo_Parent_foo
   void Foo_Child_bar(Foo_Child _obj, CORBA_Environment * ev);
   /** more internals **/
#include <orbit/orb-core/orbit-interface.h>
   extern ORBit_IInterface Foo_Child__itype;
   extern ORBit_IMethod Foo_Child__imethods[];
#define Foo_Child_IMETHODS_LEN 1
#ifdef __cplusplus
}
#endif				/* __cplusplus */
#ifndef EXCLUDE_ORBIT_H
#include <orbit/orbit.h>
#endif				/* EXCLUDE_ORBIT_H */
/**INDENT** Error@73: Unmatched #endif */
#endif
#undef ORBIT_IDL_SERIAL
/*
 * This file was generated by orbit-idl - DO NOT EDIT!
 */
#ifndef foo_H
#define foo_H 1
#include <glib.h>
#define ORBIT_IDL_SERIAL 10
#include <orbit/orbit-types.h>
#ifdef __cplusplus
extern "C" {
#endif				/* __cplusplus */
   /** typedefs **/
#if !defined(ORBIT_DECL_Foo_Parent) && !defined(_Foo_Parent_defined)
#define ORBIT_DECL_Foo_Parent 1
#define _Foo_Parent_defined 1
#define Foo_Parent__freekids CORBA_Object__freekids
   typedef CORBA_Object Foo_Parent;
   extern CORBA_unsigned_long Foo_Parent__classid;
#if !defined(TC_IMPL_TC_Foo_Parent_0)
#define TC_IMPL_TC_Foo_Parent_0 'f'
#define TC_IMPL_TC_Foo_Parent_1 'o'
#define TC_IMPL_TC_Foo_Parent_2 'o'
   extern const struct CORBA_TypeCode_struct TC_Foo_Parent_struct;
#define TC_Foo_Parent ((CORBA_TypeCode)&TC_Foo_Parent_struct)
#endif
#endif
   /** POA structures **/
#ifndef _defined_POA_Foo_Parent
#define _defined_POA_Foo_Parent 1
   typedef struct {
      void *_private;
      void (*foo) (PortableServer_Servant _servant, CORBA_Environment * ev);
   } POA_Foo_Parent__epv;
   typedef struct {
      PortableServer_ServantBase__epv *_base_epv;
      POA_Foo_Parent__epv *Foo_Parent_epv;
   } POA_Foo_Parent__vepv;
   typedef struct {
      void *_private;
      POA_Foo_Parent__vepv *vepv;
   } POA_Foo_Parent;
   extern void POA_Foo_Parent__init(PortableServer_Servant servant, CORBA_Environment * ev);
   extern void POA_Foo_Parent__fini(PortableServer_Servant servant, CORBA_Environment * ev);
#endif				/* _defined_POA_Foo_Parent */
   /** skel prototypes **/
   void _ORBIT_skel_small_Foo_Parent_foo(POA_Foo_Parent * _ORBIT_servant, gpointer _ORBIT_retval, gpointer * _ORBIT_args, CORBA_Context ctx, CORBA_Environment * ev, void (*_impl_foo) (PortableServer_Servant _servant, CORBA_Environment * ev));
   /** stub prototypes **/
   void Foo_Parent_foo(Foo_Parent _obj, CORBA_Environment * ev);
   /** more internals **/
#include <orbit/orb-core/orbit-interface.h>
   extern ORBit_IInterface Foo_Parent__itype;
   extern ORBit_IMethod Foo_Parent__imethods[];
#define Foo_Parent_IMETHODS_LEN 1
#ifdef __cplusplus
}
#endif				/* __cplusplus */
#ifndef EXCLUDE_ORBIT_H
#include <orbit/orbit.h>
#endif				/* EXCLUDE_ORBIT_H */
#endif
#undef ORBIT_IDL_SERIAL


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]