Bug 1693 - Compile error on Mountain Lion (10.8)
Compile error on Mountain Lion (10.8)
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: fd-net-device
ns-3.17
All All
: P5 normal
Assigned To: alina
:
: 1699 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-04 10:38 UTC by Morten V. Pedersen
Modified: 2013-06-16 13:57 UTC (History)
3 users (show)

See Also:


Attachments
Patch (362 bytes, application/octet-stream)
2013-06-04 10:38 UTC, Morten V. Pedersen
Details

Note You need to log in before you can comment on or make changes to this bug.
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. ***