Opened 9 years ago
Closed 9 years ago
#1135 closed defect (fixed)
Rasdaman should not compile with -g3 when not in debug
Reported by: | Alex Dumitru | Owned by: | George Merticariu |
---|---|---|---|
Priority: | critical | Milestone: | 9.2 |
Component: | undecided | Version: | development |
Keywords: | Cc: | Dimitar Misev, George Merticariu, Peter Baumann, Alex Toader, Vlad Merticariu | |
Complexity: | Medium |
Description
Rasdaman seems to compile with g3 flag when not in debug mode. It should be set to g0.
Change History (23)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
If I remember correctly I wanted to have it on by default as then you get a proper stacktrace on segfaults. Is there some (performance) penalty or other issue to have it on?
comment:3 by , 9 years ago
With rasnet and g0: 838s and 800MB compilation memory used
With rasnet and g3: ~1400s (not sure if grpc compile as well) and 3800MB compilation memory used
comment:4 by , 9 years ago
I meant runtime effects of this (but it's good to know there's such a huge difference in compilation).
comment:5 by , 9 years ago
I didn't check runtime performance, was trying to find a method to allow rasnet to compile in a VM and this seemed to do the trick.
comment:6 by , 9 years ago
Ok I'm not sure what would be a better default. Both bring some nice benefits.
Debugging an installation compiled with g0 is not possible, according to the docs -g0 negates -g, while -g is equivalent to -g2. Could you try with -g1 and -g2, and check how gdb works in these cases?
comment:8 by , 9 years ago
Also at runtime the size of the binaries is considerably smaller. For rasserver with g0 it's 18MB and with g3 si 100 MB
comment:9 by , 9 years ago
Cc: | added |
---|
So -g(3) has no runtime performance penalty, all the extra MB are debug symbols in a separate part of the executable and are only loaded when debugging with gdb for example.
I'd say for us (developers) it doesn't matter which one is default. So let's focus on users, what would be better?
comment:10 by , 9 years ago
That is true, but total size of the rasdaman installation directory is now around 700MB with the largest folders being bin and lib each having around 330 MB. It's not huge, but it could be about 5 times smaller with -g0 which would make rasdaman VMs smaller. For OSGEO Live DVD for example this is quite a problem.
Also, not having this default makes installation impossible for people without 6GB of RAM. Which again reduces the number of people that can try rasdaman on the machines.
What are the pros for using -g3 as default?
comment:11 by , 9 years ago
I propose:
default: -O3 -g0
—enable-debug: -O0, -g3
And we can remove the flags —without-optimisation-flags.
This way users who want to use rasdaman can compile it faster and without any memory penalty. For us developers we anyway need to enable debug if we want to diagnose.
follow-up: 14 comment:12 by , 9 years ago
Ok sounds good. —with-optimization is useful, I'm using this to set -O0 during development. I'd prefer to have a separate —with-debug-symbols, instead of relying on —enable-debug for -g3. In the RPMs for example we should use -g2 or -g3, then debug symbols packages are automatically created, so anyone that needs the symbols for debugging can just install these packages.
To sum it up, we have these changes:
- default: -g0
--without-debug-symbols
→with-debug-symbols
(sets -g2 or -g3, we should investigate the differences and decide which one is preferable)
comment:13 by , 9 years ago
There is also an -Og flag, that might be more optimal in —enable-debug for example, instead of -O0 -g3.
comment:14 by , 9 years ago
debug symbols are not really useful if you use anything but -O3 since the debugger will jump randomly based on the optimizations made by the compiler. The only benefit would be the stacktrace generated which will anyway require enable-debug for further investigations. Anyway, I will add the —with-debug-symbols and remove -g3 from default.
Replying to dmisev:
Ok sounds good. —with-optimization is useful, I'm using this to set -O0 during development. I'd prefer to have a separate —with-debug-symbols, instead of relying on —enable-debug for -g3. In the RPMs for example we should use -g2 or -g3, then debug symbols packages are automatically created, so anyone that needs the symbols for debugging can just install these packages.
To sum it up, we have these changes:
- default: -g0
--without-debug-symbols
→with-debug-symbols
(sets -g2 or -g3, we should investigate the differences and decide which one is preferable)
comment:15 by , 9 years ago
Seems you still need -g alongside -Og http://stackoverflow.com/questions/12970596/gcc-4-8-does-og-imply-g so best we have -Og -g3. We also need to check that -Og exists in clang as well.
comment:16 by , 9 years ago
debug symbols are not really useful if you use anything but -O3
I guess you meant -O0 here.
-Og doesn't seem to exist in clang, so maybe we just stick to -O0 in this case.
comment:17 by , 9 years ago
Ok, let's come to a conclusion so George can implement this. I collected this outcome (feel free to modify):
--without-debug-symbols
→with-debug-symbols
(sets g flag to -g3)- default:
-O3 -g0
- enable-debug:
-O0 -g3
Agreeable to all?
comment:19 by , 9 years ago
I'm fine with the overall approach, but let us be careful about flag semantics (and cross-dependencies!) and the —with and —enable etc. variety (see also ticket #1138).
comment:20 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:21 by , 9 years ago
Here are some statistics in compiling with make -j4 (the size, e.g. 53M, is the size of $RMANHOME):
configure | rnp | rasnet |
—without-debug-symbols | real 150.28 user 394.76 sys 10.70 53M | real 311.61 user 904.70 sys 33.07 131M |
-g3 | real 213.14 user 529.93 sys 18.98 752M | real 437.36 user 1188.92 sys 49.06 1.1G |
—without-debug-symbols (including git submodules) | real 613.65 user 1129.95 sys 47.35 131M |
comment:22 by , 9 years ago
this doesn't seem correct in the patch:
+ [AS_HELP_STRING([—with-debug-symbols],
[compile rasdaman without debug symbols])],
comment:23 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Ok, it seems —without-debug-symbols is disabled. Not sure why we even have such a flag, would be better to have —with-debug-symbols instead.