编译3.10内核 出现错误 “undefined reference to...." 解决方法
向内核中加入C文件后。假设想编译进内核须要改动当前文件夹下的Kconfig文件和Makefile文件。
如:加入一个test.c文件到driver文件夹下,则须要改动Kconfig文件:
config MY_TEST
tristate "MY_TEST file "
depends on I2C
---help---
This is test file about kernel
相同改动Makefile加入一行:
obj-$(CONFIG_MY_TEST) += test.o
这样运行make menuconfig 能够看到MY_TEST file这一行,有三种状态:编译进内核,编译成模块,或者不编译。
曾经一直以为Kconfig文件改动没有限制,今天编译内核时。没有注意加入位子,随便找了个地方将新文件的配置选项加入进去,编译的时候报错例如以下:
clk-composite.c:(.text+0x22f25c): undefined reference to `foreground_sdc_select'
clk-composite.c:(.text+0x22f274): undefined reference to `bg_overlay_sdc_select'
drivers/built-in.o: In function `stop_preview':
clk-composite.c:(.text+0x22f2e4): undefined reference to `foreground_sdc_deselect'
clk-composite.c:(.text+0x22f2f0): undefined reference to `bg_overlay_sdc_deselect'
drivers/built-in.o: In function `mxc_v4l_open':
clk-composite.c:(.text+0x22ff28): undefined reference to `csi_enc_select'
clk-composite.c:(.text+0x22ff54): undefined reference to `prp_enc_select'
经过网行一番查找,得知典型的undefined reference错误,由于在链接时发现找不到某个函数的实现文件。或者说编译顺序有错误。
也就是该c文件调用了其它地方的函数,可是在调用的文件之前编译了。可定找不到将要调用的函数,所以报错了。
详解见:http://www.educity.cn/linux/1241992.html
所以在Kconfig中加入代码须要讲究位子,最好加入在代码功能相近的文件附近。
编译3.10内核 出现错误 “undefined reference to...." 解决方法的更多相关文章
- "undefined reference to" 问题解决方法
近期在Linux下编程发现一个诡异的现象,就是在链接一个静态库的时候总是报错,类似以下这种错误: (.text+0x13): undefined reference to `func' 关于undef ...
- cocos2dx添加新的类后出现错误undefined reference to的解决办法
使用cocos compile -p android编译cocos2dx项目的时候出现如下错误(新建了TestScene.h,TestScene.cpp): jni/../../Classes/App ...
- eclipse中编译出现错误undefined reference to `_sbrk'
1. 在eclipse中使用gcc-arm-none-eabi-7-2017-q4-major-win32编译代码的时候出现了undefined reference to `_sbrk' e:/pro ...
- 错误 undefined reference to __cxa_guard_acquire/release
用gcc编译 c++ 程序时,出现错误 undefined reference to __cxa_guard_acquire linker error, 但是用icc可以正常编译, 问题出在stati ...
- [转载]解决linux 下多线程错误 undefined reference to `sem_init'
转自:https://blog.csdn.net/yzycqu/article/details/7396498?utm_source=copy 解决linux 下多线程错误 undefined ref ...
- 解决错误---undefined reference to `pthread_create‘
今天试着敲了一下APUE的小例子,遇到了个错误 ----- undefined reference to `pthread_create.(为自己这么晚接触多线程惭愧). 上网上查了一下,借人经验. ...
- MySQL主从失败 错误Got fatal error 1236解决方法
--MySQL主从失败 错误Got fatal error 1236解决方法 ----------------------------------------------------2014/05/1 ...
- Sublime2编译Python程序EOFError:EOF when reading a line解决方法【转】
在Sublime2中编译运行Python文件时,如果代码中包含用户输入的函数时(eg. raw_input()),Ctrl+b编译运行之后会提示以下错误: 解决方法:安装SublimeREPL打开Su ...
- http://localhost/certsrv 错误找不到页面解决方法
http://localhost/certsrv 错误找不到页面解决方法 最近公司需要后台启动安全证书,可安装了“Active Directory证书服务” 后,http://localhost/ce ...
随机推荐
- js版本下拉菜单
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- Python3网络爬虫(三):urllib.error异常
运行平台:Windows Python版本:Python3.x IDE:Sublime text3 转载请注明作者和出处:http://blog.csdn.net/c406495762/article ...
- 解决ul的li横向排列换行的问题
1. 问题现象 先看下面的html结构: <div> <ul> <li><img src='./img/1.jpg'></li> <l ...
- HDU-1528/1962 Card Game Cheater
两组牌中两张牌相比能赢的就连,后求最大匹配. #include <cmath> #include <cstdlib> #include <cstdio> #incl ...
- Resource 定位、BeanDefinition 的载入和解析,BeanDefinition 注册。
在前文提过,IOC 容器的初始化过程分为三步骤:Resource 定位.BeanDefinition 的载入和解析,BeanDefinition 注册. Resource 定位.我们一般用外部资源来描 ...
- POJ3928 Ping pong
Time Limit: 1000MS Memory Limit: 65536KB 64bit IO Format: %lld & %llu Description N(3<= ...
- static变量的生命周期
static生命周期 2011-07-15 16:01 静态变量的类型说明符是static.静态变量当然是属于静态存储方式,但是属于静态存储方式的量不一定就是静态变量,例如外部变量虽属于静态存储方式, ...
- sqlite 使用
'''SQLite数据库是一款非常小巧的嵌入式开源数据库软件,也就是说 没有独立的维护进程,所有的维护都来自于程序本身. 在python中,使用sqlite3创建数据库的连接,当我们指定的数据库文件不 ...
- Scrapy学习-11-Selector对象使用
Selector使用 使用背景 我需要使用类似spider项目中,response使用的xpath和css获取页面指定数据,但因为爬取页面较小我们不想创建一个spider项目时,就可以使用scrapy ...
- jquery小技巧:使用jquery.confirm和PNotify实现弹出提示和消息提示
在从UIKIT前端换到BOOSTRAP前端时,一些转换的技巧. https://myclabs.github.io/jquery.confirm/ http://sciactive.github.io ...