Bug 1693

Summary: Compile error on Mountain Lion (10.8)
Product: ns-3 Reporter: Morten V. Pedersen <morten>
Component: fd-net-deviceAssignee: alina <aquereilhac>
Status: RESOLVED FIXED    
Severity: normal CC: alexander.afanasyev, ns-bugs, tomh
Priority: P5    
Version: ns-3.17   
Hardware: All   
OS: All   
Attachments: Patch

Description Morten V. Pedersen 2013-06-04 10:38:32 UTC
Created attachment 1606 [details]
Patch

When compiling ns-3 on Mac (Mountain Lion) with Mac ports g++ version 4.7 I encountered the following error:

16:11:40 runner ['g++-mp-4.7', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-fPIC', '-compatibility_version', '1', '-current_version', '1', '-I.', '-I..', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '../src/fd-net-device/model/fd-net-device.cc', '-c', '-o', 'src/fd-net-device/model/fd-net-device.cc.1.o']
../src/fd-net-device/helper/creator-utils.cc: In function 'void ns3::SendSocket(const char*, int, int)':
../src/fd-net-device/helper/creator-utils.cc:60:3: error: 'strerror' was not declared in this scope
../src/fd-net-device/helper/creator-utils.cc:74:3: error: 'strerror' was not declared in this scope
../src/fd-net-device/helper/creator-utils.cc:78:3: error: 'strerror' was not declared in this scope
../src/fd-net-device/helper/creator-utils.cc:170:3: error: 'strerror' was not declared in this scope
Waf: Leaving directory `/Users/buildbot/ns-3/ns-3-dev/build'
Build failed
 -> task in 'ns3-fd-net-device' failed (exit status 1): 
	{task 4452574800: cxx creator-utils.cc -> creator-utils.cc.1.o}
['g++-mp-4.7', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-fPIC', '-compatibility_version', '1', '-current_version', '1', '-I.', '-I..', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '../src/fd-net-device/helper/creator-utils.cc', '-c', '-o', 'src/fd-net-device/helper/creator-utils.cc.1.o']


According to http://en.cppreference.com/w/cpp/string/byte/strerror the std::strerror is defined in <cstring> which was not included in the creator-utils.cc file. 

Adding the include fixed the problem, see attached patch.

All the best,
Morten
Comment 1 Tom Henderson 2013-06-12 11:46:32 UTC
fixed in 9825:c67e13985be0
Comment 2 Alex Afanasyev 2013-06-16 13:57:19 UTC
*** Bug 1699 has been marked as a duplicate of this bug. ***