Obtain the OFSID code. An ns-3 specific OFSID branch is provided to ensure operation with ns-3. Use mercurial to download this branch and waf to build the library:
From the “openflow” directory, run:
[ 1/58] cc: lib/command-line.c -> build/default/lib/command-line_1.o
[ 2/58] cc: lib/csum.c -> build/default/lib/csum_1.o
[ 3/58] cc: lib/daemon.c -> build/default/lib/daemon_1.o
[ 4/58] cc: lib/dhcp.c -> build/default/lib/dhcp_1.o
In file included from ../lib/packets.h:40:0,
from ../lib/dhcp.h:38,
from ../lib/dhcp.c:35:
../lib/util.h:107:6: error: conflicting types for 'strlcpy'
void strlcpy(char *dst, const char *src, size_t size);
^
In file included from ../lib/packets.h:37:0,
from ../lib/dhcp.h:38,
from ../lib/dhcp.c:35:
/usr/include/string.h:163:9: note: previous declaration of 'strlcpy' was here
size_t strlcpy(char *, const char *, size_t);
^
In file included from ../lib/command-line.c:38:0:
../lib/util.h:107:6: error: conflicting types for 'strlcpy'
void strlcpy(char *dst, const char *src, size_t size);
^
In file included from ../lib/util.h:42:0,
from ../lib/command-line.c:38:
/usr/include/string.h:163:9: note: previous declaration of 'strlcpy' was here
size_t strlcpy(char *, const char *, size_t);
^
In file included from ../lib/daemon.c:43:0:
../lib/util.h:107:6: error: conflicting types for 'strlcpy'
void strlcpy(char *dst, const char *src, size_t size);
^
In file included from ../lib/daemon.c:39:0:
/usr/include/string.h:163:9: note: previous declaration of 'strlcpy' was here
size_t strlcpy(char *, const char *, size_t);
^
Waf: Leaving directory `/Users/Effi/openflow/build'
Build failed:
-> task failed (err #1):
{task: cc command-line.c -> command-line_1.o}
-> task failed (err #1):
{task: cc daemon.c -> daemon_1.o}
-> task failed (err #1):
{task: cc dhcp.c -> dhcp_1.o}
Waf: Entering directory `/Users/Effi/openflow/build'
[ 1/58] cc: lib/command-line.c -> build/default/lib/command-line_1.o
[ 3/58] cc: lib/daemon.c -> build/default/lib/daemon_1.o
[ 4/58] cc: lib/dhcp.c -> build/default/lib/dhcp_1.o
[ 5/58] cc: lib/dhcp-client.c -> build/default/lib/dhcp-client_1.o
[ 6/58] cc: lib/dirs.c -> build/default/lib/dirs_1.o
[ 7/58] cc: lib/dpif.c -> build/default/lib/dpif_1.o
[ 8/58] cc: lib/dynamic-string.c -> build/default/lib/dynamic-string_1.o
In file included from /usr/include/sys/_endian.h:130:0,
from /usr/include/i386/endian.h:99,
from /usr/include/machine/endian.h:35,
from /usr/include/sys/types.h:81,
from /usr/include/sys/socket.h:75,
from /usr/include/netinet/in.h:81,
from ../lib/dpif.c:40:
../lib/xtoxll.h:40:1: error: expected ')' before '?' token
htonll(uint64_t n)
^
../lib/xtoxll.h:46:1: error: expected ')' before '?' token
ntohll(uint64_t n)
^
Waf: Leaving directory `/Users/Effi/openflow/build'
Build failed: -> task failed (err #1):
{task: cc dpif.c -> dpif_1.o}
which appears that problem exists in xtoxll.h, which its contents :
#ifndef XTOXLL_H
#define XTOXLL_H 1
#include <arpa/inet.h>
#include <sys/types.h>
static inline uint64_t
htonll(uint64_t n)
{
return htonl(1) == 1 ? n : ((uint64_t) htonl(n) << 32) | htonl(n >> 32);
}
static inline uint64_t
ntohll(uint64_t n)
{
return htonl(1) == 1 ? n : ((uint64_t) ntohl(n) << 32) | ntohl(n >> 32);
}
#endif /* xtoxll.h */
I did not see anything wrong here, so I can't find any solution to solve it... anyone can help?
2 warnings and 3 errors generated.
Waf: Leaving directory `/Users/zainahamid/Downloads/ns-allinone-3.25/ns-3.25/openflow/build'
Build failed:
-> task failed (err #1):
{task: cc daemon.c -> daemon_1.o}
-> task failed (err #1):
{task: cc command-line.c -> command-line_1.o}
-> task failed (err #1):
{task: cc dhcp.c -> dhcp_1.o}
../lib/xtoxll.h:40:1: error: expected ')'
htonll(uint64_t n)
^
/usr/include/sys/_endian.h:141:25: note: expanded from macro 'htonll'
#define htonll(x) __DARWIN_OSSwapInt64(x)
^
/usr/include/libkern/_OSByteOrder.h:78:30: note: expanded from macro
'__DARWIN_OSSwapInt64'
(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt64(x) : _OSSwapInt64(x))
^
../lib/xtoxll.h:40:1: note: to match this '('
/usr/include/sys/_endian.h:141:25: note: expanded from macro 'htonll'
#define htonll(x) __DARWIN_OSSwapInt64(x)
^
/usr/include/libkern/_OSByteOrder.h:78:5: note: expanded from macro
'__DARWIN_OSSwapInt64'
(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt64(x) : _OSSwapInt64(x))
^
In file included from ../lib/dpif.c:51:
../lib/xtoxll.h:40:1: error: definition of builtin function
'__builtin_constant_p'
htonll(uint64_t n)
^
/usr/include/sys/_endian.h:141:25: note: expanded from macro 'htonll'
#define htonll(x) __DARWIN_OSSwapInt64(x)
^
/usr/include/libkern/_OSByteOrder.h:78:6: note: expanded from macro
'__DARWIN_OSSwapInt64'
(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt64(x) : _OSSwapInt64(x))
^
In file included from ../lib/dpif.c:51:
../lib/xtoxll.h:46:1: error: expected ')'
ntohll(uint64_t n)
^
/usr/include/sys/_endian.h:140:25: note: expanded from macro 'ntohll'
#define ntohll(x) __DARWIN_OSSwapInt64(x)
^
/usr/include/libkern/_OSByteOrder.h:78:30: note: expanded from macro
'__DARWIN_OSSwapInt64'
(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt64(x) : _OSSwapInt64(x))
^
../lib/xtoxll.h:46:1: note: to match this '('
/usr/include/sys/_endian.h:140:25: note: expanded from macro 'ntohll'
#define ntohll(x) __DARWIN_OSSwapInt64(x)
^
/usr/include/libkern/_OSByteOrder.h:78:5: note: expanded from macro
'__DARWIN_OSSwapInt64'
(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt64(x) : _OSSwapInt64(x))
^
In file included from ../lib/dpif.c:51:
../lib/xtoxll.h:46:1: error: definition of builtin function
'__builtin_constant_p'
ntohll(uint64_t n)
^
/usr/include/sys/_endian.h:140:25: note: expanded from macro 'ntohll'
#define ntohll(x) __DARWIN_OSSwapInt64(x)
^
/usr/include/libkern/_OSByteOrder.h:78:6: note: expanded from macro
'__DARWIN_OSSwapInt64'
(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt64(x) : _OSSwapInt64(x))
^
4 errors generated.
Waf: Leaving directory `/Users/fseixas/repos/openflow/build'
Build failed: -> task failed (err #1):
{task: cc dpif.c -> dpif_1.o}