Operating System - HP-UX
1836462 Members
2661 Online
110101 Solutions
New Discussion

Runtime error with process compiled on HP-UX 11 with DCE 1.5

 
Rui Vilao
Regular Advisor

Runtime error with process compiled on HP-UX 11 with DCE 1.5

Greetings,

Thanks to a previous thread in this Forum (Compiling HP-UX 10.20 legacy code
based on DCE 1.5 on HP11), we were able to compile our software using the
following compiler option:


/opt/ansic/bin/cc -D_HPUX_10 -DHPUX -D_HPUX_SOURCE -DHPUX_DCE +ESlit +Oprocelim +DAportable +O2 -Aa +O2 +DAportable -DIRE_TRACING_ACTIVE -g +w1 -D_POSIX_D10_THREADS -D_HPUX_SOURCE -D_REENTRANT -D_PTHREADS_DRAFT4 -c -I . -I /usr/include -I /opt/dce/include -I ../../inc -I ../../gen/HP -I ../inc -I ../gen/HP -I /vob_mnt/A1340/if/gen/HP -I /vob_mnt/A1340/if/inc -I /vob_mnt/A1340/if/inc/bitmaps -I /opt/app/oracle/product/8.0.6/forms60/pub -I /opt/app/oracle/product/8.1.6/precomp/public -I /usr/include/X11R5 -I /usr/include/Motif2.1 -I /usr/include/Motif2.1/Xm -I /opt/OV/include -I /opt/uimx2.9/config -I /usr/dt/include -I /opt/commserv6.0.1/inc -I /opt/ilog/server42/include -I /opt/ilog/views311/include -I /opt/aoi/include -I /opt/flexlm/v7.0/machind top_query.c -o ../../obj/HP/top_query.o
cc: warning 499: Debugger 'fix and continue' feature not supported in
this mode.
cpp: "/usr/include/sys/unistd.h", line 484: warning 2001: Redefinition
of macro _POSIX_THREAD_ATTR_STACKSIZE.
cc: "top_query.c", line 172: warning 714: Function "top_allocate_ctx"
called with no prototype or definition in scope.
cc: "top_query.c", line 366: warning 714: Function
"top_init_moc_attributes" called with no prototype or definition in
scope.
cc: "top_query.c", line 396: warning 714: Function "top_free_ctx" called
with no prototype or definition in scope.
cc: "top_query.c", line 82: warning 517: Function returns no value.

/opt/ansic/bin/cc -D_HPUX_10 -DHPUX -D_HPUX_SOURCE -DHPUX_DCE +ESlit +Oprocelim +DAportable +O2 ../../obj/HP/top_query_common_db.o ../../obj/HP/top_get_db_info.o ../../obj/HP/top_mpt_db.o ../../obj/HP/top_iid_to_name.o ../../obj/HP/top_get_alarm_info.o ../../obj/HP/top_get.o ../../obj/HP/top_query.o ../../obj/HP/top_query_sstub.o ../../obj/HP/top_mpt_query_sstub.o ../../obj/HP/ire_trace_cfg_sstub.o -L../../obj/HP -L/vob_mnt/A1340/if/lib/HP -lire -D_HPUX_10 -DHPUX -D_HPUX_SOURCE -DHPUX_DCE +ESlit +Oprocelim +DAportable +O2 -L/vob_mnt/A1340/if/lib/HP -lire -lire_gui -lire_nav /opt/flexlm/v7.0/hp700_u9/lm_new.o -L/opt/flexlm/v7.0/hp700_u9 -llmgr -L/opt/app/oracle/product/8.1.6/lib -L/opt/app/oracle/product/8.0.6/lib -lclntsh `cat /opt/app/oracle/product/8.1.6/lib/sysliblist` -lm -lpthread -lpthread -lm -L/usr/dt/lib -lDtHelp -lDtSvc -L/usr/lib/Motif2.1 -lMrm -lXm -L/usr/lib/X11R5 -lXt -lX11 -L/opt/commserv6.0.1/lib /opt/langtools/lib/end.o -ldce -lndbm -lm -lc_r -Wl,-B immediate -Wl,-B nonfatal -o ../../obj/HP/top_query


When we try to run our process on HP11 with DCE 1.5 we get the error:

Pthread internal error: message: __libc_reinit() failed, file: /ux/core/kern/pth
reads/pthread.c, line: 1093
Return Pointer is 0x7e8af0c3


Is there some incompatibilty between DCE threads and HP-UX threads?

Any help/suggestion is highly appreciated.

Thanks in advance for your help!

Kind Regards,

Rui.
"We should never stop learning"_________ rui.vilao@rocketmail.com
6 REPLIES 6
melvyn burnard
Honored Contributor

Re: Runtime error with process compiled on HP-UX 11 with DCE 1.5

You should remove the -lc_r from
the cc command. It appears that the HP-UX 11.x agent is a native 11.x agent and uses,
or is compiled with Kernel Threads (libpthread), which cannot be
intermixed with Posix/DCE threads.
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Frederic Soriano
Honored Contributor

Re: Runtime error with process compiled on HP-UX 11 with DCE 1.5

Rui,

This is certainly due to the fact that you are trying to compile with Kernel Threads (libpthread), which cannot be intermixed with Posix/DCE threads.

Try removing -lc_r and -ldce LIBS from the cc command, and recompile. This should do the trick.

I hope this helps !

Best regards,

Fred.

Rui Vilao
Regular Advisor

Re: Runtime error with process compiled on HP-UX 11 with DCE 1.5

Melvyn and Frederic,

Thanks a lot for your contribution.

Thanks to your suggestions we have changed our compilation flags as follow:

/opt/ansic/bin/cc -D_HPUX_10 -DHPUX -D_HPUX_SOURCE -DHPUX_DCE +ESlit +Oprocelim +DAportable -Aa +DAportable -DIRE_TRACING_ACTIVE -g +w1 -D_POSIX_D10_THREADS -D_HPUX_SOURCE -D_REENTRANT -D_PTHREADS_DRAFT4 -c -I . -I /usr/include -I /opt/dce/include -I ../../inc -I ../../gen/HP -I ../inc -I ../gen/HP -I /vob_mnt/A1340/if/gen/HP -I /vob_mnt/A1340/if/inc -I /vob_mnt/A1340/if/inc/bitmaps -I /opt/app/oracle/product/8.0.6/forms60/pub -I /opt/app/oracle/product/8.1.6/precomp/public -I /usr/include/X11R5 -I /usr/include/Motif2.1 -I /usr/include/Motif2.1/Xm -I /opt/OV/include -I /opt/uimx2.9/config -I /usr/dt/include -I /opt/commserv6.0.1/inc -I /opt/ilog/server42/include -I /opt/ilog/views311/include -I /opt/aoi/include -I /opt/flexlm/v7.0/machind top_query.c -o ../../obj/HP/top_query.o

Linking:

/opt/ansic/bin/cc -D_HPUX_10 -DHPUX -D_HPUX_SOURCE -DHPUX_DCE +ESlit +Oprocelim +DAportable ../../obj/HP/top_query_common_db.o ../../obj/HP/top_get_db_info.o ../../obj/HP/top_mpt_db.o ../../obj/HP/top_iid_to_name.o ../../obj/HP/top_get_alarm_info.o ../../obj/HP/top_get.o ../../obj/HP/top_query.o ../../obj/HP/top_query_sstub.o ../../obj/HP/top_mpt_query_sstub.o ../../obj/HP/ire_trace_cfg_sstub.o -L../../obj/HP -L/vob_mnt/A1340/if/lib/HP -lire -D_HPUX_10 -DHPUX -D_HPUX_SOURCE -DHPUX_DCE +ESlit +Oprocelim +DAportable -L/vob_mnt/A1340/if/lib/HP -lire -lire_gui -lire_nav /opt/flexlm/v7.0/hp700_u9/lm_new.o -L/opt/flexlm/v7.0/hp700_u9 -llmgr -ldce -lndbm -lm -Wl,-B immediate -Wl,-B nonfatal -L/opt/app/oracle/product/8.1.6/lib -L/opt/app/oracle/product/8.0.6/lib -lclntsh -l:libcl.a -l:librt.sl -l:libnss_dns.1 -l:libdld.sl -lm -lm -L/usr/dt/lib -lDtHelp -lDtSvc -L/usr/lib/Motif2.1 -lMrm -lXm -L/usr/lib/X11R5 -lXt -lX11 -L/opt/commserv6.0.1/lib /opt/langtools/lib/end.o -ldce -lndbm -lm -Wl,-B immediate -Wl,-B nonfatal -o ../../obj/HP/top_query

Running with the debugger wdb, stops before main() with SIGBUS:

Program received signal SIGBUS, Bus error.
[Switched to thread 1 (user thread (7589, 0))]
0x7f6e52a8 in () from /usr/lib/libc.2

Threads:
1) user thread (7589, 0) 0x7f6e52a8 in () from /usr/lib/libc.2

Call Stack:
#0 0x7f6e52a8 in () from /usr/lib/libc.2
#1 0x7f7b7ea8 in __thread_atfork () from /usr/lib/libc.2
#2 0x7f7b5a80 in __libc_init () from /usr/lib/libc.2
#3 0x7e1e3af4 in hp__pre_init_libc () from /usr/lib/libcma.2


Please note that we are trying to compile with DCE 1.5 on HP-UX 11.

Any help/suggestion is highly appreciated.

TIA.

Kind Regards,

Rui.
"We should never stop learning"_________ rui.vilao@rocketmail.com
Andy Bennett
Valued Contributor

Re: Runtime error with process compiled on HP-UX 11 with DCE 1.5

The problem still relates to the mix of threads packages. You need to decide which threads package you are going to use and get everything to match:

In the compile line:
- You have both -D_POSIX_D10_THREADS and -D_PTHREADS_DRAFT4. The former is for kernel threads, the latter is DCE/CMA threads; you only need one.
- You have -I/opt/dce/include. It is probably worth checking to see if you really need this; /usr/include has links to most of the things relevant to DCE.

In the link line:
- Although it is not mentioned anymore, libpthread is probably being included indirectly by another library still (run 'odump -sllibloadlist ', or 'chatr ' on each library to check). It probably used by one of the third party libraries. You still also have -ldce on the link line therefore the CMA package is running too.
- It is only possible to have one threads package included in an application, so you'll need to pick the correct libraries too. If you want to use CMA/DCE carry on using -ldce and remove the reference to libpthread. For kernel threads, replace -ldce with -ldcekt (This may need to be installed from the applications CDs if it is not present).

If you have parts of the application with thread calls that were written for the CMA threads package, you'll need to check the calls against the man pages on 11.00 to make sure they are correct since the threads interface has changed a bit between the implementations of CMA and kernel threads.
Rui Vilao
Regular Advisor

Re: Runtime error with process compiled on HP-UX 11 with DCE 1.5

 
"We should never stop learning"_________ rui.vilao@rocketmail.com
Andy Bennett
Valued Contributor

Re: Runtime error with process compiled on HP-UX 11 with DCE 1.5

There are only two solutions to the problem:

1. Port your application to use kernel threads and hence -ldcekt.

or

2. Get a CMA threads version of Oracle. You cannot force the version you have to use CMA threads, it will have to be a version specifically engineered for that package.



Not totally related to this, but still important. Don't link against libdce.1. This is the 10.20 compatibility library and it is there to support applications built on 10.20 and ported as executables only. If you are compiling on 11.00 use libdce.sl (that is, libdce.2).