Bug 1298

Summary: Undefined click symbols
Product: ns-3 Reporter: John Abraham <john.abraham.in>
Component: clickAssignee: Ruben Merz <ruben>
Status: RESOLVED FIXED    
Severity: blocker CC: gjcarneiro, ns-bugs, suresh.lalith, tomh
Priority: P5    
Version: pre-release   
Hardware: Mac Intel   
OS: Linux   

Description John Abraham 2011-11-17 15:39:47 UTC
I just installed a new buildslave on osx Lion. I get the following undefined symbols. I followed the instructions at http://lalith.in/2011/05/22/howto-getting-started-with-ns-3-click-part-i/
Is there another click repository? if yes let me know, I can try that one out.

Undefined symbols for architecture x86_64:
  "ns3::TestCase::TestCase(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)", referenced from:
      ns3::ClickIfidFromNameTest::ClickIfidFromNameTest()in ipv4-click-routing-test.cc.3.o
      ns3::ClickTrivialTest::ClickTrivialTest()in ipv4-click-routing-test.cc.3.o
      ns3::ClickTrivialTest::ClickTrivialTest()in ipv4-click-routing-test.cc.3.o
      ns3::ClickIpMacAddressFromNameTest::ClickIpMacAddressFromNameTest()in ipv4-click-routing-test.cc.3.o
      ns3::ClickIpMacAddressFromNameTest::ClickIpMacAddressFromNameTest()in ipv4-click-routing-test.cc.3.o
      ns3::ClickIfidFromNameTest::ClickIfidFromNameTest()in ipv4-click-routing-test.cc.3.o

To get the full buildlog see.

http://ns-buildmaster.ee.washington.edu:8010/job/TestThree/14/consoleFull
Comment 1 John Abraham 2011-11-18 14:23:16 UTC
tried with click-2.0.1 as well, with instructions from http://read.cs.ucla.edu/click/nsclick.
Ubuntu seems to work.
see http://ns-buildmaster.ee.washington.edu:8010/job/OSX-Lion%20Comprehensive/20/console
Comment 2 Lalith Suresh 2011-11-19 06:44:15 UTC
(In reply to comment #1)
> tried with click-2.0.1 as well, with instructions from
> http://read.cs.ucla.edu/click/nsclick.
> Ubuntu seems to work.
> see
> http://ns-buildmaster.ee.washington.edu:8010/job/OSX-Lion%20Comprehensive/20/console

This is strange. Seems like a problem with the osx Lion g++ compiler. It doesn't happen on my Ubuntu 10.04 - x86.

Unfortunately, I have no way of testing this right now. Maybe Ruben can shed some light on this since he uses a Mac. Meanwhile, I'll see if I can find a osx lion box x86_64 around here.
Comment 3 John Abraham 2011-11-19 07:03:04 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > tried with click-2.0.1 as well, with instructions from
> > http://read.cs.ucla.edu/click/nsclick.
> > Ubuntu seems to work.
> > see
> > http://ns-buildmaster.ee.washington.edu:8010/job/OSX-Lion%20Comprehensive/20/console
> 
> This is strange. Seems like a problem with the osx Lion g++ compiler. It
> doesn't happen on my Ubuntu 10.04 - x86.
> 
> Unfortunately, I have no way of testing this right now. Maybe Ruben can shed
> some light on this since he uses a Mac. Meanwhile, I'll see if I can find a osx
> lion box x86_64 around here.

I just tried it on my laptop with OSX Lion . I still see linker errors. Here is the history

    5  hg clone http://code.nsnam.org/ns-3-dev
    6  cp /Users/john/Downloads/click-2.0.1.tar .
    7  tar -xvf click-2.0.1.tar 
    8  cd click-2.0.1
    9  ./configure --enable-userlevel --disable-linuxmodule --enable-nsclick 
   10  make
   11  cd ..
   12  cd ns-3-dev/
   13  ./waf -d debug configure --with-nsclick=../click-2.0.1 --enable-tests --enable-examples
   14  ./waf

sorry the previous build links may be stale now, as I am still setting up build slaves. Here is the latest link
http://ns-buildmaster.ee.washington.edu:8010/job/OSX-Lion-Comprehensive/21/console
Comment 4 Ruben Merz 2011-12-16 05:01:09 UTC
Found the why... (not yet how to fix it, arghhh, I hate waf)

For model, and helper, instead of having the object files built in build/src/click/*, they are being built in src/click/*

See the following very ugly waf output

Waf: Entering directory `/Users/ruben/src/ns-3-dev/build'
[ 970/1598] cxx: src/click/examples/nsclick-raw-wlan.cc -> build/src/click/examples/nsclick-raw-wlan.cc.2.o
10:58:41 runner ['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-Ibuild', '-I.', '-I.', '-I/Users/ruben/src', '-I/Users/ruben/src/click-2.0.1/include', '-I/opt/local/include', '-I/opt/local/include/gtk-2.0', '-I/opt/local/lib/gtk-2.0/include', '-I/opt/local/include/atk-1.0', '-I/opt/local/include/cairo', '-I/opt/local/include/gdk-pixbuf-2.0', '-I/opt/local/include/pango-1.0', '-I/opt/local/include/gio-unix-2.0', '-I/opt/local/include/glib-2.0', '-I/opt/local/lib/glib-2.0/include', '-I/opt/local/include/pixman-1', '-I/opt/local/include/freetype2', '-I/opt/local/include/libpng14', '-I/opt/local/include/libxml2', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DSQLITE3=1', '-DPYTHONDIR="/usr/local/lib/python2.7/site-packages"', '-DPYTHONARCHDIR="/usr/local/lib/python2.7/site-packages"', '-DHAVE_PYTHON_H=1', '-DENABLE_GSL', '-DNS3_CLICK', '-D_REENTRANT', '../src/click/examples/nsclick-raw-wlan.cc', '-c', '-o', 'src/click/examples/nsclick-raw-wlan.cc.2.o']
[ 971/1598] cxx: src/click/examples/nsclick-simple-lan.cc -> build/src/click/examples/nsclick-simple-lan.cc.1.o
10:58:41 runner ['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-Ibuild', '-I.', '-I.', '-I/Users/ruben/src', '-I/Users/ruben/src/click-2.0.1/include', '-I/opt/local/include', '-I/opt/local/include/gtk-2.0', '-I/opt/local/lib/gtk-2.0/include', '-I/opt/local/include/atk-1.0', '-I/opt/local/include/cairo', '-I/opt/local/include/gdk-pixbuf-2.0', '-I/opt/local/include/pango-1.0', '-I/opt/local/include/gio-unix-2.0', '-I/opt/local/include/glib-2.0', '-I/opt/local/lib/glib-2.0/include', '-I/opt/local/include/pixman-1', '-I/opt/local/include/freetype2', '-I/opt/local/include/libpng14', '-I/opt/local/include/libxml2', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DSQLITE3=1', '-DPYTHONDIR="/usr/local/lib/python2.7/site-packages"', '-DPYTHONARCHDIR="/usr/local/lib/python2.7/site-packages"', '-DHAVE_PYTHON_H=1', '-DENABLE_GSL', '-DNS3_CLICK', '-D_REENTRANT', '../src/click/examples/nsclick-simple-lan.cc', '-c', '-o', 'src/click/examples/nsclick-simple-lan.cc.1.o']
[1354/1598] cxx: src/click/test/ipv4-click-routing-test.cc -> build/src/click/test/ipv4-click-routing-test.cc.3.o
10:58:43 runner ['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-I../src/click', '-fPIC', '-compatibility_version', '1', '-current_version', '1', '-Ibuild', '-I.', '-I/Users/ruben/src/click-2.0.1/include', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DSQLITE3=1', '-DPYTHONDIR="/usr/local/lib/python2.7/site-packages"', '-DPYTHONARCHDIR="/usr/local/lib/python2.7/site-packages"', '-DHAVE_PYTHON_H=1', '-DENABLE_GSL', '-DNS3_CLICK', '-DNS_TEST_SOURCEDIR="src/click/test"', '../src/click/test/ipv4-click-routing-test.cc', '-c', '-o', 'src/click/test/ipv4-click-routing-test.cc.3.o']
[1355/1598] cxx: src/click/model/ipv4-click-routing.cc -> src/click/model/ipv4-click-routing.cc.1.o
10:58:43 runner ['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-fPIC', '-compatibility_version', '1', '-current_version', '1', '-Ibuild', '-I.', '-I/Users/ruben/src/click-2.0.1/include', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DSQLITE3=1', '-DPYTHONDIR="/usr/local/lib/python2.7/site-packages"', '-DPYTHONARCHDIR="/usr/local/lib/python2.7/site-packages"', '-DHAVE_PYTHON_H=1', '-DENABLE_GSL', '-DNS3_CLICK', '../src/click/model/ipv4-click-routing.cc', '-c', '-o', '../src/click/model/ipv4-click-routing.cc.1.o']
[1356/1598] cxx: src/click/model/ipv4-l3-click-protocol.cc -> src/click/model/ipv4-l3-click-protocol.cc.1.o
10:58:44 runner ['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-fPIC', '-compatibility_version', '1', '-current_version', '1', '-Ibuild', '-I.', '-I/Users/ruben/src/click-2.0.1/include', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DSQLITE3=1', '-DPYTHONDIR="/usr/local/lib/python2.7/site-packages"', '-DPYTHONARCHDIR="/usr/local/lib/python2.7/site-packages"', '-DHAVE_PYTHON_H=1', '-DENABLE_GSL', '-DNS3_CLICK', '../src/click/model/ipv4-l3-click-protocol.cc', '-c', '-o', '../src/click/model/ipv4-l3-click-protocol.cc.1.o']
[1357/1598] cxx: src/click/helper/click-internet-stack-helper.cc -> src/click/helper/click-internet-stack-helper.cc.1.o
10:58:45 runner ['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-fPIC', '-compatibility_version', '1', '-current_version', '1', '-Ibuild', '-I.', '-I/Users/ruben/src/click-2.0.1/include', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DSQLITE3=1', '-DPYTHONDIR="/usr/local/lib/python2.7/site-packages"', '-DPYTHONARCHDIR="/usr/local/lib/python2.7/site-packages"', '-DHAVE_PYTHON_H=1', '-DENABLE_GSL', '-DNS3_CLICK', '../src/click/helper/click-internet-stack-helper.cc', '-c', '-o', '../src/click/helper/click-internet-stack-helper.cc.1.o']
[1358/1598] cxx: src/click/examples/nsclick-udp-client-server-csma.cc -> build/src/click/examples/nsclick-udp-client-server-csma.cc.3.o
10:58:46 runner ['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-Ibuild', '-I.', '-I.', '-I/Users/ruben/src', '-I/Users/ruben/src/click-2.0.1/include', '-I/opt/local/include', '-I/opt/local/include/gtk-2.0', '-I/opt/local/lib/gtk-2.0/include', '-I/opt/local/include/atk-1.0', '-I/opt/local/include/cairo', '-I/opt/local/include/gdk-pixbuf-2.0', '-I/opt/local/include/pango-1.0', '-I/opt/local/include/gio-unix-2.0', '-I/opt/local/include/glib-2.0', '-I/opt/local/lib/glib-2.0/include', '-I/opt/local/include/pixman-1', '-I/opt/local/include/freetype2', '-I/opt/local/include/libpng14', '-I/opt/local/include/libxml2', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DSQLITE3=1', '-DPYTHONDIR="/usr/local/lib/python2.7/site-packages"', '-DPYTHONARCHDIR="/usr/local/lib/python2.7/site-packages"', '-DHAVE_PYTHON_H=1', '-DENABLE_GSL', '-DNS3_CLICK', '-D_REENTRANT', '../src/click/examples/nsclick-udp-client-server-csma.cc', '-c', '-o', 'src/click/examples/nsclick-udp-client-server-csma.cc.3.o']
[1359/1598] cxx: src/click/examples/nsclick-udp-client-server-wifi.cc -> build/src/click/examples/nsclick-udp-client-server-wifi.cc.4.o
10:58:47 runner ['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-Ibuild', '-I.', '-I.', '-I/Users/ruben/src', '-I/Users/ruben/src/click-2.0.1/include', '-I/opt/local/include', '-I/opt/local/include/gtk-2.0', '-I/opt/local/lib/gtk-2.0/include', '-I/opt/local/include/atk-1.0', '-I/opt/local/include/cairo', '-I/opt/local/include/gdk-pixbuf-2.0', '-I/opt/local/include/pango-1.0', '-I/opt/local/include/gio-unix-2.0', '-I/opt/local/include/glib-2.0', '-I/opt/local/lib/glib-2.0/include', '-I/opt/local/include/pixman-1', '-I/opt/local/include/freetype2', '-I/opt/local/include/libpng14', '-I/opt/local/include/libxml2', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DSQLITE3=1', '-DPYTHONDIR="/usr/local/lib/python2.7/site-packages"', '-DPYTHONARCHDIR="/usr/local/lib/python2.7/site-packages"', '-DHAVE_PYTHON_H=1', '-DENABLE_GSL', '-DNS3_CLICK', '-D_REENTRANT', '../src/click/examples/nsclick-udp-client-server-wifi.cc', '-c', '-o', 'src/click/examples/nsclick-udp-client-server-wifi.cc.4.o']
[1360/1598] cxx: src/click/examples/nsclick-routing.cc -> build/src/click/examples/nsclick-routing.cc.5.o
10:58:48 runner ['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-Ibuild', '-I.', '-I.', '-I/Users/ruben/src', '-I/Users/ruben/src/click-2.0.1/include', '-I/opt/local/include', '-I/opt/local/include/gtk-2.0', '-I/opt/local/lib/gtk-2.0/include', '-I/opt/local/include/atk-1.0', '-I/opt/local/include/cairo', '-I/opt/local/include/gdk-pixbuf-2.0', '-I/opt/local/include/pango-1.0', '-I/opt/local/include/gio-unix-2.0', '-I/opt/local/include/glib-2.0', '-I/opt/local/lib/glib-2.0/include', '-I/opt/local/include/pixman-1', '-I/opt/local/include/freetype2', '-I/opt/local/include/libpng14', '-I/opt/local/include/libxml2', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DSQLITE3=1', '-DPYTHONDIR="/usr/local/lib/python2.7/site-packages"', '-DPYTHONARCHDIR="/usr/local/lib/python2.7/site-packages"', '-DHAVE_PYTHON_H=1', '-DENABLE_GSL', '-DNS3_CLICK', '-D_REENTRANT', '../src/click/examples/nsclick-routing.cc', '-c', '-o', 'src/click/examples/nsclick-routing.cc.5.o']
[1361/1598] cxxshlib: build/src/core/model/time.cc.1.o build/src/core/model/event-id.cc.1.o build/src/core/model/scheduler.cc.1.o build/src/core/model/list-scheduler.cc.1.o build/src/core/model/map-scheduler.cc.1.o build/src/core/model/heap-scheduler.cc.1.o build/src/core/model/calendar-scheduler.cc.1.o build/src/core/model/ns2-calendar-scheduler.cc.1.o build/src/core/model/event-impl.cc.1.o build/src/core/model/simulator.cc.1.o build/src/core/model/simulator-impl.cc.1.o build/src/core/model/default-simulator-impl.cc.1.o build/src/core/model/timer.cc.1.o build/src/core/model/watchdog.cc.1.o build/src/core/model/synchronizer.cc.1.o build/src/core/model/make-event.cc.1.o build/src/core/model/log.cc.1.o build/src/core/model/breakpoint.cc.1.o build/src/core/model/type-id.cc.1.o build/src/core/model/attribute-construction-list.cc.1.o build/src/core/model/object-base.cc.1.o build/src/core/model/ref-count-base.cc.1.o build/src/core/model/object.cc.1.o build/src/core/model/test.cc.1.o build/src/core/model/random-variable.cc.1.o build/src/core/model/rng-stream.cc.1.o build/src/core/model/command-line.cc.1.o build/src/core/model/type-name.cc.1.o build/src/core/model/attribute.cc.1.o build/src/core/model/boolean.cc.1.o build/src/core/model/integer.cc.1.o build/src/core/model/uinteger.cc.1.o build/src/core/model/enum.cc.1.o build/src/core/model/double.cc.1.o build/src/core/model/int64x64.cc.1.o build/src/core/model/string.cc.1.o build/src/core/model/pointer.cc.1.o build/src/core/model/object-ptr-container.cc.1.o build/src/core/model/object-factory.cc.1.o build/src/core/model/global-value.cc.1.o build/src/core/model/trace-source-accessor.cc.1.o build/src/core/model/config.cc.1.o build/src/core/model/callback.cc.1.o build/src/core/model/names.cc.1.o build/src/core/model/vector.cc.1.o build/src/core/model/fatal-impl.cc.1.o build/src/core/model/system-path.cc.1.o build/src/core/model/unix-system-wall-clock-ms.cc.1.o build/src/core/model/int64x64-128.cc.1.o build/src/core/model/unix-fd-reader.cc.1.o build/src/core/model/unix-system-thread.cc.1.o build/src/core/model/unix-system-mutex.cc.1.o build/src/core/model/unix-system-condition.cc.1.o -> build/libns3-core.dylib
10:58:49 runner ['/usr/bin/g++', 'src/core/model/time.cc.1.o', 'src/core/model/event-id.cc.1.o', 'src/core/model/scheduler.cc.1.o', 'src/core/model/list-scheduler.cc.1.o', 'src/core/model/map-scheduler.cc.1.o', 'src/core/model/heap-scheduler.cc.1.o', 'src/core/model/calendar-scheduler.cc.1.o', 'src/core/model/ns2-calendar-scheduler.cc.1.o', 'src/core/model/event-impl.cc.1.o', 'src/core/model/simulator.cc.1.o', 'src/core/model/simulator-impl.cc.1.o', 'src/core/model/default-simulator-impl.cc.1.o', 'src/core/model/timer.cc.1.o', 'src/core/model/watchdog.cc.1.o', 'src/core/model/synchronizer.cc.1.o', 'src/core/model/make-event.cc.1.o', 'src/core/model/log.cc.1.o', 'src/core/model/breakpoint.cc.1.o', 'src/core/model/type-id.cc.1.o', 'src/core/model/attribute-construction-list.cc.1.o', 'src/core/model/object-base.cc.1.o', 'src/core/model/ref-count-base.cc.1.o', 'src/core/model/object.cc.1.o', 'src/core/model/test.cc.1.o', 'src/core/model/random-variable.cc.1.o', 'src/core/model/rng-stream.cc.1.o', 'src/core/model/command-line.cc.1.o', 'src/core/model/type-name.cc.1.o', 'src/core/model/attribute.cc.1.o', 'src/core/model/boolean.cc.1.o', 'src/core/model/integer.cc.1.o', 'src/core/model/uinteger.cc.1.o', 'src/core/model/enum.cc.1.o', 'src/core/model/double.cc.1.o', 'src/core/model/int64x64.cc.1.o', 'src/core/model/string.cc.1.o', 'src/core/model/pointer.cc.1.o', 'src/core/model/object-ptr-container.cc.1.o', 'src/core/model/object-factory.cc.1.o', 'src/core/model/global-value.cc.1.o', 'src/core/model/trace-source-accessor.cc.1.o', 'src/core/model/config.cc.1.o', 'src/core/model/callback.cc.1.o', 'src/core/model/names.cc.1.o', 'src/core/model/vector.cc.1.o', 'src/core/model/fatal-impl.cc.1.o', 'src/core/model/system-path.cc.1.o', 'src/core/model/unix-system-wall-clock-ms.cc.1.o', 'src/core/model/int64x64-128.cc.1.o', 'src/core/model/unix-fd-reader.cc.1.o', 'src/core/model/unix-system-thread.cc.1.o', 'src/core/model/unix-system-mutex.cc.1.o', 'src/core/model/unix-system-condition.cc.1.o', '-o', '/Users/ruben/src/ns-3-dev/build/libns3-core.dylib', '-L/opt/local/lib', '-lgsl', '-lgslcblas', '-lm', '-dynamiclib']
[1362/1598] cxxshlib: build/src/click/test/ipv4-click-routing-test.cc.3.o -> build/libns3-click-test.dylib
10:58:50 runner ['/usr/bin/g++', 'src/click/test/ipv4-click-routing-test.cc.3.o', '-o', '/Users/ruben/src/ns-3-dev/build/libns3-click-test.dylib', '-L/Users/ruben/src/click-2.0.1/ns', '-lnsclick', '-ldl', '-dynamiclib']
[1363/1598] cxxshlib: src/click/model/ipv4-click-routing.cc.1.o src/click/model/ipv4-l3-click-protocol.cc.1.o src/click/helper/click-internet-stack-helper.cc.1.o -> build/libns3-click.dylib
10:58:50 runner ['/usr/bin/g++', '../src/click/model/ipv4-click-routing.cc.1.o', '../src/click/model/ipv4-l3-click-protocol.cc.1.o', '../src/click/helper/click-internet-stack-helper.cc.1.o', '-o', '/Users/ruben/src/ns-3-dev/build/libns3-click.dylib', '-L/Users/ruben/src/click-2.0.1/ns', '-lnsclick', '-ldl', '-dynamiclib']
Undefined symbols for architecture x86_64:
Comment 5 Gustavo J. A. M. Carneiro 2011-12-16 08:44:21 UTC
(In reply to comment #4)
> Found the why... (not yet how to fix it, arghhh, I hate waf)
> 
> For model, and helper, instead of having the object files built in
> build/src/click/*, they are being built in src/click/*
>

I think you are jumping to a conclusion.  It is not true that waf object files are in the source directory.  At least it shouldn't be; at least isn't in Ubuntu.

When interpreting the waf -v output of commands, keep in mind that waf does a chdir("build") before running the compilation commands, therefore all the  paths printed are relative to the build dir.
Comment 6 Ruben Merz 2011-12-16 08:50:01 UTC
Hi, thanks for looking into it.

I'm not "jumping to a conclusion", I'm observing it. See

[ruben@mbpruben ns-3-dev]$ pwd
/Users/ruben/src/ns-3-dev
[ruben@mbpruben ns-3-dev]$ ./waf
...
Things horribly fail
...
[ruben@mbpruben ns-3-dev]$ find src/ -iname *.o
src//click/helper/click-internet-stack-helper.cc.1.o
src//click/model/ipv4-click-routing.cc.1.o
src//click/model/ipv4-l3-click-protocol.cc.1.o

Now, if I cd into build, and myself execute the g++ commands, I actually manage to make it work.

Here is a short log that indeed shows what waf is doing

[729/893] cxx: src/click/model/ipv4-click-routing.cc -> src/click/model/ipv4-click-routing.cc.1.o
14:42:27 runner ['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-fPIC', '-compatibility_version', '1', '-current_version', '1', '-Ibuild', '-I.', '-I/Users/ruben/src/click-2.0.1/include', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DSQLITE3=1', '-DPYTHONDIR="/usr/local/lib/python2.7/site-packages"', '-DPYTHONARCHDIR="/usr/local/lib/python2.7/site-packages"', '-DHAVE_PYTHON_H=1', '-DENABLE_GSL', '-DNS3_CLICK', '../src/click/model/ipv4-click-routing.cc', '-c', '-o', '../src/click/model/ipv4-click-routing.cc.1.o']

See towards the end? The source file is taken from ../src/click/model/ipv4-click-routing.cc (good), but the object file is put in ../src/click/model/ipv4-click-routing.cc.1.o (not good). To my current understanding, it should be src/click/model/ipv4-click-routing.cc.1.o (without the ../).

R
Comment 7 Ruben Merz 2011-12-16 08:51:01 UTC
Ah, and I know it is not happening in Ubuntu. This bug is happening on OS X Lion.
Comment 8 Gustavo J. A. M. Carneiro 2011-12-16 08:53:28 UTC
(In reply to comment #6)
> Hi, thanks for looking into it.
> 
> I'm not "jumping to a conclusion", I'm observing it. See
> 
> [ruben@mbpruben ns-3-dev]$ pwd
> /Users/ruben/src/ns-3-dev
> [ruben@mbpruben ns-3-dev]$ ./waf
> ...
> Things horribly fail
> ...
> [ruben@mbpruben ns-3-dev]$ find src/ -iname *.o
> src//click/helper/click-internet-stack-helper.cc.1.o
> src//click/model/ipv4-click-routing.cc.1.o
> src//click/model/ipv4-l3-click-protocol.cc.1.o
> 
> Now, if I cd into build, and myself execute the g++ commands, I actually manage
> to make it work.
> 
> Here is a short log that indeed shows what waf is doing
> 
> [729/893] cxx: src/click/model/ipv4-click-routing.cc ->
> src/click/model/ipv4-click-routing.cc.1.o
> 14:42:27 runner ['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror',
> '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing',
> '-fPIC', '-compatibility_version', '1', '-current_version', '1', '-Ibuild',
> '-I.', '-I/Users/ruben/src/click-2.0.1/include', '-DNS3_ASSERT_ENABLE',
> '-DNS3_LOG_ENABLE', '-DSQLITE3=1',
> '-DPYTHONDIR="/usr/local/lib/python2.7/site-packages"',
> '-DPYTHONARCHDIR="/usr/local/lib/python2.7/site-packages"',
> '-DHAVE_PYTHON_H=1', '-DENABLE_GSL', '-DNS3_CLICK',
> '../src/click/model/ipv4-click-routing.cc', '-c', '-o',
> '../src/click/model/ipv4-click-routing.cc.1.o']
> 
> See towards the end? The source file is taken from
> ../src/click/model/ipv4-click-routing.cc (good), but the object file is put in
> ../src/click/model/ipv4-click-routing.cc.1.o (not good). To my current
> understanding, it should be src/click/model/ipv4-click-routing.cc.1.o (without
> the ../).
> 

It seems you are right.  If so, it is a WAF bug.  I'll have to reproduce, then try a newer WAF release to see if it fixes the problem.
Comment 9 Ruben Merz 2011-12-16 09:00:17 UTC
What I find (very) strange, is that this is happening only for the click module... Argghhh.

Tomh says he has a machine available. Let me reply to his email.
Comment 10 Gustavo J. A. M. Carneiro 2011-12-16 09:08:44 UTC
I find it strange that the build fails with undefined symbols, but when I list the files under src/click, recursively, I find no object files whatsoever.  So, again I doubt your initial diagnosis...
Comment 11 Gustavo J. A. M. Carneiro 2011-12-16 09:10:58 UTC
In darwin build host I see:


[1235/1353] cxx: src/click/test/ipv4-click-routing-test.cc -> build/src/click/test/ipv4-click-routing-test.cc.3.o
06:08:24 runner ['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-I../src/click', '-fPIC', '-compatibility_version', '1', '-current_version', '1', '-Ibuild', '-I.', '-I/Users/gjc/ns-3-allinone/click-2.0.1/include', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DSQLITE3=1', '-DNS3_CLICK', '-DNS_TEST_SOURCEDIR="src/click/test"', '../src/click/test/ipv4-click-routing-test.cc', '-c', '-o', 'src/click/test/ipv4-click-routing-test.cc.3.o']

So, the -o option is correct, it is outputting object files to the build dir, not source dir.  So, in both OSX versions we have undefined symbols, but maybe for different reasons.
Comment 12 Gustavo J. A. M. Carneiro 2011-12-16 09:21:06 UTC
06:15:27 runner ['/usr/bin/g++', 'src/click/model/ipv4-click-routing.cc.1.o', 'src/click/model/ipv4-l3-click-protocol.cc.1.o', 'sr
c/click/helper/click-internet-stack-helper.cc.1.o', '-o', '/Users/gjc/ns-3-allinone/ns-3-dev/build/libns3-click.dylib', '-L/Users/
gjc/ns-3-allinone/click-2.0.1/ns', '-lnsclick', '-ldl', '-dynamiclib']

Undefined symbols:
  "ns3::Node::RegisterProtocolHandler(ns3::Callback<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, n
s3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>, unsigned short, ns3::Ptr
<ns3::NetDevice>, bool)", referenced from:
      ns3::Ipv4L3ClickProtocol::AddInterface(ns3::Ptr<ns3::NetDevice>)     in ipv4-l3-click-protocol.cc.1.o

What I can see from here is simply that the link command is missing the other ns-3 modules that this module depends on.  It should have -lns3-network, for instance, but it is not there.  Hence the undefined symbols.
Comment 13 Gustavo J. A. M. Carneiro 2011-12-16 09:25:15 UTC
Please check if this fixes it:

changeset:   7640:f048c64c18b7
tag:         tip
user:        Gustavo J. A. M. Carneiro  <gjc@inescporto.pt>
date:        Fri Dec 16 14:24:30 2011 +0000
summary:     Bug 1298 - Undefined click symbols
Comment 14 Ruben Merz 2011-12-16 11:23:52 UTC
Yes, I agree and I missed it. Your change fixes the build issue. Thanks, nice. But, on my host, I still have the object files for the click module showing up in $TOPDIR/src instead of $TOPDIR/build/src.
Comment 15 Tom Henderson 2011-12-16 13:46:44 UTC
(In reply to comment #14)
> Yes, I agree and I missed it. Your change fixes the build issue. Thanks, nice.
> But, on my host, I still have the object files for the click module showing up
> in $TOPDIR/src instead of $TOPDIR/build/src.


On OS X Lion (just checked with this patch), it works for me and I do not have object files showing up in $TOPDIR/src.  Is it possible that these object files are left around from before the patch?
Comment 16 Ruben Merz 2011-12-19 03:30:54 UTC
Indeed, my bad. I was definitely too tired last week.
Everything looks good.