[Click] Patches for x86_64 builds

Eddie Kohler kohler at cs.ucla.edu
Tue Jul 17 22:30:07 EDT 2007


Hey Puneet,

Thanks for these patches -- versions of them are now all in the repository!

Eddie


Puneet Sood wrote:
> Hi Eddie,
> 
> Sent this a while back. Not sure if you saw this.
> 
> error.cc is fixed. There are a few more errors/typos I found.
> 
> **** elements/etherswitch/bridgemessage.cc has a compilation error -
> amibguous call to numeric_string().
> 
> diff -Naur bridgemessage.cc.orig bridgemessage.cc
> --- bridgemessage.cc.orig       2007-07-09 19:59:57.000000000 -0400
> +++ bridgemessage.cc    2007-07-09 20:01:43.000000000 -0400
> @@ -31,9 +31,9 @@
> 
>  sprintf(buf, "%s %16s:%04hx: %2s  %x -> %16s  m/h/d: %hx/%hx/%hx",
>         tag.c_str(),
> -         String::numeric_string(_bridge_id,16,false).c_str(), _port_id,
> +         String::numeric_string(static_cast<unsigned long
> long>(_bridge_id),16,false).c_str(), _port_id,
>         _tc ? "TC" : "tc",
> -         _cost, String::numeric_string(_root,16,false).c_str(),
> +         _cost, String::numeric_string(static_cast<unsigned long
> long>(_root),16,false).c_str(),
>         _max_age, _hello_time, _forward_delay);
>  s = buf;
>  delete [] buf;
> @@ -168,10 +168,10 @@
>           "a/m/h/d: %hx/%hx/%hx/%hx",
>           tag.c_str(),
>           type ? "???" : "CFG",
> -           String::numeric_string(ntohq(bridge_id),16,false).c_str(),
> +           String::numeric_string(static_cast<unsigned long
> long>(ntohq(bridge_id)),16,false).c_str(),
>           ntohs(port_id),
>           tca ? "TCA":"tca", tc ? "TC" : "tc",
> -           ntohl(cost), 
> String::numeric_string(ntohq(root),16,false).c_str(),
> +           ntohl(cost), String::numeric_string(static_cast<unsigned long
> long>(ntohq(root)),16,false).c_str(),
>           ntohs(message_age), ntohs(max_age),
>           ntohs(hello_time), ntohs(forward_delay));
>  s = buf;
> 
> 
> **** linuxmodule/clickfs.cc the check for Linux kernel version in this
> case should be 2.6.18.
> 
> diff -Naur clickfs.cc.orig clickfs.cc
> --- clickfs.cc.orig     2007-07-09 20:08:22.000000000 -0400
> +++ clickfs.cc  2007-07-09 20:08:47.000000000 -0400
> @@ -405,7 +405,7 @@
>    return click_read_super(sb, data, flags) ? 0 : -ENOMEM;
> }
> 
> -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
> +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
> static int
> click_get_sb(struct file_system_type *fs_type, int flags, const char
> *, void *data, struct vfsmount *vfsmount)
> {
> 
> 
> **** click.spec fix typo in revision history (rpmbuild complains)
> --- click.spec.orig     2007-07-09 20:16:11.000000000 -0400
> +++ click.spec  2007-07-09 20:16:23.000000000 -0400
> @@ -77,7 +77,7 @@
> fi
> 
> %changelog
> -* Jan 10 2005 Jonathan Day <imipak at yahoo.com>
> +* Mon Jan 10 2005 Jonathan Day <imipak at yahoo.com>
> - update for new syntax
> 
> * Fri May 28 2004 Mark Huang <mlhuang at cs.princeton.edu>
> 
> Thanks,
> Puneet
> 
> On 7/5/07, Eddie Kohler <kohler at cs.ucla.edu> wrote:
>> Hey Puneet,
>>
>> I checked in another fix that may address this.  Did it help?
>>
>> Eddie
>>
>>
>>
>> Puneet Sood wrote:
>> > Eddie,
>> >
>> > The previous errors are gone. Thanks for patching them. There is one
>> > compilation error now.
>> >
>> > 
>> /usr/crosstool/v9/gcc-4.1.1-glibc-2.3.2/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/bin/g++ 
>>
>> >
>> > -DHAVE_CONFIG_H -I../../include
>> > -I/usr/local/home/vlb/dev/simple/click/include
>> > -I/usr/local/home/vlb/dev/simple/click/tools/lib -DCLICK_TOOL -g  -c
>> > /usr/local/home/vlb/dev/simple/click/lib/error.cc
>> > /usr/local/home/vlb/dev/simple/click/lib/error.cc: In member function
>> > 'virtual String ErrorHandler::make_text(ErrorHandler::Seriousness,
>> > const char*, __va_list_tag*)':
>> > /usr/local/home/vlb/dev/simple/click/lib/error.cc:423: error: call of
>> > overloaded 'append_numeric(uint64_t&, int&, int)' is ambiguous
>> > ../../include/click/straccum.hh:49: note: candidates are: void
>> > StringAccum::append_numeric(long long int, int, bool)
>> > ../../include/click/straccum.hh:50: note:                 void
>> > StringAccum::append_numeric(long long unsigned int, int, bool)
>> >
>> >
>> > -Puneet
>> >
>> > On 6/29/07, Eddie Kohler <kohler at cs.ucla.edu> wrote:
>> >> Puneet,
>> >>
>> >> Thank you very much for this bug report.  I've checked in some fixes
>> >> which, I
>> >> believe, will address the underlying problems here, including that 
>> with
>> >> String(off_t); would you please cvs up, reconfigure, and tell us how
>> >> it works?
>> >>
>> >> Eddie
>> >>
>> >>
>> >> Puneet Sood wrote:
>> >> > 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 */
>> >> > _______________________________________________
>> >> > click mailing list
>> >> > click at amsterdam.lcs.mit.edu
>> >> > https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>> >>
>>


More information about the click mailing list