[Click] Patches for x86_64 builds

Puneet Sood psood74 at gmail.com
Mon Jun 25 20:56:55 EDT 2007


Hi,

While building Click for x86_64 from the current sources, I
encountered a few errors (in configure and compilation). config.h
contents at the bottom of this message.

**** Problem 1: ./configure: Check for C++-compilable kernel headers
fails in include/asm/spinlock.h

--- configure.~1.98.~   2007-05-16 15:39:45.000000000 -0400
+++ configure   2007-06-25 16:25:12.000000000 -0400
@@ -14259,6 +14259,12 @@
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+#if HAVE_LINUXMODULE_2_6
+# define KBUILD_STR(s)         #s
+# define KBUILD_BASENAME       KBUILD_STR(click)
+# define KBUILD_MODNAME                KBUILD_STR(click)
+#endif
+
 #define new xxx_new
 #include <linux/autoconf.h>
 #include <linux/signal.h>


**** Problem 2: linuxmodule: Compilation of click/linuxmodule/sched.cc
fails with the following errors

/usr/local/home/vlb/dev/src/click/linuxmodule/sched.cc: In function
'String read_sched_param(Element*, void*)':
/usr/local/home/vlb/dev/src/click/linuxmodule/sched.cc:294: error:
cast from 'void*' to 'int' loses precision
/usr/local/home/vlb/dev/src/click/linuxmodule/sched.cc: In function
'int write_sched_param(const String&, Element*, void*,
ErrorHandler*)':
/usr/local/home/vlb/dev/src/click/linuxmodule/sched.cc:328: error:
cast from 'void*' to 'int' loses precision

--- sched.cc.orig       2007-06-25 20:38:40.000000000 -0400
+++ sched.cc    2007-06-25 16:54:35.000000000 -0400
@@ -291,7 +291,7 @@
 static String
 read_sched_param(Element *, void *thunk)
 {
-    switch ((int)thunk) {
+    switch (reinterpret_cast<ptrdiff_t>(thunk)) {
     case H_TASKS_PER_ITER: {
        if (click_router) {
            String s;
@@ -325,7 +325,7 @@
 write_sched_param(const String &conf, Element *e, void *thunk,
ErrorHandler *errh)
 {

-    switch((int)thunk) {
+    switch(reinterpret_cast<ptrdiff_t>(thunk)) {

     case H_TASKS_PER_ITER: {
        unsigned x;

**** Problem 3: Compilation of click/elements/userlevel/fromdump.cc
fails with the following errors

  CXX ../elements/userlevel/fromdump.cc
../elements/userlevel/fromdump.cc: In static member function 'static
String FromDump::read_handler(Element*, void*)':
../elements/userlevel/fromdump.cc:522: error: call of overloaded
'String(off_t&)' is ambiguous
../include/click/string.hh:40: note: candidates are: String::String(double)
../include/click/string.hh:34: note:
String::String(long unsigned int)
../include/click/string.hh:33: note:                 String::String(long int)
../include/click/string.hh:32: note:
String::String(unsigned int)
../include/click/string.hh:31: note:                 String::String(int)
../include/click/string.hh:269: note:
String::String(unsigned char)
../include/click/string.hh:260: note:                 String::String(char)
../include/click/string.hh:250: note:                 String::String(bool)
../include/click/string.hh:208: note:
String::String(const char*) <near match>
../include/click/string.hh:278: note:
String::String(const String&) <near match>

Not sure what the best fix is in this case. I worked around by
typecasting the off_t value to a long int (which is 64-bit here). It
may be better to overload the String::String for long long and
unsigned long long unconditionally.

Thanks,
Puneet


/* include/click/config.h.  Generated from config.h.in by configure.  */
/* Process this file with configure to produce config.h. -*- mode: c -*- */
#ifndef CLICK_CONFIG_H
#define CLICK_CONFIG_H

/* Define to byte order of target machine. */
#define CLICK_BYTE_ORDER 1234
#define CLICK_BIG_ENDIAN	4321
#define CLICK_LITTLE_ENDIAN	1234
#define CLICK_NO_ENDIAN		0

/* Define for Click memory allocation debugging. */
/* #undef CLICK_DMALLOC */

/* Version number of package */
#define CLICK_VERSION "1.6.0pre"

/* Define if PollDevice should run fast to get good benchmark numbers */
#define CLICK_WARP9 1

/* Define if you have the __builtin_clz function. */
#define HAVE___BUILTIN_CLZ 1

/* Define if you have the __builtin_clzl function. */
#define HAVE___BUILTIN_CLZL 1

/* Define if you have the __builtin_clzll function. */
#define HAVE___BUILTIN_CLZLL 1

/* Define if you have the __builtin_ffs function. */
#define HAVE___BUILTIN_FFS 1

/* Define if you have the __builtin_ffsl function. */
#define HAVE___BUILTIN_FFSL 1

/* Define if you have the __builtin_ffsll function. */
#define HAVE___BUILTIN_FFSLL 1

/* Define if the va_list type is addressable. */
/* #undef HAVE_ADDRESSABLE_VA_LIST */

/* Define if the machine is indifferent to alignment. */
#define HAVE_INDIFFERENT_ALIGNMENT 1

/* Define if you want to use Intel-specific instructions. */
#define HAVE_INTEL_CPU 1

/* Define if 64-bit integer types are enabled. */
#define HAVE_INT64_TYPES 1

/* Define if IPv6 support is enabled. */
/* #undef HAVE_IP6 */

/* Define if IPsec support is enabled. */
/* #undef HAVE_IPSEC */

/* Define to 1 if the system has the type `long long'. */
#define HAVE_LONG_LONG 1

/* Define if nanosecond-granularity timestamps are enabled. */
/* #undef HAVE_NANOTIMESTAMP_ENABLED */

/* Define if you want to use the stride scheduler. */
#define HAVE_STRIDE_SCHED 1

/* Define to 1 since we have Strings. */
#define HAVE_STRING 1

/* Define to 1 if the system has the type `struct timespec'. */
#define HAVE_STRUCT_TIMESPEC 1

#ifdef HAVE_STRIDE_SCHED
/* Define if you want task scheduling to use a heap, not a linked list. */
/* #undef HAVE_TASK_HEAP */
#endif

/* The size of a `int', as computed by sizeof. */
#define SIZEOF_INT 4

/* The size of a `long', as computed by sizeof. */
#define SIZEOF_LONG 8

/* The size of a `long long', as computed by sizeof. */
#define SIZEOF_LONG_LONG 8

/* The size of a `struct timespec', as computed by sizeof. */
#define SIZEOF_STRUCT_TIMESPEC 16

/* The size of a `struct timeval', as computed by sizeof. */
#define SIZEOF_STRUCT_TIMEVAL 16

/* Define if you want to run multithreaded Click. */
/* #undef __MTCLICK__ */
#define NUM_CLICK_CPUS 1

#ifndef __cplusplus
/* Define inline, if necessary. C only. */
/* #undef inline */
#endif

#ifdef __cplusplus
/* Explicit template instances? */
#if __GNUC__ == 2 && __GNUC_MINOR__ < 90
#define EXPLICIT_TEMPLATE_INSTANCES 1
#endif
#endif /* __cplusplus */

/* Define macros for declaring packed structures. */
#ifdef __GNUC__
#define CLICK_PACKED_STRUCTURE(open, close) open close __attribute__((packed))
#define CLICK_SIZE_PACKED_STRUCTURE(open, close) open close
__attribute__((packed))
#else
#define CLICK_PACKED_STRUCTURE(open, close) _Cannot_pack_structure__Use_GCC
#define CLICK_SIZE_PACKED_STRUCTURE(open, close) open close
#endif

/* Define macro for deprecated functions. */
#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ == 0)
#define CLICK_DEPRECATED
#else
#define CLICK_DEPRECATED __attribute__((deprecated))
#endif

/* Define ARCH_IS_BIG_ENDIAN based on CLICK_BYTE_ORDER. */
#if CLICK_BYTE_ORDER == CLICK_BIG_ENDIAN
#define ARCH_IS_BIG_ENDIAN	1
#elif CLICK_BYTE_ORDER == CLICK_LITTLE_ENDIAN
#define ARCH_IS_BIG_ENDIAN	0
#endif

/* EXPORT_ELEMENT, ELEMENT_REQUIRES, ELEMENT_PROVIDES, ELEMENT_HEADER,
   ELEMENT_LIBS, and ELEMENT_MT_SAFE are noops. */
#define EXPORT_ELEMENT(x)
#define ELEMENT_REQUIRES(x)
#define ELEMENT_PROVIDES(x)
#define ELEMENT_HEADER(x)
#define ELEMENT_LIBS(x)
#define ELEMENT_MT_SAFE(x)

/* Assume CLICK_USERLEVEL unless otherwise defined. */
#if !defined(CLICK_USERLEVEL) && !defined(CLICK_TOOL) &&
!defined(CLICK_LINUXMODULE) && !defined(CLICK_BSDMODULE)
# define CLICK_USERLEVEL 1
#endif

/* Define stuff under a Linux module. */
#ifdef CLICK_LINUXMODULE
# include <click/config-linuxmodule.h>
#endif

/* Define stuff under a FreeBSD module. */
#ifdef CLICK_BSDMODULE
# include <click/config-bsdmodule.h>
#endif

/* Define stuff under nsclick. */
#ifdef CLICK_NS
# include <click/config-ns.h>
#endif

/* Define stuff under tools or a user-level driver. */
#if defined(CLICK_USERLEVEL) || defined(CLICK_TOOL)
# include <click/config-userlevel.h>
#endif

#endif /* CLICK_CONFIG_H */


More information about the click mailing list