Running SIMPLE program fails ... libc.a

Running SIMPLE program fails ... libc.a

Post by P » Wed, 18 Oct 2000 04:00:00



Hi,

AIX 4.2.1, C for AIX 4.3 (I think).

I have a program, the source of which is:

#include <stdio.h>

void
main()
{
   printf("Blah.\n");

Quote:}

I can compile and link an executable for this fine.

However, when you try to run the program without the $LIBPATH
environment variable set to anything, the following errors occur:

exec(): 0509-036 Cannot load program testt because of the following
errors:
        0509-022 Cannot load library libc.a[shr.o].
        0509-026 System error: A file or directory in the path name
does not exist.

We have never set LIBPATH to anything in the past and we have been
able to compile, link, and execute C programs fine.  When I set
LIBPATH to include /usr/lib, the program executes successfully.

However, something has transpired on our box which deserves mention.
Because we had intended to upgrade our Oracle Pro*C/C++ precompiler to
version 8.1.6, we thought we had to install C for AIX 4.4, which we
did.  

After this I started to have some problems with our old programs, so I
decided I would like to roll the C compiler back to version 4.3, which
I did.  I feel stranger things are happening now, like the errors
above.

I am not comfortable that there are still not traces of C for AIX 4.4
messing things up on the box.  It seems like things are out of whack
somewhere.  Has anyone tried to downgrade their AIX C compiler before?
Are there gotchas I don't know about?  Anyone have any ideas?

 
 
 

Running SIMPLE program fails ... libc.a

Post by Joe Moo » Thu, 19 Oct 2000 04:00:00




>However, when you try to run the program without the $LIBPATH
>environment variable set to anything, the following errors occur:

>exec(): 0509-036 Cannot load program testt because of the following
>errors:
>        0509-022 Cannot load library libc.a[shr.o].
>        0509-026 System error: A file or directory in the path name
>does not exist.

>We have never set LIBPATH to anything in the past and we have been
>able to compile, link, and execute C programs fine.  When I set
>LIBPATH to include /usr/lib, the program executes successfully.

If the LIBPATH variable is set when you compile (more specifically link)
your program, this will be stored in the executable itself.  Look at the
output of "dump -Ht" under the section of Import File Strings.

If the executable has not been stripped of symbol information, it is
possible to change this header.  This was described in the release notes
for Sendmail 8.10 (AIX security problem which is not really a security
problem) and other places.  

This XCOFF header information can be controlled by some command line options
at compile time, too.

Gary Hook, a regular around here, might be able to explain better, or
(preferably) explain why IBM decided to include the LIBPATH in the
executable.  (please, Gary?)

--Joe
--
"It is unlikely that the world is ever going to move to one operating
environment. There are always going to be three or four commonly used
operating environments." - Paul Maritz, Interview with CrossTalk,
http://www.stsc.hill.af.mil/CrossTalk/2000/sep/maritz.asp

 
 
 

Running SIMPLE program fails ... libc.a

Post by Gary R. Hoo » Thu, 19 Oct 2000 04:00:00



> If the LIBPATH variable is set when you compile (more specifically link)
> your program, this will be stored in the executable itself.  Look at the
> output of "dump -Ht" under the section of Import File Strings.

> If the executable has not been stripped of symbol information, it is
> possible to change this header.  This was described in the release notes
> for Sendmail 8.10 (AIX security problem which is not really a security
> problem) and other places.

As stated, view the loader header to see what the library path is set
to;
it's entry 0 in the Import File Strings section.

The use of LIBPATH to specify what goes into the executable is historic;
it's been that way since AIX 3.1.  I've never agreed with it; LIBPATH
should
only have been used at exec/load time, not at link time.  But what's
done
is done, and we're not in a position to change the behavior.

Using -L when you link overrides LIBPATH.  LIBPATH should only be used
to
run applications, not to build them.  Without more information, it's
difficult to determine why the original poster is having a problem.

--
Gary R. Hook / AIX Kernel Development, IBM / These opinions are _MINE_
________________________________________________________________________
A piece of canvas is only the beginning
It takes on character with every loving stroke
This thing of beauty is the passion of an artist's heart
By God's design, we are a skin kaleidoscope    "Colored people", dc Talk

 
 
 

Running SIMPLE program fails ... libc.a

Post by P » Thu, 19 Oct 2000 04:00:00


The last output from the dump command on the executable is:

                        ***Import File Strings***
INDEX  PATH                          BASE                MEMBER

0      /u01/app/oracle/product/8.1.5/lib/:/usr/lib:/lib

1                                    libc.a              shr.o

2                                    libclntsh.a         shr.o  

This is the same result whether I compile / link with $LIBPATH set or
not.

On Wed, 18 Oct 2000 12:37:30 -0500, "Gary R. Hook"



>> If the LIBPATH variable is set when you compile (more specifically link)
>> your program, this will be stored in the executable itself.  Look at the
>> output of "dump -Ht" under the section of Import File Strings.

>> If the executable has not been stripped of symbol information, it is
>> possible to change this header.  This was described in the release notes
>> for Sendmail 8.10 (AIX security problem which is not really a security
>> problem) and other places.

>As stated, view the loader header to see what the library path is set
>to;
>it's entry 0 in the Import File Strings section.

>The use of LIBPATH to specify what goes into the executable is historic;
>it's been that way since AIX 3.1.  I've never agreed with it; LIBPATH
>should
>only have been used at exec/load time, not at link time.  But what's
>done
>is done, and we're not in a position to change the behavior.

>Using -L when you link overrides LIBPATH.  LIBPATH should only be used
>to
>run applications, not to build them.  Without more information, it's
>difficult to determine why the original poster is having a problem.

>--
>Gary R. Hook / AIX Kernel Development, IBM / These opinions are _MINE_
>________________________________________________________________________
>A piece of canvas is only the beginning
>It takes on character with every loving stroke
>This thing of beauty is the passion of an artist's heart
>By God's design, we are a skin kaleidoscope    "Colored people", dc Talk

 
 
 

Running SIMPLE program fails ... libc.a

Post by Joe Moo » Fri, 20 Oct 2000 04:00:00




>The last output from the dump command on the executable is:

>                        ***Import File Strings***
>INDEX  PATH                          BASE                MEMBER

>0      /u01/app/oracle/product/8.1.5/lib/:/usr/lib:/lib

This means that /u01/app/oracle/product/8.1.5/lib will be searched before
the standard system libraries.  Is there a libc.a in that directory?

Also, what OS level are you compiling on, and what OS level are you trying
to run on?

--Joe
--
"It is unlikely that the world is ever going to move to one operating
environment. There are always going to be three or four commonly used
operating environments." - Paul Maritz, Interview with CrossTalk,
http://www.stsc.hill.af.mil/CrossTalk/2000/sep/maritz.asp

 
 
 

1. Simple way to do simple remote program run?

All I want to do is run "uname" on a remote machine, and grab the results.
I know how to do this with rsh and popen/pclose, but only if the user has
a trusted access set up (this is not run as root). Is there a good way to
do this without resorting to special sockets and such?

--
Paul Miller                  |          "I am Pentium of Borg.
SGI Senior Software Engineer |         You will be approximated."
     Elastic Reality - a division of Avid Technology, Inc.

2. tape drive problems

3. Upgraded libc, ld.so - can't compile simple program now

4. turn a uid into a user name

5. Problem running C program (could !load libc.c[shr.o] & a.out)

6. Multisampling not available on Radeon 9500 PRO?

7. g++ will not run simple program

8. Redhat 7.0, faulty disk geometry problem

9. Simple server program running on redhat 5.2

10. Running a simple /shell/program causes memory fault (coredump)

11. bind() fails when running program second time

12. Programs (some) fail to run.

13. running a program fails on AIX 4.3.2