Find the answer to your Linux question:
Results 1 to 8 of 8
i was writing this simple module working code and i found these compilation error somebody can tell me problems. code is this. #include <stdio.h> #include <stdbool.h> #include <sys/time.h> #include <sys/types.h> ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2009
    Posts
    13

    compilation problem in module programming


    i was writing this simple module working code and i found these compilation error somebody can tell me problems.

    code is this.
    #include <stdio.h>
    #include <stdbool.h>
    #include <sys/time.h>
    #include <sys/types.h>
    #include<linux/module.h>

    int init_module(void){
    printk("Hello world\n");
    return 0;
    }

    void cleanup_module(void){
    printk("Good Bye cruel world\n");
    }
    for run this code command type was
    $gcc -D__KERNEL__ -DMODULE -DCONFIG_MK7 -DCONFIG_HZ=250 -DCONFIG_X86_L1_CACHE_SHIFT=7 -DCONFIG_PAGE_OFFSETUL=0xc0000000 -c Module.c

    error was
    In file included from /usr/include/linux/list.h:4,
    from /usr/include/linux/module.h:9,
    from Module.c:5:
    /usr/include/linux/stddef.h:16: error: expected identifier before numeric constant
    In file included from /usr/include/asm/page_32.h:115,
    from /usr/include/asm/page.h:44,
    from /usr/include/asm/pda.h:8,
    from /usr/include/asm/current.h:19,
    from /usr/include/asm/processor.h:15,
    from /usr/include/linux/prefetch.h:14,
    from /usr/include/linux/list.h:6,
    from /usr/include/linux/module.h:9,
    from Module.c:5:
    /usr/include/linux/string.h:68: error: conflicting types for ‘strlen’
    /usr/include/linux/string.h:99: error: conflicting types for ‘memcmp’
    In file included from /usr/include/linux/stat.h:60,
    from /usr/include/linux/module.h:10,
    from Module.c:5:
    /usr/include/linux/time.h:14: error: redefinition of ‘struct timespec’
    /usr/include/linux/time.h:20: error: redefinition of ‘struct timeval’
    /usr/include/linux/time.h:25: error: redefinition of ‘struct timezone’
    /usr/include/linux/time.h:205: error: redefinition of ‘struct itimerval’
    In file included from /usr/include/linux/gfp.h:4,
    from /usr/include/linux/kmod.h:22,
    from /usr/include/linux/module.h:13,
    from Module.c:5:
    /usr/include/linux/mmzone.h:18:26: error: linux/bounds.h: No such file or directory
    In file included from /usr/include/linux/gfp.h:4,
    from /usr/include/linux/kmod.h:22,
    from /usr/include/linux/module.h:13,
    from Module.c:5:
    /usr/include/linux/mmzone.h:218: error: ‘MAX_NR_ZONES’ undeclared here (not in a function)
    In file included from /usr/include/linux/elf.h:7,
    from /usr/include/linux/module.h:14,
    from Module.c:5:
    /usr/include/asm/elf.h: In function ‘elf_common_init’:
    /usr/include/asm/elf.h:166: error: ‘struct pt_regs’ has no member named ‘r8’
    /usr/include/asm/elf.h:166: error: ‘struct pt_regs’ has no member named ‘r9’
    /usr/include/asm/elf.h:166: error: ‘struct pt_regs’ has no member named ‘r10’
    /usr/include/asm/elf.h:166: error: ‘struct pt_regs’ has no member named ‘r11’
    /usr/include/asm/elf.h:167: error: ‘struct pt_regs’ has no member named ‘r12’
    /usr/include/asm/elf.h:167: error: ‘struct pt_regs’ has no member named ‘r13’
    /usr/include/asm/elf.h:167: error: ‘struct pt_regs’ has no member named ‘r14’
    /usr/include/asm/elf.h:167: error: ‘struct pt_regs’ has no member named ‘r15’

    please tell me the problems.

  2. #2
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    Could you please tell us what kernel your working with...just run uname -r and it will tell you...Gerard4143

    Plus you can't use standard libraries in the kernel...here's a good intro link to give you the basics:

    The Linux Kernel Module Programming Guide

  3. #3
    Just Joined!
    Join Date
    Mar 2009
    Posts
    13

    compilation error

    my kernel is 2.6.27-7-generic and this is ubuntu operating system.

    if i am not including these library that means program is like that
    #include<linux/module.h>
    #include <linux/kernel.h>

    int init_module(void){
    printk("Hello world\n");
    return 0;
    }

    void cleanup_module(void){
    printk("Good Bye cruel world\n");
    }

    gaurav@gaurav-desktop:~/Programs$ gcc -D__KERNEL__ -DMODULE -DCONFIG_MK7 -DCONFIG_HZ=250 -DCONFIG_X86_L1_CACHE_SHIFT=7 -DCONFIG_PAGE_OFFSETUL=0xc0000000 -c Module.c

    after comilation error is
    In file included from /usr/include/asm/ptrace.h:9,
    from /usr/include/asm/vm86.h:130,
    from /usr/include/asm/processor.h:10,
    from /usr/include/linux/prefetch.h:14,
    from /usr/include/linux/list.h:6,
    from /usr/include/linux/module.h:9,
    from Module.c:1:
    /usr/include/asm/ds.h:59: error: expected declaration specifiers or ‘...’ before ‘size_t’
    In file included from /usr/include/asm/bitops.h:13,
    from /usr/include/linux/bitops.h:17,
    from /usr/include/linux/kernel.h:15,
    from /usr/include/linux/cache.h:4,
    from /usr/include/asm/pda.h:7,
    from /usr/include/asm/current.h:19,
    from /usr/include/asm/processor.h:15,
    from /usr/include/linux/prefetch.h:14,
    from /usr/include/linux/list.h:6,
    from /usr/include/linux/module.h:9,
    from Module.c:1:
    /usr/include/asm/alternative.h:180: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/asm/alternative.h:181: error: expected declaration specifiers or ‘...’ before ‘size_t’
    In file included from /usr/include/linux/kernel.h:16,
    from /usr/include/linux/cache.h:4,
    from /usr/include/asm/pda.h:7,
    from /usr/include/asm/current.h:19,
    from /usr/include/asm/processor.h:15,
    from /usr/include/linux/prefetch.h:14,
    from /usr/include/linux/list.h:6,
    from /usr/include/linux/module.h:9,
    from Module.c:1:
    /usr/include/linux/log2.h:52: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘is_power_of_2’
    In file included from /usr/include/linux/cache.h:4,
    from /usr/include/asm/pda.h:7,
    from /usr/include/asm/current.h:19,
    from /usr/include/asm/processor.h:15,
    from /usr/include/linux/prefetch.h:14,
    from /usr/include/linux/list.h:6,
    from /usr/include/linux/module.h:9,
    from Module.c:1:
    /usr/include/linux/kernel.h:166: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/kernel.h:167: error: format string argument not a string type
    /usr/include/linux/kernel.h:168: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/kernel.h:170: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/kernel.h:171: error: format string argument not a string type
    /usr/include/linux/kernel.h:172: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/kernel.h:211: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘printk_timed_ratelimit’
    /usr/include/linux/kernel.h:271: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/kernel.h:273: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/kernel.h:273: error: expected declaration specifiers or ‘...’ before ‘bool’
    /usr/include/linux/kernel.h:276: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/kernel.h:276: error: expected declaration specifiers or ‘...’ before ‘bool’
    /usr/include/linux/kernel.h:278: error: expected declaration specifiers or ‘...’ before ‘size_t’
    In file included from /usr/include/asm/string.h:4,
    from /usr/include/linux/string.h:19,
    from /usr/include/asm/page_32.h:115,
    from /usr/include/asm/page.h:44,
    from /usr/include/asm/pda.h:8,
    from /usr/include/asm/current.h:19,
    from /usr/include/asm/processor.h:15,
    from /usr/include/linux/prefetch.h:14,
    from /usr/include/linux/list.h:6,
    from /usr/include/linux/module.h:9,
    from Module.c:1:
    /usr/include/asm/string_64.h:9: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/asm/string_64.h: In function ‘__inline_memcpy’:
    /usr/include/asm/string_64.h:21: error: ‘n’ undeclared (first use in this function)
    /usr/include/asm/string_64.h:21: error: (Each undeclared identifier is reported only once
    /usr/include/asm/string_64.h:21: error: for each function it appears in.)
    /usr/include/asm/string_64.h: At top level:
    /usr/include/asm/string_64.h:31: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/asm/string_64.h:47: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/asm/string_64.h:50: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/asm/string_64.h:52: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/asm/string_64.h:53: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘strlen’
    In file included from /usr/include/asm/page_32.h:115,
    from /usr/include/asm/page.h:44,
    from /usr/include/asm/pda.h:8,
    from /usr/include/asm/current.h:19,
    from /usr/include/asm/processor.h:15,
    from /usr/include/linux/prefetch.h:14,
    from /usr/include/linux/list.h:6,
    from /usr/include/linux/module.h:9,
    from Module.c:1:
    /usr/include/linux/string.h:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘strlcpy’
    /usr/include/linux/string.h:37: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘strlcat’
    /usr/include/linux/string.h:52: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/string.h:58: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/string.h:99: error: conflicting types for ‘memcmp’
    /usr/include/asm/string_64.h:52: error: previous declaration of ‘memcmp’ was here
    /usr/include/linux/string.h:106: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/string.h:107: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/string.h:112: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘sysfs_streq’
    /usr/include/linux/string.h:114: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘memory_read_from_buffer’
    In file included from /usr/include/asm/page.h:44,
    from /usr/include/asm/pda.h:8,
    from /usr/include/asm/current.h:19,
    from /usr/include/asm/processor.h:15,
    from /usr/include/linux/prefetch.h:14,
    from /usr/include/linux/list.h:6,
    from /usr/include/linux/module.h:9,
    from Module.c:1:
    /usr/include/asm/page_32.h: In function ‘clear_page’:
    /usr/include/asm/page_32.h:119: error: too many arguments to function ‘memset’
    /usr/include/asm/page_32.h: In function ‘copy_page’:
    /usr/include/asm/page_32.h:124: error: too many arguments to function ‘memcpy’
    In file included from /usr/include/linux/cpumask.h:139,
    from /usr/include/asm/processor.h:25,
    from /usr/include/linux/prefetch.h:14,
    from /usr/include/linux/list.h:6,
    from /usr/include/linux/module.h:9,
    from Module.c:1:
    /usr/include/linux/bitmap.h: In function ‘bitmap_zero’:
    /usr/include/linux/bitmap.h:146: error: too many arguments to function ‘memset’
    /usr/include/linux/bitmap.h: In function ‘bitmap_fill’:
    /usr/include/linux/bitmap.h:152: error: ‘size_t’ undeclared (first use in this function)
    /usr/include/linux/bitmap.h:152: error: expected ‘;’ before ‘nlongs’
    /usr/include/linux/bitmap.h:153: error: ‘nlongs’ undeclared (first use in this function)
    /usr/include/linux/bitmap.h:155: error: too many arguments to function ‘memset’
    /usr/include/linux/bitmap.h: In function ‘bitmap_copy’:
    /usr/include/linux/bitmap.h:167: error: too many arguments to function ‘memcpy’
    In file included from /usr/include/linux/list.h:6,
    from /usr/include/linux/module.h:9,
    from Module.c:1:
    /usr/include/linux/prefetch.h: At top level:
    /usr/include/linux/prefetch.h:53: error: expected declaration specifiers or ‘...’ before ‘size_t’
    In file included from /usr/include/linux/preempt.h:9,
    from /usr/include/linux/spinlock.h:50,
    from /usr/include/linux/seqlock.h:29,
    from /usr/include/linux/time.h:8,
    from /usr/include/linux/stat.h:60,
    from /usr/include/linux/module.h:10,
    from Module.c:1:
    /usr/include/linux/thread_info.h:34: error: expected specifier-qualifier-list before ‘clockid_t’
    In file included from /usr/include/linux/stat.h:60,
    from /usr/include/linux/module.h:10,
    from Module.c:1:
    /usr/include/linux/time.h:15: error: expected specifier-qualifier-list before ‘time_t’
    /usr/include/linux/time.h:21: error: expected specifier-qualifier-list before ‘time_t’
    /usr/include/linux/time.h: In function ‘timespec_equal’:
    /usr/include/linux/time.h:44: error: ‘const struct timespec’ has no member named ‘tv_sec’
    /usr/include/linux/time.h:44: error: ‘const struct timespec’ has no member named ‘tv_sec’
    /usr/include/linux/time.h:44: error: ‘const struct timespec’ has no member named ‘tv_nsec’
    /usr/include/linux/time.h:44: error: ‘const struct timespec’ has no member named ‘tv_nsec’
    /usr/include/linux/time.h: In function ‘timespec_compare’:
    /usr/include/linux/time.h:54: error: ‘const struct timespec’ has no member named ‘tv_sec’
    /usr/include/linux/time.h:54: error: ‘const struct timespec’ has no member named ‘tv_sec’
    /usr/include/linux/time.h:56: error: ‘const struct timespec’ has no member named ‘tv_sec’
    /usr/include/linux/time.h:56: error: ‘const struct timespec’ has no member named ‘tv_sec’
    /usr/include/linux/time.h:58: error: ‘const struct timespec’ has no member named ‘tv_nsec’
    /usr/include/linux/time.h:58: error: ‘const struct timespec’ has no member named ‘tv_nsec’
    /usr/include/linux/time.h: In function ‘timeval_compare’:
    /usr/include/linux/time.h:63: error: ‘const struct timeval’ has no member named ‘tv_sec’
    /usr/include/linux/time.h:63: error: ‘const struct timeval’ has no member named ‘tv_sec’
    /usr/include/linux/time.h:65: error: ‘const struct timeval’ has no member named ‘tv_sec’
    /usr/include/linux/time.h:65: error: ‘const struct timeval’ has no member named ‘tv_sec’
    /usr/include/linux/time.h:67: error: ‘const struct timeval’ has no member named ‘tv_usec’
    /usr/include/linux/time.h:67: error: ‘const struct timeval’ has no member named ‘tv_usec’
    /usr/include/linux/time.h: At top level:
    /usr/include/linux/time.h:74: error: expected declaration specifiers or ‘...’ before ‘time_t’
    /usr/include/linux/time.h: In function ‘timespec_sub’:
    /usr/include/linux/time.h:83: error: ‘struct timespec’ has no member named ‘tv_sec’
    /usr/include/linux/time.h:83: error: ‘struct timespec’ has no member named ‘tv_sec’
    /usr/include/linux/time.h:84: error: ‘struct timespec’ has no member named ‘tv_nsec’
    /usr/include/linux/time.h:84: error: ‘struct timespec’ has no member named ‘tv_nsec’
    /usr/include/linux/time.h:84: error: too many arguments to function ‘set_normalized_timespec’
    /usr/include/linux/time.h: In function ‘timespec_to_ns’:
    /usr/include/linux/time.h:137: error: ‘const struct timespec’ has no member named ‘tv_sec’
    /usr/include/linux/time.h:137: error: ‘const struct timespec’ has no member named ‘tv_nsec’
    /usr/include/linux/time.h: In function ‘timeval_to_ns’:
    /usr/include/linux/time.h:149: error: ‘const struct timeval’ has no member named ‘tv_sec’
    /usr/include/linux/time.h:150: error: ‘const struct timeval’ has no member named ‘tv_usec’
    /usr/include/linux/time.h: In function ‘timespec_add_ns’:
    /usr/include/linux/time.h:179: error: ‘struct timespec’ has no member named ‘tv_sec’
    /usr/include/linux/time.h:179: error: ‘struct timespec’ has no member named ‘tv_nsec’
    /usr/include/linux/time.h:180: error: ‘struct timespec’ has no member named ‘tv_nsec’
    In file included from /usr/include/linux/module.h:10,
    from Module.c:1:
    /usr/include/linux/stat.h: At top level:
    /usr/include/linux/stat.h:64: error: expected specifier-qualifier-list before ‘dev_t’
    In file included from /usr/include/linux/gfp.h:4,
    from /usr/include/linux/kmod.h:22,
    from /usr/include/linux/module.h:13,
    from Module.c:1:
    /usr/include/linux/mmzone.h:18:26: error: linux/bounds.h: No such file or directory
    In file included from /usr/include/linux/gfp.h:4,
    from /usr/include/linux/kmod.h:22,
    from /usr/include/linux/module.h:13,
    from Module.c:1:
    /usr/include/linux/mmzone.h:218: error: ‘MAX_NR_ZONES’ undeclared here (not in a function)
    In file included from /usr/include/linux/gfp.h:4,
    from /usr/include/linux/kmod.h:22,
    from /usr/include/linux/module.h:13,
    from Module.c:1:
    /usr/include/linux/mmzone.h:667: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/mmzone.h:667: error: expected declaration specifiers or ‘...’ before ‘loff_t’
    /usr/include/linux/mmzone.h:670: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/mmzone.h:670: error: expected declaration specifiers or ‘...’ before ‘loff_t’
    /usr/include/linux/mmzone.h:672: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/mmzone.h:672: error: expected declaration specifiers or ‘...’ before ‘loff_t’
    /usr/include/linux/mmzone.h:674: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/mmzone.h:674: error: expected declaration specifiers or ‘...’ before ‘loff_t’
    /usr/include/linux/mmzone.h:676: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/mmzone.h:676: error: expected declaration specifiers or ‘...’ before ‘loff_t’
    /usr/include/linux/mmzone.h:679: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/mmzone.h:679: error: expected declaration specifiers or ‘...’ before ‘loff_t’
    In file included from /usr/include/linux/kmod.h:22,
    from /usr/include/linux/module.h:13,
    from Module.c:1:
    /usr/include/linux/gfp.h:231: error: expected ‘)’ before ‘size’
    /usr/include/linux/gfp.h:232: error: expected declaration specifiers or ‘...’ before ‘size_t’
    In file included from /usr/include/linux/elf.h:7,
    from /usr/include/linux/module.h:14,
    from Module.c:1:
    /usr/include/asm/elf.h: In function ‘elf_common_init’:
    /usr/include/asm/elf.h:166: error: ‘struct pt_regs’ has no member named ‘r8’
    /usr/include/asm/elf.h:166: error: ‘struct pt_regs’ has no member named ‘r9’
    /usr/include/asm/elf.h:166: error: ‘struct pt_regs’ has no member named ‘r10’
    /usr/include/asm/elf.h:166: error: ‘struct pt_regs’ has no member named ‘r11’
    /usr/include/asm/elf.h:167: error: ‘struct pt_regs’ has no member named ‘r12’
    /usr/include/asm/elf.h:167: error: ‘struct pt_regs’ has no member named ‘r13’
    /usr/include/asm/elf.h:167: error: ‘struct pt_regs’ has no member named ‘r14’
    /usr/include/asm/elf.h:167: error: ‘struct pt_regs’ has no member named ‘r15’
    In file included from /usr/include/linux/module.h:14,
    from Module.c:1:
    /usr/include/linux/elf.h: At top level:
    /usr/include/linux/elf.h:401: error: expected declaration specifiers or ‘...’ before ‘loff_t’
    In file included from /usr/include/linux/kobject.h:21,
    from /usr/include/linux/module.h:16,
    from Module.c:1:
    /usr/include/linux/sysfs.h:30: error: expected specifier-qualifier-list before ‘mode_t’
    /usr/include/linux/sysfs.h:35: error: expected specifier-qualifier-list before ‘mode_t’
    /usr/include/linux/sysfs.h:66: error: expected specifier-qualifier-list before ‘size_t’
    /usr/include/linux/sysfs.h:77: error: expected specifier-qualifier-list before ‘ssize_t’
    /usr/include/linux/sysfs.h:159: error: expected declaration specifiers or ‘...’ before ‘mode_t’
    In file included from /usr/include/linux/module.h:16,
    from Module.c:1:
    /usr/include/linux/kobject.h:126: error: expected specifier-qualifier-list before ‘ssize_t’
    /usr/include/linux/kobject.h:221: error: expected declaration specifiers or ‘...’ before ‘size_t’
    In file included from /usr/include/linux/percpu.h:5,
    from /usr/include/asm/local.h:4,
    from /usr/include/linux/module.h:19,
    from Module.c:1:
    /usr/include/linux/slab.h:59: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/slab.h:59: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/slab.h:99: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/slab.h:100: error: expected declaration specifiers or ‘...’ before ‘size_t’
    /usr/include/linux/slab.h:102: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ksize’
    In file included from /usr/include/linux/slab.h:128,
    from /usr/include/linux/percpu.h:5,
    from /usr/include/asm/local.h:4,
    from /usr/include/linux/module.h:19,
    from Module.c:1:
    /usr/include/linux/slab_def.h:20: error: expected specifier-qualifier-list before ‘size_t’
    /usr/include/linux/slab_def.h:29: error: expected ‘)’ before ‘size’
    /usr/include/linux/slab_def.h:31: error: expected ‘)’ before ‘size’
    In file included from /usr/include/linux/percpu.h:5,
    from /usr/include/asm/local.h:4,
    from /usr/include/linux/module.h:19,
    from Module.c:1:
    /usr/include/linux/slab.h:182: error: expected ‘)’ before ‘n’
    /usr/include/linux/slab.h:200: error: expected ‘)’ before ‘size’
    /usr/include/linux/slab.h:205: error: expected ‘)’ before ‘size’
    /usr/include/linux/slab.h:275: error: expected ‘)’ before ‘size’
    /usr/include/linux/slab.h:286: error: expected ‘)’ before ‘size’
    In file included from /usr/include/asm/local.h:4,
    from /usr/include/linux/module.h:19,
    from Module.c:1:
    /usr/include/linux/percpu.h:84: error: expected ‘)’ before ‘size’
    In file included from Module.c:1:
    /usr/include/linux/module.h:49: error: expected specifier-qualifier-list before ‘ssize_t’
    gaurav@gaurav-desktop:~/Programs$

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    Could you post your Makefile or does it look similar to this:

    Code:
    obj-m += filename.o
    
    all:
    	make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
    
    clean:
    	make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

  6. #5
    Just Joined!
    Join Date
    Mar 2009
    Posts
    13

    make file

    i wrote one make file for module
    obj-m += Module.o

    all:
    make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
    clean:
    make -C /lib/modules/$(uname -r)/build M=$(pwd) clean

    and name of file is makefile
    $make
    error is
    make: Nothing to be done for `all'.

  7. #6
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    you really should call your make file Makefile or call it by using make -f makefilename...
    Plus are you certain your lines are tabbed in (not spaced in) like the one I posted...

    Also pwd should be PWD...I'm not sure if this last one matters

    The link I posted shows a good working example of a Makefile...

  8. #7
    Just Joined!
    Join Date
    Mar 2009
    Posts
    13

    Module Program successufully running

    thank you sir.
    now my program is running correctly.
    i have question that this is showing printk() function output in /var/log/messages
    can this also show in my running terminal.

  9. #8
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    Check the link I gave you, I has a section called replacing printk's. This will get you printing in the executable's terminal...Glad you got it working...

    Welcome to the forums...Gerard4143

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •