Bug 1518 - Patch to enable ns-3.15 to build on FreeBSD-9
Patch to enable ns-3.15 to build on FreeBSD-9
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: core
ns-3.15
All FreeBSD
: P5 normal
Assigned To: Mathieu Lacage
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-30 09:00 EDT by Colin Perkins
Modified: 2013-05-01 00:33 EDT (History)
2 users (show)

See Also:


Attachments
Fixes for FreeBSD9 (3.08 KB, application/octet-stream)
2012-10-30 09:00 EDT, Colin Perkins
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Colin Perkins 2012-10-30 09:00:00 EDT
Created attachment 1459 [details]
Fixes for FreeBSD9

The attached patch is needed to compile ns-3.15 on FreeBSD-9. The patch removes #ifdef'd workarounds for limitations of older versions of FreeBSD that are no longer needed with the latest version of FreeBSD.
Comment 1 Tom Henderson 2012-10-30 09:50:28 EDT
A better patch (to support older FreeBSDs) may be to add the math.h that was recently added to ns-3-dev/src/core/model/math.h:


#ifndef MATH_H
#define MATH_H

#include <cmath>

#ifdef __FreeBSD__

#if __FreeBSD_version <= 704101 ||                               \
  (__FreeBSD_version >= 800000 && __FreeBSD_version < 802502) || \
  (__FreeBSD_version >= 900000 && __FreeBSD_version < 900027)
#define log2(x) (std::log(x) / M_LN2)
#endif /* __FreeBSD_version */

#endif /* __FreeBSD__ */

#endif /* MATH_H */
Comment 2 Tom Henderson 2012-10-30 09:59:54 EDT
(In reply to comment #1)
> A better patch (to support older FreeBSDs) may be to add the math.h that was
> recently added to ns-3-dev/src/core/model/math.h:

Just to clarify, if the patch is just to enable people to work around this issue without changing ns-3.15, we can link this in the wiki (I just did this).  However, we could consider a maintenance release to include this patch (and a couple of other things since ns-3.15 was released), in which case the below patch would be preferred:

> 
> 
> #ifndef MATH_H
> #define MATH_H
> 
> #include <cmath>
> 
> #ifdef __FreeBSD__
> 
> #if __FreeBSD_version <= 704101 ||                               \
>   (__FreeBSD_version >= 800000 && __FreeBSD_version < 802502) || \
>   (__FreeBSD_version >= 900000 && __FreeBSD_version < 900027)
> #define log2(x) (std::log(x) / M_LN2)
> #endif /* __FreeBSD_version */
> 
> #endif /* __FreeBSD__ */
> 
> #endif /* MATH_H */
Comment 3 Colin Perkins 2012-10-30 10:13:35 EDT
(In reply to comment #2)
> (In reply to comment #1)
> > A better patch (to support older FreeBSDs) may be to add the math.h that was
> > recently added to ns-3-dev/src/core/model/math.h:
> 
> Just to clarify, if the patch is just to enable people to work around this
> issue without changing ns-3.15, we can link this in the wiki (I just did this).
>  However, we could consider a maintenance release to include this patch (and a
> couple of other things since ns-3.15 was released), in which case the below
> patch would be preferred:

And presumably remove the #ifdefs for FreeBSD in the other files? I can test on FreeBSD 8.3 and 9.1-RC, if you send me a complete patch.

Colin
Comment 4 Tom Henderson 2013-05-01 00:33:07 EDT
This has been fixed in 2012, as mentioned in the comments above; I just confirmed that FreeBSD 9 builds ns-3.17 release candidate.