| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2075 人关注过本帖
标题:my first Linux kernel code with some problems in Makefile maybe...
取消只看楼主 加入收藏
蚕头燕尾
Rank: 10Rank: 10Rank: 10
来 自:Gryffindo
等 级:贵宾
威 望:12
帖 子:734
专家分:1546
注 册:2013-3-24
结帖率:96.08%
收藏
已结贴  问题点数:20 回复次数:5 
my first Linux kernel code with some problems in Makefile maybe...
sorry for writing this in English, Because there are no Sougou in my Linux....
-----------------------------------------------------------------------------
Ok, this is my first try to write some kernel code, and definitely, I have meat some trouble.

There is the source code "hello.c":
#include <linux/module.h>
#if defined(CONFIG_SMP)
#define __SMP__
#endif
#if defined(CONFIG_MODVERSIONS)
#define MODVERSIONS
#include <linux/modversions.h>
#endif
#include <linux/kernel.h>
int init_module(void)
{
    printk(KERN_DEBUG "Hello, kernel!\n");
    return 0;
}
void cleanup_module(void)
{
    printk(KERN_DEBUG "Good-bye, kernel!\n");
}
---------------------------------------------------
There is the Makefile:
# standards
INCLUDE        = /usr/src/linux/include
CC         = gcc
CFLAGS         = -D__KERNEL__ -I$(INCLUDE) -DMODULE -Wall -O2
TARGET    = hello
SRC    = hello.c
all: $(TARGET).o
    gcc $(SRC) -c $(TAEGET).o
clean:
    rm -f *.o *~ core
---------------------------------------------------
when I run "make" from the terminal, it present like this:
gcc -D__KERNEL__ -I/usr/src/linux/include -DMODULE -Wall -O2   -c -o hello.o hello.c
hello.c:4:26: fatal error: linux/module.h: No such file or directory
compilation terminated.
make: *** [hello.o] Error 1
---------------------------------------------------
I have search this Error from Internet, but unfortunately, I still don't know why...
I'm looking for you help now...
Please type with Chinese directly, I can certainly understand what you will say.

Thank you for your time.
搜索更多相关主题的帖子: problems Because English include writing 
2014-12-24 07:25
蚕头燕尾
Rank: 10Rank: 10Rank: 10
来 自:Gryffindo
等 级:贵宾
威 望:12
帖 子:734
专家分:1546
注 册:2013-3-24
收藏
得分:0 
回复 3楼 azzbcc
12.04~
____________

what a pity! I failed to install sogou to my Linux~

学习编程,为的是表达自己的思想,而不是被别人的思想所禁锢。要先明白自己想干嘛,而不要先问别人让你干嘛。               

                                                                                                                    Black Cat      Hello Tomorrow~
2014-12-24 09:52
蚕头燕尾
Rank: 10Rank: 10Rank: 10
来 自:Gryffindo
等 级:贵宾
威 望:12
帖 子:734
专家分:1546
注 册:2013-3-24
收藏
得分:0 
回复 2楼 rjsp
When I first see the compile message, I got the same mind with you.
But when I opened the
"usr/src/linux/include", I got shocked!
There are still 6 dir!
The name of this 6 dir are:
linux-headers-3.2.0-23
linux-headers-3.2.0-23-generic
linux-headers-3.2.0-24
linux-headers-3.2.0-24-generic
linux-headers-3.2.0-74
linux-headers-3.2.0-74-generic
-----------
I expect there should be only one dir named "linux", but why there are so many of them!
a little bit strange!
======================
So I think there must be some mistakes in my codes.

学习编程,为的是表达自己的思想,而不是被别人的思想所禁锢。要先明白自己想干嘛,而不要先问别人让你干嘛。               

                                                                                                                    Black Cat      Hello Tomorrow~
2014-12-24 10:06
蚕头燕尾
Rank: 10Rank: 10Rank: 10
来 自:Gryffindo
等 级:贵宾
威 望:12
帖 子:734
专家分:1546
注 册:2013-3-24
收藏
得分:0 
回复 6楼 azzbcc
I have downloaded this before, but I still filled to install it, it's complicated...
but, still, thank you~

学习编程,为的是表达自己的思想,而不是被别人的思想所禁锢。要先明白自己想干嘛,而不要先问别人让你干嘛。               

                                                                                                                    Black Cat      Hello Tomorrow~
2014-12-24 11:10
蚕头燕尾
Rank: 10Rank: 10Rank: 10
来 自:Gryffindo
等 级:贵宾
威 望:12
帖 子:734
专家分:1546
注 册:2013-3-24
收藏
得分:0 
回复 6楼 azzbcc
sudo dpkg -i sogou_pinyin_linux_1.1.0.0037_i386.deb
[sudo] password for bliss:
Selecting previously unselected package sogoupinyin:i386.
(Reading database ... 203381 files and directories currently installed.)
Unpacking sogoupinyin:i386 (from sogou_pinyin_linux_1.1.0.0037_i386.deb) ...
dpkg: dependency problems prevent configuration of sogoupinyin:i386:
 sogoupinyin:i386 depends on fcitx (>= 1:4.2.8.3-3~).
 sogoupinyin:i386 depends on fcitx-bin.
 sogoupinyin:i386 depends on fcitx-modules.
 sogoupinyin:i386 depends on fonts-droid.
 sogoupinyin:i386 depends on unzip.
 sogoupinyin:i386 depends on fcitx-libs (>= 4.2.7).
 sogoupinyin:i386 depends on fcitx-libs-qt (>= 4.2.7).
 sogoupinyin:i386 depends on libc6 (>= 2.8).
 sogoupinyin:i386 depends on libgcc1 (>= 1:4.1.1).
 sogoupinyin:i386 depends on libidn11 (>= 1.13).
 sogoupinyin:i386 depends on libopencc1 (>= 0.1.0).
 sogoupinyin:i386 depends on libqt4-dbus (>= 4:4.8.0).
 sogoupinyin:i386 depends on libqt4-declarative (>= 4:4.8.0).
 sogoupinyin:i386 depends on libqt4-network (>= 4:4.8.0).
 sogoupinyin:i386 depends on libqtcore4 (>= 4:4.8.0).
 sogoupinyin:i386 depends on libqtgui4 (>= 4:4.8.0).
 sogoupinyin:i386 depends on libstdc++6 (>= 4.1.1).
 sogoupinyin:i386 depends on zlib1g (>= 1:1.2.0).
dpkg: error processing sogoupinyin:i386 (--install):
 dependency problems - leaving unconfigured
Processing triggers for hicolor-icon-theme ...
Processing triggers for desktop-file-utils ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for gnome-menus ...
Processing triggers for libglib2.0-0 ...
Processing triggers for shared-mime-info ...
Unknown media type in type 'all/all'
Unknown media type in type 'all/allfiles'
Unknown media type in type 'uri/mms'
Unknown media type in type 'uri/mmst'
Unknown media type in type 'uri/mmsu'
Unknown media type in type 'uri/pnm'
Unknown media type in type 'uri/rtspt'
Unknown media type in type 'uri/rtspu'
Errors were encountered while processing:
 sogoupinyin:i386
------------------------------------------------------>>>>>for azzbcc


学习编程,为的是表达自己的思想,而不是被别人的思想所禁锢。要先明白自己想干嘛,而不要先问别人让你干嘛。               

                                                                                                                    Black Cat      Hello Tomorrow~
2014-12-24 14:49
蚕头燕尾
Rank: 10Rank: 10Rank: 10
来 自:Gryffindo
等 级:贵宾
威 望:12
帖 子:734
专家分:1546
注 册:2013-3-24
收藏
得分:0 
1.
sudo apt-get install fcitx fcitx-bin ...
----------------------------------------------
There are some parts of the results after running this code:
----------------------------------
zabbix-server-pgsql : Conflicts: zabbix-proxy-mysql but 1:1.8.11-1 is to be installed
                       Conflicts: zabbix-proxy-pgsql but 1:1.8.11-1 is to be installed
                       Conflicts: zabbix-proxy-sqlite3 but 1:1.8.11-1 is to be installed
                       Conflicts: zabbix-server-mysql but 1:1.8.11-1 is to be installed
 zentyal-common : Conflicts: sudo-ldap but 1.8.3p1-1ubuntu3.6 is to be installed
 zephyr-server : Conflicts: zephyr-server-krb5 but 3.0.1-1 is to be installed
 zephyr-server-krb5 : Conflicts: zephyr-server
 zope-quotafolder : Depends: zope3 but it is not installable or
                             zope2.10 but it is not installable or
                             zope2.9 but it is not installable or
                             zope2.8 but it is not installable or
                             zope2.7 but it is not installable or
                             zope2.6 but it is not installable
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
==================================================================================================
2.
sudo dpkg -P sogoupinyin:i386
----------------------------------------------------
There are some parts of the results after running this code:
------------------------
(Reading database ... 203789 files and directories currently installed.)
Removing sogoupinyin:i386 ...
Purging configuration files for sogoupinyin:i386 ...
Processing triggers for shared-mime-info ...
Unknown media type in type 'all/all'
Unknown media type in type 'all/allfiles'
Unknown media type in type 'uri/mms'
Unknown media type in type 'uri/mmst'
Unknown media type in type 'uri/mmsu'
Unknown media type in type 'uri/pnm'
Unknown media type in type 'uri/rtspt'
Unknown media type in type 'uri/rtspu'
Processing triggers for libglib2.0-0 ...
Processing triggers for desktop-file-utils ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for gnome-menus ...
Processing triggers for hicolor-icon-theme ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
============================================================
Then what should I do?

----------------------------------->>>>>for azzbcc


学习编程,为的是表达自己的思想,而不是被别人的思想所禁锢。要先明白自己想干嘛,而不要先问别人让你干嘛。               

                                                                                                                    Black Cat      Hello Tomorrow~
2014-12-24 19:12
快速回复:my first Linux kernel code with some problems in Makefile maybe.. ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012751 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved