All programs hang - Aix

This is a discussion on All programs hang - Aix ; Well, actually it is all new programs that I create. AIX 5.2 Got a copy of gcc, compiled a null program [main(){}] and ran a.out. The program waits for input from stdin! Several test show that if I enter a ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: All programs hang

  1. All programs hang

    Well, actually it is all new programs that I create.

    AIX 5.2

    Got a copy of gcc, compiled a null program [main(){}] and ran a.out.
    The program waits for input from stdin! Several test show that if I
    enter a number such as 1234, then ^D, it will echo the number.

    I ran several other tests to confirm to myself that the program was
    never actually getting to main() at all.

    So, I thought the linking step screwed up and I went as far as building
    an assembler file and linking it by hand.
    ld -o a.out -lc test.o
    results: same read-from-stdin problem.

    If I have this right, libc.a (-lc above) should contain the default
    entry point of __start which does whatever(including open stdin,
    stdout, and stderr) then calls _main. I would say that obviously
    something weird is happening in the opening of stdin, but what have I
    done wrong with this system?


  2. Re: All programs hang

    tilehead wrote:

    > Well, actually it is all new programs that I create.

    [SNIP]
    1 - Don't use the word "test" *at* *all* *anywhere* in your file names.

    2 - Don't use "ld" directly.

    So, what does the standard "Hello World" program do?

    Cheers,
    Gary B-)

    --
    __________________________________________________ ____________________________
    Armful of chairs: Something some people would not know
    whether you were up them with or not
    - Barry Humphries

  3. Re: All programs hang

    1. Well, actually it was t.c but that didn't look good in the post.

    2. I really didn't want to use ld directly, but I wasn't sure that gcc
    was invoking ld correctly, so I did it by hand (and got the same
    results).

    3. When executing the "Hello World" program, it immediately goes to
    read from stdin. If I type "1234 and a ^D, it just echoes "1234".
    It never actually gets to main().
    [I've tried several other tests, including an infinite loop, to prove
    to myself that it never gets to main().]

    Gary R. Schmidt wrote:
    > tilehead wrote:
    >
    > > Well, actually it is all new programs that I create.

    > [SNIP]
    > 1 - Don't use the word "test" *at* *all* *anywhere* in your file names.
    >
    > 2 - Don't use "ld" directly.
    >
    > So, what does the standard "Hello World" program do?
    >
    > Cheers,
    > Gary B-)
    >
    > --
    > __________________________________________________ ____________________________
    > Armful of chairs: Something some people would not know
    > whether you were up them with or not
    > - Barry Humphries



  4. Re: All programs hang

    tilehead wrote:
    > 3. When executing the "Hello World" program, it immediately goes to
    > read from stdin. If I type "1234 and a ^D, it just echoes "1234".
    > It never actually gets to main().


    What is the _exact_ command line you use to start the test program?

    Yours,
    Laurenz Albe

  5. Re: All programs hang

    a.out

    Laurenz Albe wrote:

    >
    > What is the _exact_ command line you use to start the test program?
    >
    > Yours,
    > Laurenz Albe



  6. Re: All programs hang

    tilehead wrote:
    > a.out
    >
    > Laurenz Albe wrote:
    >
    >> What is the _exact_ command line you use to start the test program?
    >>
    >> Yours,
    >> Laurenz Albe

    >


    Just "a.out" will run a program called a.out in the path. It may not be
    the one you think you are executing. Try "./a.out"

  7. Re: All programs hang

    Well it worked. I feel like the dweeb of all time.

    A new machine, not set up the normal way I set up my account, blah,
    blah...

    But thank you so very much.

    Roy wrote:

    >
    > Just "a.out" will run a program called a.out in the path. It may not be
    > the one you think you are executing. Try "./a.out"



  8. Re: All programs hang

    tilehead wrote:
    > Well it worked. I feel like the dweeb of all time.
    >
    > A new machine, not set up the normal way I set up my account, blah,
    > blah...
    >
    > But thank you so very much.
    >
    > Roy wrote:
    >
    >
    >>Just "a.out" will run a program called a.out in the path. It may not be
    >>the one you think you are executing. Try "./a.out"

    >
    >


    may be

    whence a.out

    will tell you wich on you were executing.

    Patrick

+ Reply to Thread