Re: [nox-dev] Undefined symbol error running a NOX application. Compiling a NOX app with a linker flag.

2011-09-23 Thread Murphy McCauley
To use hash_map and hash_set with some arbitrary type, you need to include a 
hash function for that type (you only get some simple types like ints and 
strings or something for free).  The easiest way to do this is to specialize 
hash with your type (you could also pass in a hash function explicitly when you 
instantiate the hash_map/hash_set).  This looks something like this:

namespace std { 
namespace tr1 {
template< > struct hash< Link >
{
  size_t operator() (const Link & key) const
  {
return ;
  }
};
}
}

It may be slightly different (the above should be correct for unordered_map / 
unordered_set using GCC's c++0x stuff, but I don't remember if there are other 
changes besides the name and the namespace), but that's the idea.

Hope that helps.

-- Murphy

On Sep 23, 2011, at 9:47 AM, Sergio Jiménez Feijóo wrote:

> Hi,
> 
> Thank you for your help. Your method worked nicely and I no longer get errors 
> because of the glkp library.
> 
> Unluckily now I get another "undefined symbol" error message when I run the 
> app (the code compiles without errors). I think this one might be caused 
> because of the "hash" template which is defined in the hash.hh header file. 
> It seems that is complaining about somewhat related to an operator.
> 
> The message error I get is this:
> 
> 00068|nox|ERR:Cannot change the state of 'elastictree' to INSTALLED:
> 'elastictree' ran into an error:
>Can't open a dynamic library: 'nox/netapps/elastictree/elastictree.so: 
> cannot open shared object file: No such file or directory' or 
> 'nox/netapps/elastictree/.libs/elastictree.so: undefined symbol: 
> std::tr1::hash::operator()(vigil::Link) const'
> 
> I can't determinate what exactly is causing this error but I can give you 
> some hints:
> 
> In my app I use several hash_map and hash_set objects and I have included 
> both header files in my app's header file.
> 
> I also created a struct named Link whose definition is as follows:
> 
> struct Link {
>datapathid src_dpid, dst_dpid;
>uint16_t src_port, dst_port;
> };
> 
> And the operators "==" and "!=" are defined as:
> 
> bool operator==(const Link &a, const Link &b) {
>return ((a.src_dpid == b.src_dpid) && (a.dst_dpid == b.dst_dpid)
> && (a.src_port == b.src_port) && (a.dst_port == b.dst_port));
> }
> 
> bool operator!=(const Link &a, const Link &b) {
>return !(a == b);
> }
> 
> I would be very grateful you if you could give me some hints about what is 
> likely to be causing this error.
> 
> Thanks in advance.
> 
> El 23/09/11 06:49, Murphy McCauley escribió:
>> In src/Makefile.am, around line 46 is something like:
>> nox_core_LDFLAGS = \
>> 
>> Throw -lglpk in there too:
>> nox_core_LDFLAGS =   -lglpk   \
>> 
>> Then re-run boot.sh in the top directory, and hopefully that'll do it.
>> 
>> -- Murphy
>> 
>> On Sep 22, 2011, at 8:33 AM, Sergio Jiménez Feijóo wrote:
>> 
>>> Hi everybody,
>>> 
>>> I've spent the last months developping a NOX application.
>>> 
>>> The goal of my app is to dynamically calculate the optimum layer 2 path of 
>>> OpenFlow switches for a flow between a source PC and a destination PC.
>>> 
>>> The criteria which determines which path should be picked could be anything 
>>> you want. In my case the criteria is to minimize the total power 
>>> consumption of all the OpenFlow switches and links of the network.
>>> 
>>> In order find a propper solution which accomplishes the selected criteria I 
>>> need to use a Linear Programming solver. The GNU Linear Programming Kit 
>>> (GLPK) library works like a charm for this purpose.
>>> 
>>> I've included the glpk.h library in my header file and the NOX app compiles 
>>> without errors but when I try to run the app I get an "undefined symbol" 
>>> error when the code reaches the glpk library function calls. I think this 
>>> might be caused because the gcc linker is running without the "-lglpk" flag.
>>> 
>>> How could I modify the app's makefile to add this missing flag?
>>> 
>>> Thanks for your help.
>>> ___
>>> nox-dev mailing list
>>> nox-dev@noxrepo.org
>>> http://noxrepo.org/mailman/listinfo/nox-dev
> 
> ___
> nox-dev mailing list
> nox-dev@noxrepo.org
> http://noxrepo.org/mailman/listinfo/nox-dev

___
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev


Re: [nox-dev] Undefined symbol error running a NOX application. Compiling a NOX app with a linker flag.

2011-09-23 Thread Sergio Jiménez Feijóo

Hi,

Thank you for your help. Your method worked nicely and I no longer get 
errors because of the glkp library.


Unluckily now I get another "undefined symbol" error message when I run 
the app (the code compiles without errors). I think this one might be 
caused because of the "hash" template which is defined in the hash.hh 
header file. It seems that is complaining about somewhat related to an 
operator.


The message error I get is this:

00068|nox|ERR:Cannot change the state of 'elastictree' to INSTALLED:
'elastictree' ran into an error:
Can't open a dynamic library: 
'nox/netapps/elastictree/elastictree.so: cannot open shared object file: 
No such file or directory' or 
'nox/netapps/elastictree/.libs/elastictree.so: undefined symbol: 
std::tr1::hash::operator()(vigil::Link) const'


I can't determinate what exactly is causing this error but I can give 
you some hints:


In my app I use several hash_map and hash_set objects and I have 
included both header files in my app's header file.


I also created a struct named Link whose definition is as follows:

struct Link {
datapathid src_dpid, dst_dpid;
uint16_t src_port, dst_port;
};

And the operators "==" and "!=" are defined as:

bool operator==(const Link &a, const Link &b) {
return ((a.src_dpid == b.src_dpid) && (a.dst_dpid == b.dst_dpid)
&& (a.src_port == b.src_port) && (a.dst_port == b.dst_port));
}

bool operator!=(const Link &a, const Link &b) {
return !(a == b);
}

I would be very grateful you if you could give me some hints about what 
is likely to be causing this error.


Thanks in advance.

El 23/09/11 06:49, Murphy McCauley escribió:

In src/Makefile.am, around line 46 is something like:
nox_core_LDFLAGS = \

Throw -lglpk in there too:
nox_core_LDFLAGS =   -lglpk   \

Then re-run boot.sh in the top directory, and hopefully that'll do it.

-- Murphy

On Sep 22, 2011, at 8:33 AM, Sergio Jiménez Feijóo wrote:


Hi everybody,

I've spent the last months developping a NOX application.

The goal of my app is to dynamically calculate the optimum layer 2 path of 
OpenFlow switches for a flow between a source PC and a destination PC.

The criteria which determines which path should be picked could be anything you 
want. In my case the criteria is to minimize the total power consumption of all 
the OpenFlow switches and links of the network.

In order find a propper solution which accomplishes the selected criteria I 
need to use a Linear Programming solver. The GNU Linear Programming Kit (GLPK) 
library works like a charm for this purpose.

I've included the glpk.h library in my header file and the NOX app compiles without errors but when 
I try to run the app I get an "undefined symbol" error when the code reaches the glpk 
library function calls. I think this might be caused because the gcc linker is running without the 
"-lglpk" flag.

How could I modify the app's makefile to add this missing flag?

Thanks for your help.
___
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev


___
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev


Re: [nox-dev] Undefined symbol error running a NOX application. Compiling a NOX app with a linker flag.

2011-09-22 Thread Murphy McCauley
In src/Makefile.am, around line 46 is something like:
nox_core_LDFLAGS = \

Throw -lglpk in there too:
nox_core_LDFLAGS =   -lglpk   \

Then re-run boot.sh in the top directory, and hopefully that'll do it.

-- Murphy

On Sep 22, 2011, at 8:33 AM, Sergio Jiménez Feijóo wrote:

> Hi everybody,
> 
> I've spent the last months developping a NOX application.
> 
> The goal of my app is to dynamically calculate the optimum layer 2 path of 
> OpenFlow switches for a flow between a source PC and a destination PC.
> 
> The criteria which determines which path should be picked could be anything 
> you want. In my case the criteria is to minimize the total power consumption 
> of all the OpenFlow switches and links of the network.
> 
> In order find a propper solution which accomplishes the selected criteria I 
> need to use a Linear Programming solver. The GNU Linear Programming Kit 
> (GLPK) library works like a charm for this purpose.
> 
> I've included the glpk.h library in my header file and the NOX app compiles 
> without errors but when I try to run the app I get an "undefined symbol" 
> error when the code reaches the glpk library function calls. I think this 
> might be caused because the gcc linker is running without the "-lglpk" flag.
> 
> How could I modify the app's makefile to add this missing flag?
> 
> Thanks for your help.
> ___
> nox-dev mailing list
> nox-dev@noxrepo.org
> http://noxrepo.org/mailman/listinfo/nox-dev

___
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev


[nox-dev] Undefined symbol error running a NOX application. Compiling a NOX app with a linker flag.

2011-09-22 Thread Sergio Jiménez Feijóo

Hi everybody,

I've spent the last months developping a NOX application.

The goal of my app is to dynamically calculate the optimum layer 2 path 
of OpenFlow switches for a flow between a source PC and a destination PC.


The criteria which determines which path should be picked could be 
anything you want. In my case the criteria is to minimize the total 
power consumption of all the OpenFlow switches and links of the network.


In order find a propper solution which accomplishes the selected 
criteria I need to use a Linear Programming solver. The GNU Linear 
Programming Kit (GLPK) library works like a charm for this purpose.


I've included the glpk.h library in my header file and the NOX app 
compiles without errors but when I try to run the app I get an 
"undefined symbol" error when the code reaches the glpk library function 
calls. I think this might be caused because the gcc linker is running 
without the "-lglpk" flag.


How could I modify the app's makefile to add this missing flag?

Thanks for your help.
___
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev