1846363 Members
3681 Online
110256 Solutions
New Discussion

Re: compiling problem

 
SOLVED
Go to solution
mohammed arafat_2
Frequent Advisor

compiling problem

Hello Dears
i have a problem when i install any software like imap or qpopper , i walk with the procedure
but when i do make for compiling
error occured attached with this message can any one help me step by step how can i finish compiling with no error codes
thank you all
Arafat
14 REPLIES 14
A. Clay Stephenson
Acclaimed Contributor

Re: compiling problem

Unfortunately there is no simple answer. Your source code is written in ANSI C but the bundled C compiler on;y 'speaks' the archaic K&R C dialect. You need to purchase an ANSI C compiler (or the aC++ compiler) from HP or download and install gcc from
http://gatekeep.cs.utah.edu/hppd/hpux/.

If it ain't broke, I can fix that.
Shannon Petry
Honored Contributor

Re: compiling problem

You will get this error using the standard cc which ships with HP-UX. YOu need to get HP-ANSI C or... Gnu EGCS.

If you get egcs, make sure to get the bin-utils with it, and any other pre-reqs you see!

Regards,
Shannon
Microsoft. When do you want a virus today?
mohammed arafat_2
Frequent Advisor

Re: compiling problem

ok Stephenson ,
i did what u said , i've installed a depot for gcc 3.2
same problem still on my terminal,
how can i check if gcc is working i've installed all the depndcies ( bison, flex, make ) so what do u suggest ???
Arafat
H.Merijn Brand (procura
Honored Contributor

Re: compiling problem

gcc --version

should give the version info. If it does not, gcc is not in your $PATH
Enjoy, Have FUN! H.Merijn
mohammed arafat_2
Frequent Advisor

Re: compiling problem

ok ,
sorry man , but how i can add gcc to my PATH , excuse me but can u give a step by step soluation
i'm going to be crazy
i'm nes in unix
thanx
Arafat
A. Clay Stephenson
Acclaimed Contributor

Re: compiling problem

If you get the same errors, it's because you are still using the bundled compiler (cc) rather than gcc.

Do this:

Create a text file hello.c

int main(int argc, char *argv[])
{
(void) printf("Hello world. Argc = %d\n",argc);
return(0);
}

gcc hello.c

You should get an executable file. If it executes you are all set.

You then need to make sure that your application makefile calls gcc rather than cc. Most packages have a configure script that you can run toi create the makefiles.
If it ain't broke, I can fix that.
H.Merijn Brand (procura
Honored Contributor

Re: compiling problem

in (t)csh:

setenv PATH $PATH:"/your/path/to/gcc/bin"

in (k)sh:

export PATH=$PATH:"/your/path/to/gcc/bin"

best to do this in your ~/.profile (for (k)sh) or ~/.login (for (t)csh) or - even better - add the path in /etc/PATH, so all of you get it all the time.

The sequence is important here. Commands will be found in the first path it resides.

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
mohammed arafat_2
Frequent Advisor

Re: compiling problem

i created the file
hello.c
attached with this message

it said error in line 3 when i excute
./hello.c

be patint at me
Arafat
A. Clay Stephenson
Acclaimed Contributor

Re: compiling problem

You can't exectute 'hello.c' that the source file but you should see a file (probably called a.out) which is executable.

You can do this to specify an output file (with -o).

gcc hello.c -o hello

Now you should be able to execute 'hello' and get the expected output.
If it ain't broke, I can fix that.
mohammed arafat_2
Frequent Advisor

Re: compiling problem

Stephenson ,,
still not working
any aother way

and it is says gcc not found i've added to my PATH

i think i did not follow u withe hello.c thing
can u please be more details
where should i put hello.c and how can i excute it

Arafat
H.Merijn Brand (procura
Honored Contributor
Solution

Re: compiling problem

# cat hello.c
int main()
{ printf("Hello\n"; }
# gcc -o hello hello.c
# ./hello

if you are using a (t)csh, you should use

# rehash

after you have changed your $PATH

type

# which gcc

to check if it is in your path. If it cannot be found, you get an error message like

gcc: command not found

otherwise it will show the path to gcc, like

/usr/local/bin/gcc

the first part (/usr/local/bin) should be in your $PATH. You can check that with

# echo $PATH
/bin:/usr/bin:/some/path:/usr/contrib/bin:/usr/local/bin:/opt/foo/bin

if that first part is in there, you should be able to complete the compilation as I started this post.

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Shannon Petry
Honored Contributor

Re: compiling problem

If you updated your path properly in the .profile, you must start a new session to have that profile read.

You should have added the paths to this file like this...

echo "PATH=/opt/egcs/bin:/opt/gnu-binutils/bin:$PATH" >>/.profile
echo "export PATH" >>/etc/profile

NOTE: MY DIRECTORIES ARE HYPOTHETICAL, MAKE SURE THEY EXIST.

If you do this then log out then back in you will be able to check to see if it's correct.

% which gcc
/opt/egcs/bin/gcc

If you can not use the which command to find gcc, then your path's are still bad.

I'd suggest you look at "Unix in a Nutshell, published by O'Reilly and Associates". It has some basic tips/trics for shells and basic unix commands.


Regards,
Shannon
Microsoft. When do you want a virus today?
mohammed arafat_2
Frequent Advisor

Re: compiling problem

Dear procura

i have made what u said , everything is fine except the hello.c

gcc is running it is in my path when i run #which gcc it gives me the path
but when i excute
gcc -h hello hello.c
it is gives me
( # gcc -o hello hello.c
as: warning 2: Unknown option "--traditional-format" ignored.
as: "/var/tmp//ccVjkgzc.s", line 22: error 1052: Directive name not recognized - NSUBSPA
#

the hello.c is as the followig :
int main()
{ printf("hello\n"); }

any ideas
thank you
Arafat
H.Merijn Brand (procura
Honored Contributor

Re: compiling problem

gcc -h???? That must be a typo.

l1:/u/usr/merijn 101 > cat >hello.c
int main()
{ printf("hello\n"); }
l1:/u/usr/merijn 102 > which gcc
/pro/local/bin/gcc
l1:/u/usr/merijn 103 > gcc --version
gcc (GCC) 3.3 20030120 (prerelease)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

l1:/u/usr/merijn 104 > gcc -o hello hello.c
l1:/u/usr/merijn 105 > ./hello
hello
Exit 244
l1:/u/usr/merijn 106 > gcc -h hello hello.c
gcc: unrecognized option `-h'
/usr/ccs/bin/ld: hello: Not a valid object file (invalid magic number)
collect2: ld returned 1 exit status
Exit 1
l1:/u/usr/merijn 107 >

Note that this is gcc-3.3 prerelease, a version not (yet) available as prebuild binary.

Do you have write rights on /var/tmp?

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn