C Libraries with Makefile - random

I am trying to create a kernel module which needs to generate random numbers to work properly. To achieve this, I have included <stdlib.h> and <time.h> to my code but I can't compile the module with the make command.
I searched for help on the web and tried to include EXTRA_CFLAGS := -I/usr/include into the Makefile, but after this I keep getting even more errors.
Here is the error message That I received:
kernel#KernelDev:~/Modulos/DropProb$ make
make -C /lib/modules/3.2.0-37-generic/build SUBDIRS=/home/kernel/Modulos/DropProb modules
make[1]: Entering directory `/usr/src/linux-headers-3.2.0-37-generic'
CC [M] /home/kernel/Modulos/DropProb/drop_prob.o
In file included from /home/kernel/Modulos/DropProb/drop_prob.c:15:0:
/usr/include/stdlib.h: In function ‘atof’:
/usr/include/stdlib.h:280:1: error: SSE register return with SSE disabled
In file included from include/linux/compiler.h:48:0,
from include/linux/linkage.h:4,
from include/linux/kernel.h:13,
from /home/kernel/Modulos/DropProb/drop_prob.c:19:
include/linux/compiler-gcc.h: At top level:
include/linux/compiler-gcc.h:87:0: warning: "__attribute_const__" redefined [enabled by default]
/usr/include/sys/cdefs.h:241:0: note: this is the location of the previous definition
In file included from include/linux/compiler.h:48:0,
from include/linux/linkage.h:4,
from include/linux/kernel.h:13,
from /home/kernel/Modulos/DropProb/drop_prob.c:19:
include/linux/compiler-gcc.h:106:0: warning: "__always_inline" redefined [enabled by default]
/usr/include/sys/cdefs.h:312:0: note: this is the location of the previous definition
In file included from include/linux/kernel.h:15:0,
from /home/kernel/Modulos/DropProb/drop_prob.c:19:
include/linux/types.h:23:26: error: conflicting types for ‘fd_set’
/usr/include/sys/select.h:76:5: note: previous declaration of ‘fd_set’ was here
include/linux/types.h:24:25: error: conflicting types for ‘dev_t’
/usr/include/sys/types.h:61:17: note: previous declaration of ‘dev_t’ was here
include/linux/types.h:33:26: error: conflicting types for ‘timer_t’
/usr/include/time.h:104:19: note: previous declaration of ‘timer_t’ was here
include/linux/types.h:53:26: error: conflicting types for ‘loff_t’
/usr/include/sys/types.h:45:18: note: previous declaration of ‘loff_t’ was here
include/linux/types.h:120:17: error: conflicting types for ‘u_int64_t’
/usr/include/sys/types.h:204:1: note: previous declaration of ‘u_int64_t’ was here
include/linux/types.h:121:17: error: conflicting types for ‘int64_t’
/usr/include/sys/types.h:198:1: note: previous declaration of ‘int64_t’ was here
include/linux/types.h:142:23: error: conflicting types for ‘blkcnt_t’
/usr/include/sys/types.h:236:20: note: previous declaration of ‘blkcnt_t’ was here
In file included from include/linux/stat.h:60:0,
from include/linux/module.h:10,
from /home/kernel/Modulos/DropProb/drop_prob.c:20:
include/linux/time.h:14:8: error: redefinition of ‘struct timespec’
/usr/include/time.h:120:8: note: originally defined here
include/linux/time.h:20:8: error: redefinition of ‘struct timeval’
/usr/include/bits/time.h:31:8: note: originally defined here
include/linux/time.h:74:22: error: conflicting types for ‘mktime’
/usr/include/time.h:193:15: note: previous declaration of ‘mktime’ was here
include/linux/time.h:206:8: error: redefinition of ‘struct tm’
/usr/include/time.h:133:8: note: originally defined here
include/linux/time.h:289:0: warning: "FD_SET" redefined [enabled by default]
/usr/include/sys/select.h:91:0: note: this is the location of the previous definition
include/linux/time.h:290:0: warning: "FD_CLR" redefined [enabled by default]
/usr/include/sys/select.h:92:0: note: this is the location of the previous definition
include/linux/time.h:291:0: warning: "FD_ISSET" redefined [enabled by default]
/usr/include/sys/select.h:93:0: note: this is the location of the previous definition
include/linux/time.h:292:0: warning: "FD_ZERO" redefined [enabled by default]
/usr/include/sys/select.h:94:0: note: this is the location of the previous definition
include/linux/time.h:302:8: error: redefinition of ‘struct itimerspec’
/usr/include/time.h:161:8: note: originally defined here
include/linux/time.h:337:0: warning: "TIMER_ABSTIME" redefined [enabled by default]
/usr/include/bits/time.h:82:0: note: this is the location of the previous definition
In file included from include/linux/mmzone.h:9:0,
from include/linux/gfp.h:4,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from /home/kernel/Modulos/DropProb/drop_prob.c:20:
include/linux/wait.h:4:0: warning: "WNOHANG" redefined [enabled by default]
/usr/include/bits/waitflags.h:26:0: note: this is the location of the previous definition
include/linux/wait.h:5:0: warning: "WUNTRACED" redefined [enabled by default]
/usr/include/bits/waitflags.h:27:0: note: this is the location of the previous definition
include/linux/wait.h:6:0: warning: "WSTOPPED" redefined [enabled by default]
/usr/include/bits/waitflags.h:30:0: note: this is the location of the previous definition
include/linux/wait.h:7:0: warning: "WEXITED" redefined [enabled by default]
/usr/include/bits/waitflags.h:31:0: note: this is the location of the previous definition
include/linux/wait.h:8:0: warning: "WCONTINUED" redefined [enabled by default]
/usr/include/bits/waitflags.h:32:0: note: this is the location of the previous definition
In file included from /usr/src/linux-headers-3.2.0-37-generic/arch/x86/include/asm/param.h:1:0,
from include/linux/param.h:4,
from include/linux/timex.h:172,
from include/linux/jiffies.h:8,
from include/linux/ktime.h:25,
from include/linux/timer.h:5,
from include/linux/workqueue.h:8,
from include/linux/pm.h:25,
from /usr/src/linux-headers-3.2.0-37-generic/arch/x86/include/asm/apic.h:5,
from /usr/src/linux-headers-3.2.0-37-generic/arch/x86/include/asm/smp.h:13,
from /usr/src/linux-headers-3.2.0-37-generic/arch/x86/include/asm/mmzone_64.h:10,
from /usr/src/linux-headers-3.2.0-37-generic/arch/x86/include/asm/mmzone.h:4,
from include/linux/mmzone.h:815,
from include/linux/gfp.h:4,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from /home/kernel/Modulos/DropProb/drop_prob.c:20:
include/asm-generic/param.h:7:0: warning: "CLOCKS_PER_SEC" redefined [enabled by default]
/usr/include/bits/time.h:49:0: note: this is the location of the previous definition
In file included from include/linux/signal.h:4:0,
from include/linux/sched.h:73,
from /usr/src/linux-headers-3.2.0-37-generic/arch/x86/include/asm/compat.h:8,
from include/linux/compat.h:18,
from include/linux/ethtool.h:17,
from include/linux/netdevice.h:47,
from include/net/sock.h:50,
from include/linux/tcp.h:211,
from /home/kernel/Modulos/DropProb/drop_prob.c:25:
/usr/src/linux-headers-3.2.0-37-generic/arch/x86/include/asm/signal.h:32:3: error: conflicting types for ‘sigset_t’
/usr/include/sys/select.h:38:20: note: previous declaration of ‘sigset_t’ was here
/home/kernel/Modulos/DropProb/drop_prob.c: In function ‘drop_tcp_hookfn’:
/home/kernel/Modulos/DropProb/drop_prob.c:76:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
/home/kernel/Modulos/DropProb/drop_prob.c: At top level:
/home/kernel/Modulos/DropProb/drop_prob.c:31:36: warning: ‘nfho_out’ defined but not used [-Wunused-variable]
make[2]: *** [/home/kernel/Modulos/DropProb/drop_prob.o] Error 1
make[1]: *** [_module_/home/kernel/Modulos/DropProb] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-37-generic'
make: *** [default] Error 2

You're not allowed to include the stdlib.h from the libc library within the kernel (even in modules).
Take a look at this page for the list of basic C library functions which are allowed and how to use them: http://www.kernel.org/doc/htmldocs/kernel-api/libc.html
If you're looking to get the current time in kernel space, you can take a look at the time_to_tm function. It would return the structure tm. Timezone should also be available in a variable called sys_tz, and can be used to adjust the offset and get the local time.

Related

Error with gem install sqlite3 on MacOS Monterey with Ruby 3.0.2 on Apple Silicon M1

I’m getting errors when I try to gem install sqlite3 under a fresh rbenv installation of Ruby 3.0.2. The sqlite3 gem installs successfully under Ruby 2.7.4. What is the fix for this?
I’m using MacOS Monterey on an Apple Silicon M1 machine.
➜ ~ > rbenv shell 3.0.2
➜ ~ > gem install sqlite3
Fetching sqlite3-1.4.2.gem
Building native extensions. This could take a while…
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
current directory: /Users/brian/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/sqlite3-1.4.2/ext/sqlite3
/Users/brian/.rbenv/versions/3.0.2/bin/ruby -I /Users/brian/.rbenv/versions/3.0.2/lib/ruby/3.0.0 -r ./siteconf20211119-57074-7hi3f4.rb extconf.rb
checking for sqlite3.h… yes
checking for pthread_create() in -lpthread… yes
checking for -ldl… yes
checking for sqlite3_libversion_number() in -lsqlite3… yes
checking for rb_proc_arity()… yes
checking for rb_integer_pack()… yes
checking for sqlite3_initialize()… yes
checking for sqlite3_backup_init()… yes
checking for sqlite3_column_database_name()… yes
checking for sqlite3_enable_load_extension()… yes
checking for sqlite3_load_extension()… yes
checking for sqlite3_open_v2()… yes
checking for sqlite3_prepare_v2()… yes
checking for sqlite3_int64 in sqlite3.h… yes
checking for sqlite3_uint64 in sqlite3.h… yes
creating Makefile
current directory: /Users/brian/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/sqlite3-1.4.2/ext/sqlite3
make DESTDIR\= clean
current directory: /Users/brian/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/sqlite3-1.4.2/ext/sqlite3
make DESTDIR\=
compiling aggregator.c
In file included from aggregator.c:1:
In file included from ./aggregator.h:4:
In file included from ./sqlite3_ruby.h:4:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby.h:38:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/ruby.h:23:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/defines.h:73:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/backward/2/attributes.h:43:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/attr/pure.h:25:
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/assert.h:132:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
RBIMPL_ATTR_NORETURN()
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/attr/noreturn.h:29:33: note: expanded from macro 'RBIMPL_ATTR_NORETURN'
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
^
In file included from aggregator.c:1:
In file included from ./aggregator.h:4:
In file included from ./sqlite3_ruby.h:4:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby.h:38:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/ruby.h:24:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/anyargs.h:77:
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/intern/vm.h:64:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
RBIMPL_ATTR_NORETURN()
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/attr/noreturn.h:29:33: note: expanded from macro 'RBIMPL_ATTR_NORETURN'
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
^
In file included from aggregator.c:1:
In file included from ./aggregator.h:4:
In file included from ./sqlite3_ruby.h:4:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby.h:38:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/ruby.h:25:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic.h:23:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic/char.h:23:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic/int.h:26:
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic/long.h:70:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
RBIMPL_ATTR_NORETURN()
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/attr/noreturn.h:29:33: note: expanded from macro 'RBIMPL_ATTR_NORETURN'
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
^
In file included from aggregator.c:1:
In file included from ./aggregator.h:4:
In file included from ./sqlite3_ruby.h:4:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby.h:38:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/ruby.h:25:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic.h:23:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic/char.h:29:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rstring.h:28:
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rbasic.h:46:14: error: expected parameter declarator
RUBY_ALIGNAS(SIZEOF_VALUE)
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/value.h:41:23: note: expanded from macro 'SIZEOF_VALUE'
# define SIZEOF_VALUE SIZEOF_LONG
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/arm64-darwin21/ruby/config.h:61:21: note: expanded from macro 'SIZEOF_LONG'
#define SIZEOF_LONG 8
^
In file included from aggregator.c:1:
In file included from ./aggregator.h:4:
In file included from ./sqlite3_ruby.h:4:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby.h:38:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/ruby.h:25:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic.h:23:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic/char.h:29:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rstring.h:28:
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rbasic.h:46:14: error: expected ')'
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/value.h:41:23: note: expanded from macro 'SIZEOF_VALUE'
# define SIZEOF_VALUE SIZEOF_LONG
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/arm64-darwin21/ruby/config.h:61:21: note: expanded from macro 'SIZEOF_LONG'
#define SIZEOF_LONG 8
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rbasic.h:46:1: note: to match this '('
RUBY_ALIGNAS(SIZEOF_VALUE)
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/backward/2/stdalign.h:27:22: note: expanded from macro 'RUBY_ALIGNAS'
#define RUBY_ALIGNAS RBIMPL_ALIGNAS
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/stdalign.h:66:44: note: expanded from macro 'RBIMPL_ALIGNAS'
# define RBIMPL_ALIGNAS(_) __declspec(align(_))
^
In file included from aggregator.c:1:
In file included from ./aggregator.h:4:
In file included from ./sqlite3_ruby.h:4:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby.h:38:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/ruby.h:25:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic.h:23:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic/char.h:29:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rstring.h:28:
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rbasic.h:47:1: error: expected function body after function declarator
RBasic {
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rbasic.h:82:23: error: incomplete definition of type 'struct RBasic'
return RBASIC(obj)->klass;
~~~~~~~~~~~^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rbasic.h:82:12: note: forward declaration of 'struct RBasic'
return RBASIC(obj)->klass;
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rbasic.h:34:50: note: expanded from macro 'RBASIC'
#define RBASIC(obj) RBIMPL_CAST((struct RBasic *)(obj))
^
In file included from aggregator.c:1:
In file included from ./aggregator.h:4:
In file included from ./sqlite3_ruby.h:4:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby.h:38:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/ruby.h:25:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic.h:23:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic/char.h:29:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rstring.h:30:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:35:
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/value_type.h:157:28: error: incomplete definition of type 'struct RBasic'
VALUE ret = RBASIC(obj)->flags & RUBY_T_MASK;
~~~~~~~~~~~^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/value_type.h:157:17: note: forward declaration of 'struct RBasic'
VALUE ret = RBASIC(obj)->flags & RUBY_T_MASK;
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rbasic.h:34:50: note: expanded from macro 'RBASIC'
#define RBASIC(obj) RBIMPL_CAST((struct RBasic *)(obj))
^
In file included from aggregator.c:1:
In file included from ./aggregator.h:4:
In file included from ./sqlite3_ruby.h:4:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby.h:38:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/ruby.h:25:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic.h:23:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic/char.h:29:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rstring.h:30:
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:237:23: error: incomplete definition of type 'struct RBasic'
return RBASIC(obj)->flags & flags;
~~~~~~~~~~~^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:237:12: note: forward declaration of 'struct RBasic'
return RBASIC(obj)->flags & flags;
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rbasic.h:34:50: note: expanded from macro ‘RBASIC’
#define RBASIC(obj) RBIMPL_CAST((struct RBasic *)(obj))
^
In file included from aggregator.c:1:
In file included from ./aggregator.h:4:
In file included from ./sqlite3_ruby.h:4:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby.h:38:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/ruby.h:25:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic.h:23:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic/char.h:29:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rstring.h:30:
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:285:1: error: ‘__declspec’ attributes are not enabled; use ‘-fdeclspec’ or ‘-fms-extensions’ to enable support for __declspec attributes
RBIMPL_ATTR_NOALIAS()
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/attr/noalias.h:53:32: note: expanded from macro ‘RBIMPL_ATTR_NOALIAS’
# define RBIMPL_ATTR_NOALIAS() __declspec(noalias)
^
In file included from aggregator.c:1:
In file included from ./aggregator.h:4:
In file included from ./sqlite3_ruby.h:4:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby.h:38:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/ruby.h:25:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic.h:23:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic/char.h:29:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rstring.h:30:
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:288:30: warning: declaration of ‘struct RBasic’ will not be visible outside of this function [-Wvisibility]
rbimpl_fl_set_raw_raw(struct RBasic *obj, VALUE flags)
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:290:8: error: incomplete definition of type 'struct RBasic'
obj->flags |= flags;
~~~^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:288:30: note: forward declaration of ‘struct RBasic’
rbimpl_fl_set_raw_raw(struct RBasic *obj, VALUE flags)
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:298:27: warning: incompatible pointer types passing ‘struct RBasic *’ to parameter of type ‘struct RBasic *’ [-Wincompatible-pointer-types]
rbimpl_fl_set_raw_raw(RBASIC(obj), flags);
^~~~~~~~~~~
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rbasic.h:34:30: note: expanded from macro ‘RBASIC’
#define RBASIC(obj) RBIMPL_CAST((struct RBasic *)(obj))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/cast.h:33:28: note: expanded from macro ‘RBIMPL_CAST’
# define RBIMPL_CAST(expr) (expr)
^~~~~~
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:288:38: note: passing argument to parameter ‘obj’ here
rbimpl_fl_set_raw_raw(struct RBasic *obj, VALUE flags)
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:310:1: error: ‘__declspec’ attributes are not enabled; use ‘-fdeclspec’ or ‘-fms-extensions’ to enable support for __declspec attributes
RBIMPL_ATTR_NOALIAS()
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/attr/noalias.h:53:32: note: expanded from macro ‘RBIMPL_ATTR_NOALIAS’
# define RBIMPL_ATTR_NOALIAS() __declspec(noalias)
^
In file included from aggregator.c:1:
In file included from ./aggregator.h:4:
In file included from ./sqlite3_ruby.h:4:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby.h:38:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/ruby.h:25:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic.h:23:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic/char.h:29:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rstring.h:30:
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:313:32: warning: declaration of ‘struct RBasic’ will not be visible outside of this function [-Wvisibility]
rbimpl_fl_unset_raw_raw(struct RBasic *obj, VALUE flags)
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:315:8: error: incomplete definition of type 'struct RBasic'
obj->flags &= ~flags;
~~~^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:313:32: note: forward declaration of ‘struct RBasic’
rbimpl_fl_unset_raw_raw(struct RBasic *obj, VALUE flags)
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:323:29: warning: incompatible pointer types passing ‘struct RBasic *’ to parameter of type ‘struct RBasic *’ [-Wincompatible-pointer-types]
rbimpl_fl_unset_raw_raw(RBASIC(obj), flags);
^~~~~~~~~~~
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rbasic.h:34:30: note: expanded from macro ‘RBASIC’
#define RBASIC(obj) RBIMPL_CAST((struct RBasic *)(obj))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/cast.h:33:28: note: expanded from macro ‘RBIMPL_CAST’
# define RBIMPL_CAST(expr) (expr)
^~~~~~
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:313:40: note: passing argument to parameter ‘obj’ here
rbimpl_fl_unset_raw_raw(struct RBasic *obj, VALUE flags)
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:335:1: error: ‘__declspec’ attributes are not enabled; use ‘-fdeclspec’ or ‘-fms-extensions’ to enable support for __declspec attributes
RBIMPL_ATTR_NOALIAS()
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/attr/noalias.h:53:32: note: expanded from macro ‘RBIMPL_ATTR_NOALIAS’
# define RBIMPL_ATTR_NOALIAS() __declspec(noalias)
^
In file included from aggregator.c:1:
In file included from ./aggregator.h:4:
In file included from ./sqlite3_ruby.h:4:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby.h:38:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/ruby.h:25:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic.h:23:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic/char.h:29:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rstring.h:30:
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:338:34: warning: declaration of ‘struct RBasic’ will not be visible outside of this function [-Wvisibility]
rbimpl_fl_reverse_raw_raw(struct RBasic *obj, VALUE flags)
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:340:8: error: incomplete definition of type 'struct RBasic'
obj->flags ^= flags;
~~~^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:338:34: note: forward declaration of ‘struct RBasic’
rbimpl_fl_reverse_raw_raw(struct RBasic *obj, VALUE flags)
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:348:31: warning: incompatible pointer types passing ‘struct RBasic *’ to parameter of type ‘struct RBasic *’ [-Wincompatible-pointer-types]
rbimpl_fl_reverse_raw_raw(RBASIC(obj), flags);
^~~~~~~~~~~
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rbasic.h:34:30: note: expanded from macro 'RBASIC'
#define RBASIC(obj) RBIMPL_CAST((struct RBasic *)(obj))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/cast.h:33:28: note: expanded from macro 'RBIMPL_CAST'
# define RBIMPL_CAST(expr) (expr)
^~~~~~
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:338:42: note: passing argument to parameter 'obj' here
rbimpl_fl_reverse_raw_raw(struct RBasic *obj, VALUE flags)
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:465:43: error: incomplete definition of type 'struct RBasic'
if (RBASIC_CLASS(x) && !(RBASIC(x)->flags & RUBY_FL_SINGLETON)) {
~~~~~~~~~^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/fl_type.h:465:34: note: forward declaration of 'struct RBasic'
if (RBASIC_CLASS(x) && !(RBASIC(x)->flags & RUBY_FL_SINGLETON)) {
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rbasic.h:34:50: note: expanded from macro 'RBASIC'
#define RBASIC(obj) RBIMPL_CAST((struct RBasic *)(obj))
^
In file included from aggregator.c:1:
In file included from ./aggregator.h:4:
In file included from ./sqlite3_ruby.h:4:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby.h:38:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/ruby.h:25:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic.h:23:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/arithmetic/char.h:29:
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rstring.h:74:19: error: field has incomplete type 'struct RBasic'
struct RBasic basic;
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rstring.h:74:12: note: forward declaration of 'struct RBasic'
struct RBasic basic;
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rstring.h:109:26: error: incomplete definition of type 'struct RBasic'
VALUE f = RBASIC(str)->flags;
~~~~~~~~~~~^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rstring.h:74:12: note: forward declaration of ‘struct RBasic’
struct RBasic basic;
^
In file included from aggregator.c:1:
In file included from ./aggregator.h:4:
In file included from ./sqlite3_ruby.h:4:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby.h:38:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/ruby.h:26:
In file included from /Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core.h:23:
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rarray.h:88:19: error: field has incomplete type ‘struct RBasic’
struct RBasic basic;
^
/Users/brian/.rbenv/versions/3.0.2/include/ruby-3.0.0/ruby/internal/core/rstring.h:74:12: note: forward declaration of ‘struct RBasic’
struct RBasic basic;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
6 warnings and 20 errors generated.
make: *** [aggregator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/brian/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/sqlite3-1.4.2 for inspection.
Results logged to /Users/brian/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/extensions/arm64-darwin-21/3.0.0/sqlite3-1.4.2/gem_make.out
➜ ~ >
I figured out the answer. It works if I prepend the gem install command with CC='clang -fdeclspec'.
Like this:
CC='clang -fdeclspec' gem install sqlite3

FFmpeg Make Errors with v4l2

I tried checking out ffmpeg to build it as follows:
git clone https://github.com/FFmpeg/FFmpeg.git ffmpeg
cd ffmpeg
./configure --disable-asm --disable-v4l2-m2m --disable-indev=v4l2 --disable-outdev=v4l2
make
But I get the following errors:
libavcodec/v4l2_m2m_enc.c: In function ‘v4l2_set_ext_ctrl’:
libavcodec/v4l2_m2m_enc.c:51: warning: braces around scalar initializer
libavcodec/v4l2_m2m_enc.c:51: warning: (near initialization for
‘ctrls.count’) libavcodec/v4l2_m2m_enc.c:55: error: ‘struct v4l2_ext_controls’ has no member named ‘ctrl_class’ libavcodec/v4l2_m2m_enc.c:60:
error: ‘struct v4l2_ext_control’ has no member named ‘value’
libavcodec/v4l2_m2m_enc.c: In function ‘v4l2_get_ext_ctrl’:
libavcodec/v4l2_m2m_enc.c:71: warning: braces around scalar initializer
libavcodec/v4l2_m2m_enc.c:71: warning: (near initialization for
‘ctrls.count’) libavcodec/v4l2_m2m_enc.c:76: error: ‘struct v4l2_ext_controls’ has no member named ‘ctrl_class’ libavcodec/v4l2_m2m_enc.c:89:
error: ‘struct v4l2_ext_control’ has no member named ‘value’ make: ***
[libavcodec/v4l2_m2m_enc.o] Error 1
Any idea how to proceed ?

Error building shogun: no matching function for call to 'PyUnicode_AsUTF8AndSize'

I am trying to manually compile shogun as per the instructions given in this link https://github.com/shogun-toolbox/shogun/blob/develop/doc/readme/INSTALL.md#manual
Here is my terminal output on running make:
$make -j4
[100%] Building CXX object src/interfaces/python/CMakeFiles/_interface_python.dir/sg_print_functions.cpp.o
In file included from /Users/krishna/shogun/build/src/interfaces/python/shogunPYTHON_wrap.cxx:6158:
/Users/krishna/shogun/src/shogun/distance/DirectorDistance.h:61:3: warning: control may reach end of non-void function [-Wreturn-type]
}
^
In file included from /Users/krishna/shogun/build/src/interfaces/python/shogunPYTHON_wrap.cxx:6196:
/Users/krishna/shogun/src/shogun/evaluation/TimeSeriesSplitting.h:80:23: warning: 'get_name' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
virtual const char* get_name() const
^
/Users/krishna/shogun/src/shogun/base/SGObject.h:180:22: note: overridden virtual function is here
virtual const char* get_name() const = 0;
^
/Users/krishna/shogun/build/src/interfaces/python/shogunPYTHON_wrap.cxx:7696:39: error: no matching function for call to 'PyUnicode_AsUTF8AndSize'
const char* str = PyUnicode_AsUTF8AndSize(o, &len);
^~~~~~~~~~~~~~~~~~~~~~~
/Users/krishna/.edm/envs/py3/include/python3.6m/unicodeobject.h:1126:20: note: candidate function not viable: no known conversion from 'int64_t *' (aka 'long long *') to 'Py_ssize_t *' (aka 'long *') for 2nd
argument
PyAPI_FUNC(char *) PyUnicode_AsUTF8AndSize(
^
/Users/krishna/shogun/build/src/interfaces/python/shogunPYTHON_wrap.cxx:10278:25: warning: 'tmpnam' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent
in the design of tmpnam(3), it is highly recommended that you use mkstemp(3) instead. [-Wdeprecated-declarations]
char* fname=tmpnam(NULL);
^
/usr/include/stdio.h:275:1: note: 'tmpnam' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tmpnam(3), it is highly recommended that you use mkstemp(3) instead.")
^/usr/include/sys/cdefs.h:180:48: note: expanded from macro '__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((deprecated(_msg)))
^
/Users/krishna/shogun/build/src/interfaces/python/shogunPYTHON_wrap.cxx:10322:25: warning: 'tmpnam' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent
in the design of tmpnam(3), it is highly recommended that you use mkstemp(3) instead. [-Wdeprecated-declarations]
char* fname=tmpnam(NULL);
^
/usr/include/stdio.h:275:1: note: 'tmpnam' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tmpnam(3), it is highly recommended that you use mkstemp(3) instead.")
^
/usr/include/sys/cdefs.h:180:48: note: expanded from macro '__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((deprecated(_msg)))
^
4 warnings and 1 error generated.
make[2]: *** [src/interfaces/python/CMakeFiles/_interface_python.dir/shogunPYTHON_wrap.cxx.o] Error 1
make[1]: *** [src/interfaces/python/CMakeFiles/_interface_python.dir/all] Error 2
make: *** [all] Error 2
Thank you.
this was a bug and should be fixed by ca4360e483c115444864bef0925417f479923a43 commit

How to get better error output with Visual Studio

I was working on a project and got the following errors
Error (active) the default constructor of "Input" cannot be referenced -- it is a deleted function EquationSolver c:\Users\Kim\Documents\Visual Studio 2015\Projects\EquationSolver\EquationSolver\main.cpp 10
Error C2280 'Input::Input(void)': attempting to reference a deleted function EquationSolver <project_dir>\main.cpp 10
Since it is almost impossible to find the cause of the error from this, I tried compiling with gcc with -Wall and got following output
main.cpp: In function 'int main()':
main.cpp:10:9: error: use of deleted function 'Input::Input()'
Input input;
^~~~~
In file included from main.cpp:2:0:
Input.hpp:16:7: note: 'Input::Input()' is implicitly deleted because the default definition would be ill-formed:
class Input
^~~~~
Input.hpp:16:7: error: use of deleted function 'Expressions::Expressions()'
In file included from Input.hpp:11:0,
from main.cpp:2:
Expressions.hpp:8:7: note: 'Expressions::Expressions()' is implicitly deleted because the default definition would be ill-formed:
class Expressions
^~~~~~~~~~~
Expressions.hpp:8:7: error: uninitialized reference member in 'class Expressions'
Expressions.hpp:17:8: note: 'Expressions::Vec& Expressions::left' should be initialized
Vec& left;
^~~~
Expressions.hpp:8:7: error: uninitialized reference member in 'class Expressions'
class Expressions
^~~~~~~~~~~
Expressions.hpp:18:8: note: 'Expressions::Vec& Expressions::right' should be initialized
Vec& right;
^~~~~
This output is much more verbose and quickly helped me find the origin, which was a misplaced & (class member should be Vec left, was Vec& left).
Is it possible to make Visual Studio as verbose?
When putting Visual Studio to /Wall, I get >1800 warnings, most completely unrelated to my project, but I still only get those two errors.

CP210 driver installation on linux

I have been unsuccessfully trying to install the CP210x drivers on my linux machine. The current version of kernel on my machine is 2.6.18.
Although I have heard, all kernel > 2.6.12 comes pre-loaded with CP210 drivers, I was unable to find one on mine, when I tried,
modprobe cp210x
It returned an error.
So when I tried to install the Cp210x driver from Silabs, I'm constantly ending with the following error,
make -C /lib/modules/2.6.18-194.8.1.el5/build
M=/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source modules
make-3.79.1-p7[1]: Entering directory `/usr/src/kernels/2.6.18-194.8.1.el5-x86_64'
CC [M] /users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.o
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:45: warning: 'struct ktermios' declared inside parameter list
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:45: warning: its scope is only this definition or declaration, which is probably not what you want
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:47: warning: 'struct ktermios' declared inside parameter list
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:175: error: unknown field 'usb_driver' specified in initializer
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:175: warning: initialization from incompatible pointer type
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:178: error: unknown field 'bulk_in_size' specified in initializer
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:178: warning: missing braces around initializer
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:178: warning: (near initialization for 'cp210x_device.driver_list')
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:178: warning: initialization makes pointer from integer without a cast
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:179: error: unknown field 'bulk_out_size' specified in initializer
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:179: warning: initialization makes pointer from integer without a cast
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:180: warning: initialization from incompatible pointer type
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:181: warning: initialization from incompatible pointer type
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:182: warning: initialization from incompatible pointer type
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:183: warning: initialization from incompatible pointer type
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:184: warning: initialization from incompatible pointer type
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:185: warning: initialization from incompatible pointer type
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:186: warning: initialization from incompatible pointer type
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:188: error: unknown field 'release' specified in initializer
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:188: warning: initialization from incompatible pointer type
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:189: error: unknown field 'dtr_rts' specified in initializer
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:190: warning: initialization from incompatible pointer type
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c: In function 'cp210x_open':
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:446: warning: passing argument 1 of 'usb_serial_generic_open' from incompatible pointer type
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:446: warning: passing argument 2 of 'usb_serial_generic_open' from incompatible pointer type
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c: In function 'cp210x_close':
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:453: error: too few arguments to function 'usb_serial_generic_close'
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:455: error: 'struct usb_serial' has no member named 'disc_mutex'
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:456: error: 'struct usb_serial' has no member named 'disconnected'
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:459: error: 'struct usb_serial' has no member named 'disc_mutex'
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c: In function 'cp210x_get_termios':
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:535: error: implicit declaration of function 'tty_encode_baud_rate'
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c: At top level:
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:702: warning: 'struct ktermios' declared inside parameter list
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:703: error: conflicting types for 'cp210x_change_speed'
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:45: error: previous declaration of 'cp210x_change_speed' was here
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c: In function 'cp210x_change_speed':
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:706: error: 'struct termios' has no member named 'c_ospeed'
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:720: error: dereferencing pointer to incomplete type
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c: At top level:
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:729: warning: 'struct ktermios' declared inside parameter list
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:730: error: conflicting types for 'cp210x_set_termios'
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:47: error: previous declaration of 'cp210x_set_termios' was here
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c: In function 'cp210x_set_termios':
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:741: error: dereferencing pointer to incomplete type
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:743: warning: passing argument 3 of 'cp210x_change_speed' from incompatible pointer type
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c: In function '__check_debug':
/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.c:1019: warning: return from incompatible pointer type
make-3.79.1-p7[2]: *** [/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source/cp210x.o] Error 1
make-3.79.1-p7[1]: *** [_module_/users/phunchik/Desktop/Linux_3.x.x_VCP_Driver_Source] Error 2
make-3.79.1-p7[1]: Leaving directory `/usr/src/kernels/2.6.18-194.8.1.el5-x86_64'
make-3.79.1-p7: *** [all] Error 2 **
It would be great if some one could help me fix this error or suggest a way to update my kernel
It seems that your driver needs Linux_3.x.x as suggests the directory name.
For information, Linux 3.x.x is equivalent to Linux 2.6.40+. So you are at least 22 versions behind.
To upgrade your kernel, just use your distribution upgrade system (apt-get, aptitude, yum, ...).
You can also build a new kernel by hand, but it is far more difficult.
I think you've just downloaded the wrong driver. The one for the 2.6 kernel is here:
http://www.silabs.com/Support%20Documents/Software/Linux_2.6.x_VCP_Driver_Source.zip
hth

Resources