Operating System - HP-UX
1753860 Members
7557 Online
108809 Solutions
New Discussion юеВ

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.