Changes between Initial Version and Version 1 of Old/Documentation/OTG/DebugNote


Ignore:
Timestamp:
Sep 26, 2005, 4:35:46 PM (19 years ago)
Author:
zhibinwu
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Old/Documentation/OTG/DebugNote

    v1 v1  
     1[wiki:WikiStart Orbit] > [wiki:OTG OTG] > FAQ
     2
     3== Steps to debugging OTG on Sandbox without collection server support ==
     4
     5 1. install libstdc++6 library in the nodes, which is compatiable with the setting in internal4.
     6{{{
     7apt-get update
     8apt-get -o APT::Force-LoopBreak=true install libstdc++6
     9}}}
     10 1. If there is no /usr/local/lib/oml2 directory in the node, copy all the files under internal4:/usr/local/lib/oml2/ to the /usr/local/lib/oml2 of the grid nodes.
     11 1. copy "otg-oml-sample.xml" into sender and set LD_LIBRARY_PATH
     12{{{
     13export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./:/usr/local/lib:/usr/local/lib/oml2
     14}}}
     15 1. OML_CONFIG,OML_NAME can be set by ''export OML_CONFIG="./otg-oml-sample.xml"'' and ''export OML_NAME="Node-1"'' or in otg command line
     16{{{
     17./otg --dsthostname=internal2 --protocol=udp --oml-name "foo" --oml-config "../etc/otg-oml-sample.xml"
     18}}}
     19 1. Similarly, copy and set "otr-oml-sample.xml" in receiving node
     20{{{
     21export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./:/usr/local/lib:/usr/local/lib/oml2
     22export OML_CONFIG="./otr-oml-sample.xml"
     23export OML_NAME="Node-2"
     24}}}
     25
     26== Handling "non-virtual destructor" warning message with Gcc 4.0 ==
     27By default, if destructor is not specified, its non-virtual,
     28but for every class derived from a virutal base class, the destructor have to be virtual.
     29
     30In particular, here's when you need to make your destructor virtual:
     31
     32  * if someone will derive from your class,
     33  * and if someone will say new Derived, where Derived is derived from your class,
     34  * and if someone will say delete p, where the actual object's type is Derived but the pointer p's type is your class.
     35
     36Confused? Here's a simplified rule of thumb that usually protects you and usually doesn't cost you anything: make your destructor virtual if your class has any virtual functions. Rationale:
     37
     38  * that usually protects you because most base classes have at least one virtual function.
     39  * that usually doesn't cost you anything because there is no added per-object space-cost for the second or subsequent virtual in your class. In other words, you've already paid all the per-object space-cost that you'll ever pay once you add the first virtual function, so the virtual destructor doesn't add any additional per-object space cost. (Everything in this bullet is theoretically compiler-specific, but in practice it will be valid on almost all compilers.)
     40
     41Note: if your base class has a virtual destructor, then your destructor is automatically virtual. You might need an explicit destructor for other reasons, but there's no need to redeclare a destructor simply to make sure it is virtual. No matter whether you declare it with the virtual keyword, declare it without the virtual keyword, or don't declare it at all, it's still virtual.
     42
     43Fix is easy:
     44Just add virtual destructor in base class:
     45{{{
     46public:
     47virtual ~Foo(){}
     48}}}
     49
     50
     51==  Using the external "C" Linkage Specification ==
     52calling C functions (LIBMAC) in C++ code (OTG),Solition is :
     53{{{
     54extern "C" {
     55#include <libmac/libmac.h>
     56}
     57}}}
     58
     59To handle overloaded function names the HP C++ compiler generates new, unique names for all functions declared in a C++ program. To do so, the compiler uses a function-name encoding scheme that is implementation dependent. A linkage directive tells the compiler to inhibit this default encoding of a function name for a particular function.
     60
     61If you want to call a C function from a C++ program, you must tell the compiler not to use its usual encoding scheme when you declare the C function. In other words, you must tell the compiler not to generate a new name for the function. If you don't turn off the usual encoding scheme, the function name declared in your C++ program won't match the function name in your C module defining the function. If the names don't match, the linker cannot resolve them. To avoid these linkage problems, use a linkage directive when you declare the C function in the C++ program.
     62
     63
     64== Make OTG Software without working client_wrapper libraries ==
     65First, get a source package of ''otg'' in the node.
     66then prepare additional files. Use w-get to fetch .h .cpp and .a files. As those lib files (.a) cannot be used for some reason,
     67we need manually build them in the node.
     68{{{
     69  cd otg/src/cpp
     70  make otg;make otr; make otf
     71  cp ../../build/include/* ./
     72  cp ../../build/src/* ./
     73}}}
     74'''Get new OML client libraries'''
     75{{{
     76scp zhibinwu@external1:tmp/oml_libraries/* /usr/local/lib/oml2
     77}}}
     78'''Get oml header files'''
     79{{{
     80mkdir oml
     81scp zhibinwu@external1:tmp/oml/* ./
     82}}}
     83After this, see
     84 {{{
     85 node1-1:~/otg/src/cpp/oml# ls
     86 Metric.h  MetricAggregator.h  OmlContext.h  OmlFilter.h  OmlQueueItem.h  oml.h  oml_def.h  oml_tx.h
     87 }}}
     88'''Change Makefile''' [[BR]]
     89adding new include
     90{{{
     91         CFLAGS  = -g -Wall -I$(INC_DIR)  -I. -Iauto -I/usr/local/include/scew -Ioml/
     92}}}
     93adding new sourcecode files
     94{{{
     95OTG_SRCS = ....
     96    ...orbit_winlab_otg.cpp
     97...
     98...
     99}}}
     100remove the -l$(OT?_OML_LIB) in each target see: [[BR]]
     101change from
     102{{{
     103$(CC) -o $@ $(OTG_OBJS) $(LDFLAGS) $(LIBS) -l$(OTG_OML_LIB)
     104}}}
     105to
     106{{{
     107$(CC) -o $@ $(OTG_OBJS) $(LDFLAGS) $(LIBS)
     108}}}
     109At last,
     110{{{
     111make clean
     112make
     113}}}
     114