[Ns-developers] Idiotic question about the callbacks

Gustavo Carneiro gjcarneiro at gmail.com
Fri Mar 23 07:56:07 PDT 2012


On Sun, Mar 18, 2012 at 11:27, Gustavo Carneiro <gjcarneiro at gmail.com>wrote:

>
>
> On Sun, Feb 26, 2012 at 02:27, John Abraham <jabraham3 at mail.gatech.edu>wrote:
>
>> The valgrind errors seem to vary both intra-OS (Ubuntu 10 vs 11) and
>> inter-OS (Ubuntu vs Fedora), which sometimes made me question the use of
>> valgrind. Still it used by a lot of people.
>>
>> Throughout last year while being involved with  various ns-3 builds, I
>> have seen that , now, only Fedora systems can completely "PASS" ns-3 passed
>> through valgrind,  in this generation of gcc.
>> I also raised the issue with Tom, that we need to ensure that at least
>> Fedora systems can validate ns-3 with valgrind or pretty soon we will have
>> no releases that can pass valgrind.
>> As, very often, ns-3 is used for simulations that last for hours even
>> days, valgrind checks for leaks becomes crucial.
>>
>> Ubuntu systems report valgrind errors for ns-3 in a variety of places
>> especially in third-party libraries like libpixman or libselinux. The
>> errors range from leaks to unreachable code to still reachable memory or
>> unconditional jumps. And the Mac, I don't even want to go there. OSX-lion
>> is quite a challenge.
>>
>> I understand the pain in using valgrind. And I would also admit, I don't
>> have the ability to narrow down the root-cause of the valgrind errors. I've
>> spent hours on it. Very cryptic and one can only guess.
>>
>
> I think we have to be able to distinguish between valgrind errors in ns-3
> code itself and valgrind errors in 3rd party libraries.  The former I think
> are important to detect and fix, the latter are just noise and out of our
> control.
>
> To avoid valgrind errors in 3rd party libraries, we might want to build
> ns-3 without linking to those libraries.  Gtk+, for instance, is linked to
> by default unless it is not found.  We may need to add a --disable-gtk
> option.  Same for the other libraries.
>

With the attached patch, on my Ubuntu 11.10, running ns-3 unit tests with
valgrind now passes perfectly, whereas before they would not.  The only
difference is that we no longer link to the gtk+ stack of libraries.
 Libxml and gds seem fine.

Mahtieu, OK to commit?


> The remaining valgrind errors probably denote bugs.  Should we not fix
> these bugs?
>
> --
> Gustavo J. A. M. Carneiro
> INESC Porto, UTM, WiN, http://win.inescporto.pt/gjc
> "The universe is always one step beyond logic." -- Frank Herbert
>



-- 
Gustavo J. A. M. Carneiro
INESC Porto, UTM, WiN, http://win.inescporto.pt/gjc
"The universe is always one step beyond logic." -- Frank Herbert
-------------- next part --------------
diff -r 657d0877064e src/config-store/wscript
--- a/src/config-store/wscript	Sun Mar 18 12:09:03 2012 +0100
+++ b/src/config-store/wscript	Fri Mar 23 14:54:17 2012 +0000
@@ -1,13 +1,27 @@
 ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
 
 import wutils
+from waflib import Options
+
+
+def options(opt):
+    opt.add_option('--disable-gtk',
+                   help=('Disable GTK+ support'),
+                   dest='disable_gtk', default=False, action="store_true")
 
 def configure(conf):
-    have_gtk = conf.pkg_check_modules('GTK_CONFIG_STORE', 'gtk+-2.0 >= 2.12', mandatory=False)
-    conf.env['ENABLE_GTK_CONFIG_STORE'] = have_gtk
-    conf.report_optional_feature("GtkConfigStore", "GtkConfigStore",
-                                 conf.env['ENABLE_GTK_CONFIG_STORE'],
-                                 "library 'gtk+-2.0 >= 2.12' not found")
+    if Options.options.disable_gtk:
+        conf.env['ENABLE_GTK_CONFIG_STORE'] = False
+        conf.report_optional_feature("GtkConfigStore", "GtkConfigStore",
+                                     conf.env['ENABLE_GTK_CONFIG_STORE'],
+                                     "--disable-gtk option given")
+    else:
+        have_gtk = conf.pkg_check_modules('GTK_CONFIG_STORE', 'gtk+-2.0 >= 2.12', mandatory=False)
+        conf.env['ENABLE_GTK_CONFIG_STORE'] = have_gtk
+        conf.report_optional_feature("GtkConfigStore", "GtkConfigStore",
+                                     conf.env['ENABLE_GTK_CONFIG_STORE'],
+                                     "library 'gtk+-2.0 >= 2.12' not found")
+
     have_libxml2 = conf.pkg_check_modules('LIBXML2', 'libxml-2.0 >= 2.6', mandatory=False)
     if have_libxml2:
         conf.define('HAVE_LIBXML2', 1)


More information about the Ns-developers mailing list