having Problem to compile Openflow module

317 views
Skip to first unread message

Jin L

unread,
Sep 8, 2016, 12:01:38 PM9/8/16
to ns-3-users
Hi, I'm recently use NS3 simulator to develop my program, for my program I need openflow module to work with NS-3. So I follow the instruction https://www.nsnam.org/docs/release/3.25/models/html/openflow-switch.html to install openflow and cope it with NS-3. But I met problems from the very first step, the OS I use is OS X Yosemite:

So the very first problem I met is here: 
The OFSID requires libxml2 (for MPLS FIB xml file parsing), libdl (for address fault checking), and boost (for assert) libraries to be installed.

I can't find any port of libdl to port it using macport and when I googled, it looks like it is a library of Oracle solaris system... so if I don't have this library anything will go wrong with the integration of NS-3 and openflow?

And the second problem I met is here:
  1. 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:

    $ hg clone http://code.nsnam.org/openflow
    $ cd openflow
    

    From the “openflow” directory, run:

    $ ./waf configure
    $ ./waf build
    

So I successfully downloaded this branch and try to build it, and I got prompted with some problems:
1. the very first one is "conflicting types for 'strlcpy'",


[ 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}



 I googled and looked at the header file, and found a definition with this function, so I think its just because the header file want to check if a function call 'strlcpy' exists(util.h file line 106-108), if not, it will define it, which according to the error message I got, it seems that my system library already have this function, but the #ifndef line works not so great so it thinks it is a duplicate definition. So I comment out this three lines to get things work, which it works and the compilation proceeds to next few files and I got another problem:

2. 

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?



Luciano Jerez Chaves

unread,
Sep 12, 2016, 9:26:34 AM9/12/16
to ns-3-users
Hi,

I'm not a 100% sure about that, but the openflow module won't work on mac. 
I would try compiling it inside a VM running Linux.

Cheers,
Luciano.

Zaina Hamid

unread,
Oct 20, 2016, 12:24:56 AM10/20/16
to ns-3-users
Did you find a solution to this problem? This is what I'm facing.

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}

Jin L

unread,
Nov 2, 2016, 11:24:43 AM11/2/16
to ns-3-users
Hi, I currently did not find any solution of this and I just decided not to be bothered by this as it would be a later objective of my project. If you are still facing the problem, try install a virtual machine of Linux, though it may not be a good solution. But wasting time of figuring out what goes wrong of Mac and this module just don't worth it... At least from my perspective.

Zaina Hamid於 2016年10月20日星期四 UTC+2上午6時24分56秒寫道:

Flavio Seixas

unread,
Nov 12, 2016, 10:30:26 AM11/12/16
to ns-3-users
Hi All,
Did anyone get to build Openflow on Mac OS-X?
I have gotten the error messages below. I also checked the file xtoxll.h, but I didn´t get to finding out an error.


../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}



ahmad wilda y

unread,
Apr 9, 2022, 11:06:05 PM4/9/22
to ns-3-users
any updates for fixed this issue ?
Reply all
Reply to author
Forward
0 new messages