Operating System - HP-UX
1822355 Members
5264 Online
109642 Solutions
New Discussion юеВ

Re: Not able to make .o files using cc -c

 
johnsonjthomas
Frequent Advisor

Not able to make .o files using cc -c

Hi,

I am trying to build TBB 2.2 on HPUX Itanium platform using HPUX cc compiler. The version of the cc compiler is HP C/aC++ B3910B A.06.12 [Oct 11 2006].

since the building did not take place because of errors, I decided to compile individual files. I gave the command

/usr/bin/cc -c -DTBB_DO_ASSERT -DDO_ITT_NOTIFY -DUSE_PTHREAD +DD64 -mt -Wc,-ansi_for_scope,on -D__TBB_BUILD=1 -I../../src -I../../include ../../src/old/spin_rw_mutex_v2.cpp

The path to spin_rw_mutex_v2.cpp is correct, but it does not produce the .o file (spin_rw_mutex_v2.o) as supposed to be when -c option is given. I even tried removing the entire option list and giving the plain command (/usr/bin/cc -c -I ../../src -I ../../include ../../src/old/spin_rw_mutex_v2.cpp),it does nothing, not even throws errors.I tried doing the same thing with a hello world C program and it gives the .o file .Could anyone suggest me as to why this is happening or whether any settings have to be given to cc. Any help would be great.

Thanks
26 REPLIES 26
Horia Chirculescu
Honored Contributor

Re: Not able to make .o files using cc -c

Hello,

Try to specify the object name by adding -o spin_rw_mutex_v2.o

/usr/bin/cc -c -o spin_rw_mutex_v2.o -DTBB_DO_ASSERT -DDO_ITT_NOTIFY -DUSE_PTHREAD +DD64 -mt -Wc,-ansi_for_scope,on -D__TBB_BUILD=1 -I../../src -I../../include ../../src/old/spin_rw_mutex_v2.cpp

Horia.
Best regards from Romania,
Horia.
johnsonjthomas
Frequent Advisor

Re: Not able to make .o files using cc -c

Hi,

I tried putting -o option also, still no luck.
Horia Chirculescu
Honored Contributor

Re: Not able to make .o files using cc -c

Any error? The .o file is even created?

Horia.
Best regards from Romania,
Horia.
johnsonjthomas
Frequent Advisor

Re: Not able to make .o files using cc -c

Hi,

Thats the problem, it neither shows any errors nor does it create the .o file.
Steven Schweda
Honored Contributor

Re: Not able to make .o files using cc -c

Have you tried using a C++ compiler instead
of a C compiler on your ".cpp" file?

> [...] I tried doing the same thing with a
> hello world C program and it gives the .o
> file [...]

Rename your ".c" program file to ".cpp" and
then see how well it works.

dyi # mkdir sizx
dyi # cd sizx
dyi # cp -p ../siz.c siz.cpp
dyi # cc -c siz.cpp
dyi # ls -l
total 16
-rw-r--r-- 1 root sys 190 Aug 12 2009 siz.cpp
dyi # cp -p siz.cpp siz.c
dyi # cc -c siz.c
dyi # ls -l
total 48
-rw-r--r-- 1 root sys 190 Aug 12 2009 siz.c
-rw-r--r-- 1 root sys 190 Aug 12 2009 siz.cpp
-rw-r--r-- 1 root sys 2700 Feb 22 21:25 siz.o


You have to admit that it's very speedy on a
".cpp" file.

For the record:

dyi # uname -a
HP-UX dyi B.11.31 U ia64 4235313755 unlimited-user license

dyi # cc -V
(Bundled) cc: HP C/aC++ B3910B A.06.12 [Oct 11 2006]
johnsonjthomas
Frequent Advisor

Re: Not able to make .o files using cc -c

Hi,

Whats the logic behind this? (I mean first copying it into a .cpp and then from that .cpp copying into .c and then it works). As mentioned in my first post that this is part of a build file (Makefile), so how should I change in order to make it work?.

Thanks
Steven Schweda
Honored Contributor

Re: Not able to make .o files using cc -c

> Whats the logic behind this?

It shows that the C compiler apparently does
not process C++ (".cpp") source files (in any
useful way).

> As mentioned in my first post [...]

What you didn't mention (anywhere) includes,
for example:

What, exactly, you're trying to build, and
where you got the kit.

How, exactly, you were trying to build it.

What, exactly, happened when you tried to
build it. "because of errors" lacks any
useful detail.


With my weak psychic powers, I have no way to
know what went wrong in the original build
attempt. All I can explain now is why your
manual attempt to compile a C++ source file
using the C compiler failed.
johnsonjthomas
Frequent Advisor

Re: Not able to make .o files using cc -c

Hi,

Ok,so this is what I am trying to do. I am trying to build TBB (Thread Building Blocks) version 2.2 on HPUX Itanium platform. I got the source code for TBB from www.threadbuildingblocks.com. I am building the TBB source code using gmake (version 3.81, installed using swinstall on hpux). The errors as a result of gmake are as of the following:

1) Could not find .o files (the appropriate .o files as the result of /usr/bin/cc -c -DTBB_DO_ASSERT -DDO_ITT_NOTIFY -DUSE_PTHREAD +DD64 -mt -Wc,-ansi_for_scope,on -D__TBB_BUILD=1 -I../../src -I../../include ../../src/old/SOURCE_FILES.cpp)

2) Could not make libtbb.so file since the .o files were not present.

As a result of the above two errors, the building process stopped. When I checked the installation directory, it was true that the appropriate .o files were not present. I ran the command (/usr/bin/cc -c -DTBB_DO_ASSERT -DDO_ITT_NOTIFY -DUSE_PTHREAD +DD64 -mt -Wc,-ansi_for_scope,on -D__TBB_BUILD=1 -I../../src -I../../include ../../src/old/SOURCE_FILES.cpp) individually to see if it would make a .o file , but did not. And thats how I ended up here. So my question is what changes do I have to make in the Makefile in order to incorporate what you have told.

Thanks.
Steven Schweda
Honored Contributor

Re: Not able to make .o files using cc -c

> [...] I got the source code for TBB from
> www.threadbuildingblocks.com. [...]

ALP $ nslookup www.threadbuildingblocks.com
Server: alp-l.antinode.info
Address: 10.0.0.9

*** alp-l.antinode.info can't find www.threadbuildingblocks.com: Non-existent host/domain

> I am building the TBB source code using
> gmake [...]

No "configure" step?

> [...] So my question is what changes do I
> have to make in the Makefile [...]

I can't see it. Or whence it came.
Steven Schweda
Honored Contributor

Re: Not able to make .o files using cc -c

> [...] I got the source code for TBB from
> www.threadbuildingblocks.com. [...]

You mean www.threadbuildingblocks.org?

And
http://www.threadingbuildingblocks.org/uploads/78/140/2.2/tbb22_004oss_src.tgz
?

The one which does this?:

dyi # gmake
build/common.inc:47: *** "HP-UX" is not supported. Add build/HP-UX.inc file with
os-specific settings . Stop.


Leave out any details, did you?
Dennis Handly
Acclaimed Contributor

Re: Not able to make .o files using cc -c

>-Wc,-ansi_for_scope,on

Instead of this you should use -AA.
And as Steven said, if you want C++ you need to use the aCC command.

>so how should I change in order to make it work?

Possibly: CXX=aCC

>/usr/bin/cc -c

You can't use /usr/bin/cc. This should either be just aCC or /opt/aCC/bin/aCC.

>Steven: Rename your ".c" program file to ".cpp" and then see how well it works.

Yes because a .cpp file is an object file and is passed to ld, which is suppressed with -c.
Horia Chirculescu
Honored Contributor

Re: Not able to make .o files using cc -c

As Steven Schweda pointed up above, this package is not supported on HP-UX.

You should read first the installation instruction for every piece of software you are trying to install.

Not every program wrote for linux would work on other flavour of Unix. Making things happening it is called porting. It is not usually an easy task...

Horia.
Best regards from Romania,
Horia.
johnsonjthomas
Frequent Advisor

Re: Not able to make .o files using cc -c

Hi,

Regarding the porting, it was done previously by some of my friends and I have the ported version of tbb 2.1. Currently I am trying to build the ported tbb 2.1 on HPUX but the server here in the university does not have aCC compiler. Is there any other way to build tbb 2.1 on HPUX without using aCC compiler?. I tried using g++ but shows some out of scope and declaration errors. The server only has a cc compiler.

Thanks
Dennis Handly
Acclaimed Contributor

Re: Not able to make .o files using cc -c

>I tried using g++ but shows some out of scope and declaration errors.

Then you'll also need to port it to g++.
johnsonjthomas
Frequent Advisor

Re: Not able to make .o files using cc -c

Hi,

I guess I can do nothing regarding building without aCC compiler. Would converting all .cpp files of the source to .c files help?
Dennis Handly
Acclaimed Contributor

Re: Not able to make .o files using cc -c

>Would converting all .cpp files of the source to .c files help?

Only if TBB was C source.
johnsonjthomas
Frequent Advisor

Re: Not able to make .o files using cc -c

Hi,

TBB is a C++ library.

Thanks
Steven Schweda
Honored Contributor

Re: Not able to make .o files using cc -c

> Leave out any details, did you?

> Regarding the porting, [...]

Non-psychics often have difficulty debugging
invisible build procedures. What did you
expect?

> [...] it was done previously by some of my
> friends [...]

Have you talked to then about 2.2? Why annoy
strangers with requests for the impossible
when you have such talented friends?
johnsonjthomas
Frequent Advisor

Re: Not able to make .o files using cc -c

Hi steven,

I am sorry for giving the wrong website, I meant www.threadingbuildingblocks.org instead of .com. And yes I build the library using gmake (make 3.81). Configure was not required because the Makefile was already there. I changed some entries in the /build/HP-UX.inc to specify that I am using cc compiler. Had also made a HP-UX.cc.inc. Now coming to the porting, some of my friends did the porting of TBB 2.1 for HPUX and they had used aCC compiler for this purpose. Unfortunately the server present in my university does not have an aCC compiler, it only has a cc compiler. I tried using cc compiler for this purpose but thats when I got the errors. I tried my best to rectify the errors but could not solve it. My expectation on posting the question here was to get the answer. I like posting the questions here because this forum is so active and you get the response fast. I am sorry if I annoyed you regarding this matter.

Performance tuning of TBB 2.1 on HPUX is my final year project at my University. I havent worked on such complex projects as these during my former years. I am happy that I am getting help from this forum. Thank you once again.
Steven Schweda
Honored Contributor

Re: Not able to make .o files using cc -c

> [...] I changed some entries in the
> /build/HP-UX.inc [...]

I still can't see it.

> [...] it only has a cc compiler. [...]

Not much good if you need a C++ compiler.

I'd guess that GCC is your only ($0) hope.

> I like posting the questions here [...]

It works better if you don't omit all the
important information.
Dennis Handly
Acclaimed Contributor

Re: Not able to make .o files using cc -c

>it only has a cc compiler.

If your university has a support contract, they should be able to update to the latest aC++ version which has a combined C and C++ compilers.
There is an Eval compiler available:
http://www.hp.com/go/cpp
johnsonjthomas
Frequent Advisor

Re: Not able to make .o files using cc -c

The change I made in /build/HP-UX.inc is just the compiler variable. I set that to the path of the cc compiler.

I tried compiling it with GCC and G++, doing the same procedure as I did for cc. But nothing worked.

Yes I think I have to ask the people who set up the server to install aCC else the project is deadend.

Thanks
Dennis Handly
Acclaimed Contributor

Re: Not able to make .o files using cc -c

>I tried compiling it with GCC and G++, doing the same procedure as I did for cc. But nothing worked.

It would help if you provided more details on what errors you got?
johnsonjthomas
Frequent Advisor

Re: Not able to make .o files using cc -c

Hi Dennis,

Ya sure I will post the output shown by GCC and G++ as soon as possible. The problem is I wont be able to post it today, I can post it on tuesday since our university department is closed and will reopen only next tuesday. Btw I tried to download the eval version which you had provided,it says "You do not have the proper permissions to view this content. Please see the Membership benefits page for more information on DSPP membership". I just have an individual DSPP membership. Could you provide me with an alternate option of downloading the eval version.

Thanks