HP3000-L Archives

February 2006, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Bill Cadier <[log in to unmask]>
Reply To:
Bill Cadier <[log in to unmask]>
Date:
Tue, 21 Feb 2006 10:14:33 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (124 lines)
Joe Courtney wrote:

> Here is an update from my posting yesterday.  I decided to start over and 
> install the 2.95.1 (thread safe g++ 2.95.x for mpe/ix 6.0) from the 
> jazz.external.hp.com site.  This install included tar files of GNUCORE, 
> GNUGCC, and GNULIBS, along with GNUCVS.  I ran the INSTALL scripts to do 
> this, and I noticed they do some cleanup, but I'm afraid I may be confusing 
> the system with 3.3.1 and 2.95 now.  However, I was able to compile my 
> hello.cpp program as MANAGER.SYS after doing this.
> 
> shell/iX> g++ -v
> Reading specs from /usr/local/lib/gcc-lib/hppa1.0-hp-mpeix/2.95.1/specs
> gcc version 2.95.1 19990816 (release)
> 
> I believe you are on the right track when you said it sounds like a 
> permissions issue, because I was still NOT able to compile under my account 
> (not SM).  Again, the installs (ran as MANAGER.SYS) hosed my /usr/local/lib 
> permissions as indicated by all PERL programs crashing.  (I really wish I 
> had a beta system to do things on first.)  I had to run chmod -R 
> +rx /usr/local again, and after doing this, I was able to compile from my 
> account too.  Now, I am having thread issues during run time.  (Why would 
> anything link at runtime?  It's like DLLs?)  I have modified my original 
> hello.cpp program to illustrate my new problem with threads:
> 
> hello.cpp:
> ====================================================
> #if !defined _POSIX_SOURCE
> #define _POSIX_SOURCE
> #endif
> 
> #include <stdlib.h>
> #include <stdio.h>
> #include <string>
> #include <unistd.h>
> 
> using namespace std;
> 
> int main()
> {
>         cout << "Hello\n";
>         string strCmd = "ls -la >/gcc/test/test.out";
>         execl("/bin/sh","sh","-c",strCmd.c_str(),0);
>         return 0;
> } 
> ====================================================
> 
> shell/iX> make
> g++ hello.cpp -o hello -lstdc++ -lpthread
> 
> shell/iX> ./hello
> UNRESOLVED EXTERNALS: pthread_keycreate  (LDRERR 512)
>  
> **** EXEC FUNCTION FAILED; subsys =517; info = 48 
> ABORT: /gcc/test/hello 
> NM SYS   a.01007770 dbg_abort_trace+$28
> [1] + Done(134) ./hello
>   32178453      Abort   ./hello
> 

< snip >

> MPELXL2J  8606-157610 - RELINKER patch to NL  WED, DEC 12, 2001   1:05 P
>    Posix draft 10 APIs, pthread enhancements, signals and errno changes

< snip >

> MPELXW8B  8606-212538 - THDWRPRL.LIB.SYS  WED, DEC 12, 2001   1:08 PM
>    New Version of OTHDXL.THREAD.SYS File For Draft 4 Support

< snip >

Quick possible solution:

Add "#define _PTHREAD_D4" to your source or -D_PTHREAD_D4 to your make
file. And, you probably don't need to have -lpthread since the 2.95.1
version takes care of some of the threads linking requirements.

The reason:

As the Jazz gcc web page says, the 2.95.1 version automagically links
your code with DCEXL.HPDCE.SYS and OTHDXL.THREADS.SYS. Even if you
aren't writing a threaded application. I believe this is actually done
in /etc/ld.ccg.

The original offering of threads on MPE/iX came in DCEXL.HPDCE.SYS and
OTHREADXL.THREADS.SYS. And initially the only "supported" use of threads
was in DCE (Distributed Computing Environment) programs since the DCE
libraries rely on threads.

The code in DCEXL and OTHDXL is also POSIX 1003.1c Draft 4. However the
POSIX standards people later came up with "Draft 10" which isn't just a
superset of Draft 4 it also changes some of the API's (hey, why not,
it's a committee after all? :-). The DCE library on MPE was not updated
to use Draft 10 so we have to deliver both.

One of the APIs that changed in Draft 10 was... pthread_keycreate
becoming pthread_key_create. Apparently those wacky standards people
thought the extra underscore made things much more readable and would
help guarantee job security for all the junior programmers given the
grunt work of fixing source code.

When you installed MPELXL2J you got draft 10 threads, including an
updated /usr/include/pthread.h. Draft 4 would still work as long as you
added the define "_PTHREAD_D4". You also have MPELXW8B which updates
OTHDXL since a lot of what had been in DCEXL and XL.PUB.SYS moved into
NL.PUB.SYS making threads more a part of the OS rather than a "bolt on"
as it had been in it's initial offering.

If you aren't ever going to write threaded applications you would be
better off with the unthreaded version 2.95.2. If you do actually want
to write threaded apps I believe you'll be limited to using draft 4
APIs. If I recall correctly (it's been a few years) the 2.95.1 version
uses calls to pthread_getspecific (among other things) to manage
threaded class instantiation. In draft 4 that function returned an "int"
however on draft 10 it returns a "void *".

That's probably more information than you needed but I hope it helps.

Bill
hp/vCSY

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2