4

I'm compiling several C/C++ packages from source on Ubuntu. I compare the results from my build to running with the debian install, and find that my executables are slower.

I used readelf -a to compare the two executables. Things like the relocation section for '.rela.dyn' are substantially different, but I'm not sure what documentation I should be looking for to make sense of differences like this.

Does anyone have any advise for trying to tweak gcc to produce executables like the ones I find in the deb package?

ajwood
  • 18,227
  • 15
  • 61
  • 104
  • Which compiler flags do you use? – swegi Feb 21 '11 at 19:08
  • have you compiled with -O3 -DNDEBUG and related options? – flownt Feb 21 '11 at 19:09
  • I've tried of the optimization flags. I find that there is no noticeable difference between -O2 and -O3. With either of those flags, what takes my build 4min only takes the deb package 3min30sec. – ajwood Feb 21 '11 at 19:13
  • Is this a matter of simply exhausting the combinations of compiler flags until I find my favourite? – ajwood Feb 21 '11 at 19:20

1 Answers1

1

Well, as it is open source, you should get the compile flags they use to generate the executables :)

my2c

neuro
  • 14,948
  • 3
  • 36
  • 59
  • and get the patches they might have applied to the sources before building the .deb – rve Feb 21 '11 at 19:26
  • I've been looking for a way to get the compiler flags they use, but I'm not sure how. – ajwood Feb 21 '11 at 19:28
  • 1
    @ajwood: You can use `apt-get source` to fetch and unpack a Debian / Ubuntu source package, which will include the upstream source, any distribution patches, and the build scripts used to build the `.deb`. – caf Feb 21 '11 at 23:34
  • @caf: It seems to be the same as the package source I've been using for the build. It comes with the autotools scripts I can use to generate a Makefile, but I still need to know what flags to pass `configure`. – ajwood Feb 22 '11 at 13:52
  • 1
    @ajwood: The debian package is built from that source package by an automatic build system, so the flags passed to configure are definitely in a script in there somewhere, likely in the `debian/` directory. – caf Feb 22 '11 at 20:54