[Xorp-hackers] Compiling xorp 1.8.3 for Debian using g++-4.6

Jose Manuel dos Santos Calhariz jose.spam at netvisao.pt
Mon Jul 25 10:05:42 PDT 2011


On Sun, Jul 24, 2011 at 11:02:34PM +0100, Jose Manuel dos Santos Calhariz wrote:
> On Sat, Jul 23, 2011 at 10:28:52AM -0700, Ben Greear wrote:
> > On 07/23/2011 06:27 AM, Jose Manuel dos Santos Calhariz wrote:
> > >
> > >I am packaging xorp 1.8.3 for Debian.  The default compiler is now g++
> > >v4.6.  This compiler is more stricter than previous versions.
> > >
> > >This g++ have one new warnings:
> > >
> > >   -Wunused-but-set-variable
> > >
> > >This warning when used with -Werror causes a fail to build.  The
> > >position on Debian is to fix the problems on the source code instead
> > >of using the flag -Wno-error=unused-but-set-variable for disabling the
> > >warning.
> > >
> > >I am asking if this problem is solved in the git repository or if will
> > >be fixed in the near future.  Maybe this is a simple fix and is enough
> > >to comment out the affected variables.
> > 
> > Some may be solved in git, and if not, patches are welcome.
> 
> Here goes a draft of the patches.  This page explains the warning and
> how to solve it http://lists.fedoraproject.org/pipermail/devel/2011-February/148523.html
> 
> For solving the errors, I have used various strategies:
> 
>  - Looks to be old forgotten code, so I commented the variable
>  definition.
> 
>  - Variable and the the code looks to do nothing, so I
>  commented everything.
> 
>  - The variable is not used because of a #ifdef, so I put the
>  same #ifdef around the variable.
> 
>  - The variable is not used because of a macro, so I used
>  "__attribute__((__unused__))" in the definition of it.
> 
>  - The function that calculates the value of the variable may have
> side effects, so I used "__attribute__((__unused__))"
> 
> I am not familiar with the xorp code and my c++ skills are very rusty,
> so most probably I missed something.  I looked into git hub, but the
> code looked to be the same in the affected areas.
> 
> In attach follows a tar file with the patches.  The resulting code
> compiles, but I have not run the compiled binary.

I missed a warning/error on file contrib/olsr/face_manager.cc.  Here
goes an update to one of the patches.

> 
>     Jose Calhariz
> 
> > 
> > Thanks,
> > Ben
> > 
> 

     Jose Calhariz

-- 
--

Capoeira que é bom, não cai; e se um dia ele cai, cai bem

--Vinicius de Moraes
-------------- next part --------------
Index: xorp-1.8.3-sid-gcc-4.6/contrib/olsr/message.cc
===================================================================
--- xorp-1.8.3-sid-gcc-4.6.orig/contrib/olsr/message.cc	2011-07-25 14:42:34.000000000 +0000
+++ xorp-1.8.3-sid-gcc-4.6/contrib/olsr/message.cc	2011-07-25 14:43:15.000000000 +0000
@@ -285,7 +285,10 @@ HelloMessage::encode(uint8_t* buf, size_
     embed_8(&buf[offset], willingness());		// willingness
     offset += sizeof(uint8_t);
 
+    // Debian FTBFS 625437 
+#ifdef DETAILED_DEBUG
     bool haslq = false;
+#endif
 
     // link tuples
     LinkCode thislc;
@@ -295,8 +298,8 @@ HelloMessage::encode(uint8_t* buf, size_
 	if (ii == _links.begin() || (*ii).first != thislc) {
 	    thislc = (*ii).first;   // The link code of the new tuple
 
-	    haslq = lai.has_etx();
 #ifdef DETAILED_DEBUG
+	    haslq = lai.has_etx();
 	    // Invariant: ETX measurements MUST be present in
 	    // an LQ HELLO message, and MUST NOT be present in a
 	    // legacy HELLO message.
Index: xorp-1.8.3-sid-gcc-4.6/contrib/olsr/face_manager.cc
===================================================================
--- xorp-1.8.3-sid-gcc-4.6.orig/contrib/olsr/face_manager.cc	2011-07-25 15:26:16.000000000 +0000
+++ xorp-1.8.3-sid-gcc-4.6/contrib/olsr/face_manager.cc	2011-07-25 15:26:58.000000000 +0000
@@ -321,9 +321,11 @@ FaceManager::activate_face(const string&
 {
     debug_msg("Interface %s Vif %s\n", interface.c_str(), vif.c_str());
 
-    OlsrTypes::FaceID faceid;
+    // Debian FTBFS 625437
+    // OlsrTypes::FaceID faceid;
     try {
-	faceid = get_faceid(interface, vif);
+	// Debian FTBFS 625437
+	/* faceid = */ get_faceid(interface, vif);
     } catch(...) {
 	return false;
     }


More information about the Xorp-hackers mailing list