Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C Linux GCC syntax
Hi,
I am trying to gprof my program. I want a line-by-line profiling.
However, I can't seem to get the syntax write. I am using "make" and not "gcc" so please help only with suggestions that fit make. I wouldbe very grateful if you can give me the full "make" syntax.
Based on this website:
http://sourceware.org/binutils/docs/gprof/Output-Options.html[^]
http://sourceware.org/binutils/docs/gprof/Line_002dby_002dline.html[^]
Here is what I am inputting:
make USE_LOCAL_HEADERS=0 LDFLAGS='-L.' BASE_CFLAGS=-m32 CFLAGS='-fopenmp -pg -l -g'
The output is:
/usr/bin/ld: cannot find -l-g
collect2: ld returned 1 exit status
make[2]: *** [build/release-linux-ppc64/ioquake3.ppc64] Error 1
make[2]: Leaving directory `/r/home7/yasir/minoru/cfe2/yasirTemp/ioquake3dev/svfb_201110271440/ioquake3dev_clean'
make[1]: *** [targets] Error 2
make[1]: Leaving directory `/r/home7/yasir/minoru/cfe2/yasirTemp/ioquake3dev/svfb_201110271440/ioquake3dev_clean'
make: *** [release] Error 2
 
I need option "-l", "-g" and "-pg".
 
Regards,
Linux noob
Posted 17-Nov-11 20:16pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The '-l' option is not valid for gcc so it assumes that it, and all following options, should be passed to the linker. You need to check which options are valid for gprof, as described here[^], and for gcc as described here[^].
  Permalink  
Comments
Shakti Misra at 18-Nov-11 12:56pm
   
I agree with Richard. Let us know if you get some problem with it.
coffeenet at 20-Nov-11 22:58pm
   
"make USE_LOCAL_HEADERS=0 LDFLAGS='-L. -pg' BASE_CFLAGS=-m32 CFLAGS='-fopenmp -pg -g'" is how it got operative now. So, as you kindly said, "-l" was not valid. Thank you for the help.
Richard MacCutchan at 21-Nov-11 8:15am
   
You're welcome. Please mark this answer as accepted so others will know your problem is resolved.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 325
1 DamithSL 300
2 Sergey Alexandrovich Kryukov 289
3 CPallini 235
4 Maciej Los 215
0 OriginalGriff 5,455
1 DamithSL 4,422
2 Maciej Los 3,860
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,010


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 18 Nov 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100