Operating System - HP-UX
1821832 Members
3587 Online
109638 Solutions
New Discussion юеВ

Re: aCC not producing a.out file

 
Allen Broadman
Occasional Advisor

aCC not producing a.out file

I'm running aCC with a simple source file (main.c) that just contains the K&R "hello world" program.

aCC consumes the file without any error messages but does not produce object code (no main.o) and does not produce a linked executable (no a.out). I checked the entire drive for an a.out but cannot find it.

If I invoke aCC -c main.c then it does produce the main.o file as expected.

Any ideas?

Allen Broadman
13 REPLIES 13
Stefan Farrelly
Honored Contributor

Re: aCC not producing a.out file


Try the -o option
Im from Palmerston North, New Zealand, but somehow ended up in London...
Allen Broadman
Occasional Advisor

Re: aCC not producing a.out file

There is no -o option.

Do you mean -O ? I tried that with the same result.

The aCC online docs are pretty clear that the default behavior of "aCC main.c" should be to produce object and executable code.

Allen
Stefan Farrelly
Honored Contributor

Re: aCC not producing a.out file


Ive just installed an aCC compiler to sort this out, sorry for the delay.

You can compile your program in 2 steps;
1. aCC -c hello.c
2. aCC hello.o
This creates your binary, a.out

You can also do the compile and link in 1 step;
1. aCC hello.c
This creates the binary a.out, but no object(.o) file.
Then you can execute the binary fine.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Allen Broadman
Occasional Advisor

Re: aCC not producing a.out file

Thanks for installing aCC to help me with this.

As I said in my first post, aCC is not producing the a.out file. If I follow your steps exactly then the first command "aCC -c hello.c" does produce the object file hello.o

However, running aCC hello.o does NOT produce the a.out file. aCC silently runs with no response at all, but does not produce the output.

I tried using "aCC hello.o -o test.out" but this also does not produce a test.out output file. I have searched the entire file system for a.out and it is not being created anywhere.

Do you have any suggestions?

Thanks,

Allen Broadman
Christian Haug
Advisor

Re: aCC not producing a.out file

Try to compile with aCC +w -v, this should produce a verbose output, perhaps you can see much more in this informations.
Try to link it direct with: ld hello.o , should also generate a a.out file, eventually also with ld -v hello.o.
Allen Broadman
Occasional Advisor

Re: aCC not producing a.out file

Turning on warnings and verbose messages definitely helps - I can see what the compiler is doing - thanks.

Unfortunately, there is still no a.out being produced.

Running the linker directly with "ld -v hello.o" causes no output messages and no output executable. This is strange because at the very least I would think the linker would complain because no standard C runtime libs are being linked in on the command line.

Here is the output of aCC +w -v hello.c

(the warnings are expected because all the main function does is a "return 1;" )

$ aCC +w -v hello.c
/opt/aCC/lbin/ctcom -diag anachronisms,suggestions,warnings,futureerrors -inst compiletime -diags 523 -D __HP_CXD_SPP=1 -D __HP_aCC -D __hppa -D __hpux -D __unix -D __hp9000s800 -D __STDCPP__ -D _PA_RISC1_1 -I /opt/aCC/include -I /opt/aCC/include/iostream -I /usr -I /usr/include -inline_power 1 -longbranch 1 -cachesize 256 hello.c
Warning (suggestion) 431: "hello.c", line 1 # No uses of 'argc' were detected;
it may be possible to remove its declaration.
int main(int argc, char *argv[])
^^^^
Warning (suggestion) 431: "hello.c", line 1 # No uses of 'argv' were detected;
it may be possible to remove its declaration.
int main(int argc, char *argv[])
^^^^
/usr/ccs/bin/ld -o a.out /opt/langtools/lib/crt0.o -u ___exit -u main -L /opt/aCC/lib /opt/aCC/lib/cpprt0.o hello.o -lstd -lstream -lCsup -lm -lcl -lc /usr/lib/libdld.sl >/var/tmp/BAAa12366 2>/var/tmp/AAAa12366
removing /var/tmp/AAAa12366
removing /var/tmp/BAAa12366
removing hello.o


Any ideas?

Allen
Stefan Farrelly
Honored Contributor

Re: aCC not producing a.out file


Ive done a clean install of aCC and the compile worked straight off, and yours doesnt work so to me this indicates you have problem with either your HP-UX install or with the compiler install.

Did aCC install cleanly ? (check /var/adm/sw/swagent.log)
What patch level are you running ?
Any other compilers installed ?
If you could give us an swlist output from your HP server that might help.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Stefan Farrelly
Honored Contributor

Re: aCC not producing a.out file


Im not so sure now that our simple programs were compiling are the same. Yours has more in it than the simple one I compiled. Mine looks like this;

#include
main()
{
printf("Hello Worldn");
}

Try using aCC to compile this and see if it creates a binary. Did for me. Ive got a funny feeling your trying to compile something which you cant do witn an aCC compiler alone - you may need a different compiler.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Allen Broadman
Occasional Advisor

Re: aCC not producing a.out file

Actually, your program is more complicated than mine. I have removed all dependencies -= here is my program:

int main(int argc, char *argv[])
{
return 1;
}

Allen
Allen Broadman
Occasional Advisor

Re: aCC not producing a.out file

Following are the answers to your questions, but first - doesn't it seem

that the problem is in the linker, not the compiler?

aCC is just a driver program for ctcom and ld. It seems pretty clear

that ctcom is doing its job in producing object code, but that ld is

failing on the link phase. If I run the compiler by itself it produces

object code. However, if I run the linker on the object code using the

same command line that aCC uses (taken from the verbose mode of aCC) then

I get no output or error messages:

For example, running the following:

/usr/ccs/bin/ld -o a.out /opt/langtools/lib/crt0.o -u ___exit -u main -L

/opt/aCC/lib /opt/aCC/lib/cpprt0.o hello.o -lstd -lstream -lCsup -lm -lcl

-lc /usr/lib/libdld.sl

produces nothing, not even a message.

Following are the answers to your questions:

I cannot find any errors about aCC in swagent.log

We are using version A.03.13 - I am not sure how to determine the patch

version because its not in the release notes.

No other compilers are installed.

swlist output follows:

# swlist
# Initializing...
# Contacting target "nyhpux01"...
#
# Target: nyhpux01:/
#

#
# Bundle(s):
#

B3901BA B.11.01.06 HP C/ANSI C Developer's

Bundle for HP-UX 11.00 (S800)
B3913DB B.11.01.06 HP aC++ Compiler (S800)
B3919EA_B9U B.11.00 Special Edition HP-UX

Unlimited-User Lic
B5456CA C.01.16.00 HP-UX Development Kit for

Java*
HPUXEng32RT B.11.00 English HP-UX 32-bit

Runtime Environment
J1593AA B.02.00.06 HP Domain Server Control
J1607CA B.02.00.06 Netscape Fasttrack Server
J3623BA B.11.00.03 100BT/9000 GSC for B, C,

D, and J Series
OnlineDiag B.11.00.08.07 HPUX 11.0 Support Tools

Bundle
XSWGR1100 B.11.00.43 HP-UX Extension Pack,

December 1998
XSWHWCR1100 B.11.00.44 Extension Software Patch

Bundle
XSW_PatchECO197 A.1.0 Patch Replacement bundle
Y2K-1100 B.11.00.B0315 HP-UX Core OS Year 2000

Patch Bundle
#
# Product(s) not contained in a Bundle:
#

emacs 20.7 emacs
#
Stefan Farrelly
Honored Contributor

Re: aCC not producing a.out file

Hi Allen,

your swlist output looks pretty good. Found some patches for your version of aC++, A.03.13; PHSS_16587. Is it installed already ? (swlist -l fileset | grep PHSS_16587), actually its been superceeded already so if its installed you will need the later version; PHSS_21906.
Also, a patch for ld; PHSS_21947, is it installed ? (might be part of your gr bundle)
Also a patch for your ANSI/C compiler; PHSS_22272
Try those patches and see if it fixes your problem. Im using a different version of aC++ and ANSI/C.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Christian Haug
Advisor

Re: aCC not producing a.out file

Interesting thing, my output from the linker phase looks a little bit different:
/opt/aCC/lbin/ld -o a.out /opt/aCC/lib/crt0.o -u ___exit -u main -L /opt/aCC/lib /opt/aCC/lib/cpprt0.o hello.o -lstream -lstd -lCsup -lm -lcl -lc /usr/lib/libdld.sl >/var/tmp/AAAa20192 2>&1
removing /var/tmp/AAAa20192

My aCC uses a own linker in /opt/aCC/lbin/ld with the module /opt/aCC/lib/crt0.o, your linker comes from /usr/ccs/bin/ld, I don't know why.
Perhaps try to link the programm again with the ld command:
/opt/aCC/lbin/ld -o a.out /opt/aCC/lib/crt0.o -u ___exit -u main -L /opt/aCC/lib /opt/aCC/lib/cpprt0.o hello.o -lstream -lstd -lCsup -lm -lcl -lc /usr/lib/libdld.sl
I don't know why your aCC Compiler uses the other linker, try to find it out. If the above is working, you could make linkage phase manual.
Allen Broadman
Occasional Advisor

Re: aCC not producing a.out file

The path to ld on your machine does not exist on my machine.

It seems to me at this point that a fresh install of the latest version of aCC is appropriate.

Thanks to both of you for your help in trying to resolve this problem.

Allen Broadman