General
cancel
Showing results for 
Search instead for 
Did you mean: 

Make command help. Exe are not created in right size

SOLVED
Go to solution
vaish
Frequent Advisor

Make command help. Exe are not created in right size

Hi,
I am new to makefile and make commands. I need to support an project. But When I execute make command , it is not creating the executables in right size.

It have created message_generator executable with size 19898480 bytes. But when I run the make command it is giving me only 2732176 bytes message_generator exe.

What are the things that I need to check or configure to run this make command correctly ?
Thanks In Advance
Vaish
17 REPLIES
Dennis Handly
Acclaimed Contributor

Re: Make command help. Exe are not created in right size

Why are you looking at the size? Instead try to run the executable and see if it works.

One reason for a size bloat would be debug info, -g.
vaish
Frequent Advisor

Re: Make command help. Exe are not created in right size

The executable is not working as expected.

I doubt whether it links with the necessary library files. How to check them ?

Thanks
Dennis Handly
Acclaimed Contributor

Re: Make command help. Exe are not created in right size

>The executable is not working as expected.

And executable that is 1/8 the size probably wouldn't even work at all.

>I doubt whether it links with the necessary library files. How to check them?

You can list shlibs with ldd(1):
ldd message_generator
vaish
Frequent Advisor

Re: Make command help. Exe are not created in right size

Thanks Dennis Handly for telling me ldd command.

I really see the difference between old exe saved on precaution and the new exe created now

When I do ldd with old exe, it shows
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/local/appl/gcc-3.4.2/lib/libgcc_s.sl => /usr/local/appl/gcc-3.4.2/lib/libgcc_s.sl
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libm.2 => /usr/lib/libm.2
/usr/local/appl/gcc-3.4.2/lib/libstdc++.sl.6 => /usr/local/appl/gcc-3.4.2/lib/libstdc++.sl.6
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/log/ccase/gcc-3.4.2-objdir/gcc/libgcc_s.sl => /usr/local/appl/gcc/lib/libgcc_s.sl
/usr/lib/libm.2 => /usr/lib/libm.2

But when I do the same with new exe , it shows
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libcl.2 => /usr/lib/libcl.2
/usr/lib/libisamstub.1 => /usr/lib/libisamstub.1
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libm.2 => /usr/lib/libm.2
/usr/lib/libCsup_v2.2 => /usr/lib/libCsup_v2.2
/usr/lib/libstd_v2.2 => /usr/lib/libstd_v2.2

Is it possible for you to explain me what it is all about ?


Dennis Handly
Acclaimed Contributor
Solution

Re: Make command help. Exe are not created in right size

>When I do ldd with old exe, it shows:
/usr/local/appl/gcc-3.4.2/lib/libstdc++.sl.6

This is using foreign devil g++.

>But when I do the same with new exe, it shows
/usr/lib/libCsup_v2.2
>Is it possible for you to explain me what it is all about?

This is using aC++ -AA.
It's unfortunate the latter isn't the one that works. :-(
vaish
Frequent Advisor

Re: Make command help. Exe are not created in right size

Dennis,
I use CXX=/opt/aCC/bin/aCC and I compile in my Makefile. Do I need to make it to gCC compiler and compile them.

Thanks
Vaish
vaish
Frequent Advisor

Re: Make command help. Exe are not created in right size

Is it possible for you to explain me "CXX=/opt/aCC/bin/aCC and CXXFLAGS=-AA -mt -c -g0 +objdebug -z -I$(BOOSTINCL) +W823 $(MK_CXXOPTS)" How should I modify them to point to gCC compiler ?
Dennis Handly
Acclaimed Contributor

Re: Make command help. Exe are not created in right size

>I use CXX=/opt/aCC/bin/aCC and I compile in my Makefile. Do I need to make it to gCC compiler and compile them?

Well, my ulterior motive is to have you use aC++. :-)
But you could try setting CXX=g++.

>Is it possible for you to explain me "CXX=/opt/aCC/bin/aCC and CXXFLAGS=-AA -mt -c -g0 +objdebug -z -I$(BOOSTINCL) +W823 $(MK_CXXOPTS)"

This says use aCC to compile. And pass the -AA & -mt & -g0 & +objdebug +W823 ... options to it.

>How should I modify them to point to g++ compiler?

You need to point CXX to the absolute path of g++.
For CXXFLAGS, remove -AA -mt -g0 +objdebug +W823 and replace by -g -threads
vaish
Frequent Advisor

Re: Make command help. Exe are not created in right size

Okay I modified as the following
CXX=gcc
CXXFLAGS=-g -I$(BOOSTINCL)

But I get errors like
/usr/ccs/bin/ld: Unsatisfied symbols:
std::basic_ostream >& std::operator<< , std::allocator >(std::basic_ostream >&, std::basic_string, std::allocator > const&)(first referenced in /var/tmp//cck6qFKn.o) (code)
std::basic_stringstream, std::allocator >::~basic_stringstream()(first referenced in /var/tmp//cck6qFKn.o) (code)
std::basic_istream >& std::ws >(std::basic_istream >&)(first referenced in /var/tmp//cck6qFKn.o) (code)

I hope I miss something else in CXXFlag to compile with gcc compiler




vaish
Frequent Advisor

Re: Make command help. Exe are not created in right size

I tried with : CXXFLAGS=-g -z -I$(BOOSTINCL) -threads also

Getting errors like
gcc: unrecognized option `-threads'
/usr/ccs/bin/ld: Unsatisfied symbols: ....

If possible , help me please

Thanks
Vaish
Dennis Handly
Acclaimed Contributor

Re: Make command help. Exe are not created in right size

>CXX=gcc
>ld: Unsatisfied symbols:

This is the C compiler. You need: CXX=g++

>gcc: unrecognized option `-threads'

Oops, my man page was broken. All other OS versions showed -pthread vs -thread.
vaish
Frequent Advisor

Re: Make command help. Exe are not created in right size

Dennis,
I have changed to g++ in my make file as the following ...
CXX=/usr/local/appl/gcc-3.4.2/bin/g++
CC=/usr/local/appl/gcc-3.4.2/bin/g++
#CXXFLAGS=-AA -mt -c -g0 +objdebug -z -I$(BOOSTINCL) +W823 $(MK_CXXOPTS)
CXXFLAGS=-threads -g -I$(BOOSTINCL)

But I see the following error ...
$mymachine: mk
$::ENV{'MK_ROOT'} = "/vobs/source"
$::ENV{'SHAREVOB'} = "/vobs/share"
Disabling winkin of derived objects outside of current view
/usr/atria/bin/clearmake -C gnu -V
/usr/local/appl/gcc-3.4.2/bin/g++ -threads -g -I/usr/local/appl/boost -I
/vobs/allap/ap_format/incl -I/vobs/allap/incl -I/vobs/share/incl -o /vobs/allap/
ap_format/obj/ap_format.o /vobs/allap/ap_format/src/ap_format.C
g++: unrecognized option `-threads'
/usr/ccs/bin/ld: Unsatisfied symbols:
FormatMessage::formessg1() (first referenced in /var/tmp//ccHNXrSE.o)
(code)
FormatMessage::formessg2() (first referenced in /var/tmp//ccHNXrSE.o) (code)
Fcif::toString() const(first referenced in /var/tmp//ccHNXrSE.o) (code)
p1Daemon::report(std::basic_string, std::allocator > const&, int, int)(first referenced in /var/tmp//ccHNXrSE.o) (code)
.....
FormatMessage::formessg3() (first referenced in /var/tmp//ccHNXrSE.o) (code)
collect2: ld returned 1 exit status
*** Error code 1
clearmake: Error: Build script failed for "/vobs/source/obj/myobj.o"

Can you please help me to modify the CXXflag correctly ?

Thanks
Vaish
Dennis Handly
Acclaimed Contributor

Re: Make command help. Exe are not created in right size

CXXFLAGS=-threads -g -I$(BOOSTINCL)

As I mentioned before, change -threads to -pthread.

>Can you please help me to modify the CXXFLAGS correctly?

I don't think the above change will fix these unsats? If it doesn't, have you forgotten to recompile everything with g++? The mangling is different between the two PA compilers.
Dennis Handly
Acclaimed Contributor

Re: Make command help. Exe are not created in right size

CC=/usr/local/appl/gcc-3.4.2/bin/g++

The C command should be gcc, not g++
(Not sure this is the issue.)
vaish
Frequent Advisor

Re: Make command help. Exe are not created in right size

/usr/ccs/bin/ld: Unsatisfied symbols is still there after modifying thread to -pthread and also to gcc.

The code is not compiled. It throws the same error.
Peter Nikitka
Honored Contributor

Re: Make command help. Exe are not created in right size

Hi,

you try to compile and link his single file ap_format.C

Does it really contain all of the functions/classes like
FormatMessage::
Fcif::
p1Daemon::

I assume you need to compile + link more than this single file:
- you need an application library to link against
- you need to compile more .C files


I don't think, this current problem is a problem of the linker but a problem of the deps of this piece of SW.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Dennis Handly
Acclaimed Contributor

Re: Make command help. Exe are not created in right size

(Skip the first part, I think Peter has the solution.)

>The code is not compiled. It throws the same error.

You have several choices depending on your skill levels:
1) Go back to aC++, that links. Get out your debugger and find out why isn't working as expected.

2) Spend weeks going though the C++ sources to figure out where symbols used in ccHNXrSE.o are defined.

Note: After solving 2), you still may get the isn't working as expected issue??

3) You could use aC++ to find where those functions are defined and used. And see why that isn't the case for g++.

If you can attach the aC++ ccHNXrSE.o, I can look at it.
Also, the next step would be to compile that .C with aCC and add "-E -.i" and attach ccHNXrSE.i.

>Peter: I don't think, this current problem is a problem of the linker but a problem of the deps of this piece of SW.

You are absolutely right. The "-c" shouldn't have been removed from CXXFLAGS.

(Of course this is broken. The -c should be in the build rules, not the flags.)