DCE for running a C++11 application shows "assert failed" error, GLIBE_2.2.5 not defined...

77 views
Skip to first unread message

Byoungheon Shin

unread,
Oct 31, 2016, 2:30:22 AM10/31/16
to ns-3-users
Hello,
I am developing a custom user-space routing protocol in C++ with multiple header and source files.

If I try to run my program on DCE, it shows the following error:
cdsn@cdsn-ns3-1:~/repos/dce/source/ns-3-dce$ ./waf --run "dce-bhshin-test"
Waf: Entering directory `/home/cdsn/repos/dce/source/ns-3-dce/build'
--------------------------------------------------------------------
 Python bindings compilation 
--------------------------------------------------------------------
[ 10/375] lib/pkgconfig/libns3-dev-netlink-debug.pc:  -> build/lib/pkgconfig/libns3-dev-netlink-debug.pc
[118/375] lib/pkgconfig/libns3-dev-dce-debug.pc:  -> build/lib/pkgconfig/libns3-dev-dce-debug.pc
Waf: Leaving directory `/home/cdsn/repos/dce/source/ns-3-dce/build'
'build' finished successfully (0.398s)

assert failed. cond="handle != 0", msg="Could not open elf-cache/0/sina-0.2 elf-cache/0/sina-0.2: symbol isspace, version GLIBC_2.2.5 not defined in file 0001.so.6 with link time reference", file=../model/cooja-loader-factory.cc, line=236
terminate called without an active exception
Command ['/home/cdsn/repos/dce/source/ns-3-dce/build/myscripts/bhshin-test/bin/dce-bhshin-test'] terminated with signal SIGIOT. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>").

In the simulation configuration file (myscripts/dce-bhshin-test/dce-bhshin-test.cc), I created only one node and just executed my C++ application which is almost the same as the "dce-sleep" example. I attach my simulation configuration file.

My C++ application is created as follows:
- I need to use multi threading so that multiple different control packets are exchanged with different periods. So, I added "-pthread, -lpthread, -Wl,--no-as-needed" flags.
- I used some C++11 features, and I compiled it with the flag "-std=c++11".
- I followed the compile guideline in https://www.nsnam.org/docs/dce/manual/html/dce-user-newapps.html , so the building process is like these:

g++ -fPIC -std=c++11 -c -o traffic_monitor/tcpdmon.o traffic_monitor/tcpdmon.cc
g++ -fPIC -std=c++11 -c -o traffic_monitor/traffic_monitor.o traffic_monitor/traffic_monitor.cc
g++ -fPIC -std=c++11 -c -o flow/flow_type.o flow/flow_type.cc
g++ -fPIC -std=c++11 -c -o flow/flow.o flow/flow.cc
g++ -fPIC -std=c++11 -c -o flow/flow_stat.o flow/flow_stat.cc
g++ -fPIC -std=c++11 -c -o flow/flow_entry.o flow/flow_entry.cc
g++ -fPIC -std=c++11 -c -o traffic_monitor/packet_info.o traffic_monitor/packet_info.cc
g++ -fPIC -std=c++11 -c -o config.o config.cc
g++ -fPIC -std=c++11 -c -o main.o main.cc
g++ -o sina-0.2 -pie -rdynamic -pthread -lpthread -Wl,--no-as-needed -std=c++11 traffic_monitor/tcpdmon.o traffic_monitor/traffic_monitor.o flow/flow_type.o flow/flow.o flow/flow_stat.o flow/flow_entry.o traffic_monitor/packet_info.o config.o main.o

My environment is as follows:
OS: Ubuntu 14.04 (amd64)
DCE version: 1.9
g++/gcc version: 4.8.4-2ubuntu1~14.04.3

I tested the executable "sina-0.2" and it is working well in the physical linux (Ubuntu 14.04 amd64).
But If I copy the program into dce/source/ns-3-dce/build/bin_dce/ and run it, the above GLIBC error happens.
How can I fix it?

Byoungheon Shin

unread,
Oct 31, 2016, 9:10:37 AM10/31/16
to ns-3-users
I got to know that the error happens due to "std::isspace" is not defined inside ns-3 DCE, and the code which caused the error is as below:
// trim from start (in place)
static inline void ltrim(std::string &s) {
    s
.erase(s.begin(), std::find_if(s.begin(), s.end(),
            std
::not1(std::ptr_fun<int, int>(std::isspace))));
}

// trim from end (in place)
static inline void rtrim(std::string &s) {
    s
.erase(std::find_if(s.rbegin(), s.rend(),
            std
::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
}

Then, how can I manually add such "undefined" symbols into the DCE?
Which source file can I modify to run the code?

Best Regards,



2016년 10월 31일 월요일 오후 3시 30분 22초 UTC+9, Byoungheon Shin 님의 말:

Byoungheon Shin

unread,
Oct 31, 2016, 9:40:07 AM10/31/16
to ns-3-users
(Self answer)
I hope someone who is a beginner of the ns-3-dce could get help.
I found where I have to modify that I use the native C++ library for a specific function.

In the header file "dce/source/ns-3-dce/model/libc-ns3.h",
I added
NATIVE (isspace)


and now my C++ code works !

Regards,

2016년 10월 31일 월요일 오후 3시 30분 22초 UTC+9, Byoungheon Shin 님의 말:
Hello,

Matt Anonyme

unread,
Oct 31, 2016, 10:37:39 AM10/31/16
to ns-3-users
great !
Reply all
Reply to author
Forward
0 new messages