[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Compilation error in 0.6 / CVS
From: |
Stephane Fillod |
Subject: |
Re: [Discuss-gnuradio] Compilation error in 0.6 / CVS |
Date: |
Wed, 18 Dec 2002 21:50:27 +0100 |
User-agent: |
Mutt/1.4i |
> I get an error while trying to build the current (or the 0.6 release) sources
> on a debian 3 / gcc 2.95.4 / kernel 2.4.19 system.
This is a problem with gcc version that does not accept volatile asm in
templates.
Problem is fairly old, as reported in
http://gcc.gnu.org/ml/gcc-bugs/1998-09/msg00504.html
Here is a fix that does workaround the problem (tested with gcc 2.95.4).
A nicer fix would require the inclusion of config.h, but since
GrTCPSink.h is an exported header, this is not possible.
73
Stephane
--- gnuradio-cvs-0.6/src/gnu/lib/grio/GrTCPSink.h 2002-05-19
08:41:42.000000000 +0200
+++ gnuradio/src/gnu/lib/grio/GrTCPSink.h 2002-12-18 21:40:00.000000000
+0100
@@ -34,6 +34,25 @@
using std::vector;
+
+/*
+ * versions prior to gcc-3.x croak on volatile asm in templates,
+ * hence the following workaround
+ */
+static inline unsigned long int _replace_htonl (unsigned long int hostlong)
+{
+ return htonl(hostlong);
+}
+static inline unsigned short int _replace_htons (unsigned short int hostshort)
+{
+ return htons(hostshort);
+}
+#undef htonl
+#undef htons
+#define htonl _replace_htonl
+#define htons _replace_htons
+
+
template <class iType>
class GrTCPSink : public VrSink<iType>
{
@@ -180,5 +199,9 @@
close (listen_socket);
}
+#undef htonl
+#undef htons
+#define htonl htonl
+#define htons htons
#endif // _GRTCPSINK_H_