当前位置:  技术问答>linux和unix

makefile与交叉编译环境

    来源: 互联网  发布时间:2017-05-10

    本文导语:  Makefile文件  obj=main.o buf_send.o tcp_bind.o hua_cheng.o doit_pthread.o shang_chuan.o   time_jiaodui.o changee.o    dianchi_stop.o dianchi_suspend.o dianchi_regain.o power_down_recover_or_cl  ean.o  changeIP.o alarmLed_control.o google.o time_test.o pthread_fu...

Makefile文件
 obj=main.o buf_send.o tcp_bind.o hua_cheng.o doit_pthread.o shang_chuan.o 
 time_jiaodui.o changee.o
   dianchi_stop.o dianchi_suspend.o dianchi_regain.o power_down_recover_or_cl
 ean.o
 changeIP.o alarmLed_control.o google.o time_test.o pthread_fun.o
 
 target=main
 #cc=gcc
 cc= arm-none-linux-gnueabi-
 C=-g
 LP=-lpthread
 
 $(target):$(obj)
         $(cc)gcc $(C) $(LP) $^ -o $@
 clean:
         rm -rf *.o main
make时出错:

cc    -c -o main.o main.c
cc    -c -o buf_send.o buf_send.c
cc    -c -o tcp_bind.o tcp_bind.c
cc    -c -o hua_cheng.o hua_cheng.c
cc    -c -o doit_pthread.o doit_pthread.c
doit_pthread.c: In function ‘doit_pthread’:
doit_pthread.c:100: warning: passing argument 3 of ‘pthread_create’ from incompa
tible pointer type
cc    -c -o shang_chuan.o shang_chuan.c
cc    -c -o time_jiaodui.o time_jiaodui.c
cc    -c -o changee.o changee.c
cc    -c -o dianchi_stop.o dianchi_stop.c
cc    -c -o dianchi_suspend.o dianchi_suspend.c
cc    -c -o dianchi_regain.o dianchi_regain.c
cc    -c -o power_down_recover_or_clean.o power_down_recover_or_clean.c
cc    -c -o changeIP.o changeIP.c
cc    -c -o alarmLed_control.o alarmLed_control.c
cc    -c -o google.o google.c
cc    -c -o time_test.o time_test.c
cc    -c -o pthread_fun.o pthread_fun.c
arm-none-linux-gnueabi-gcc -g -lpthread main.o buf_send.o tcp_bind.o hua_cheng.o
 doit_pthread.o shang_chuan.o time_jiaodui.o changee.o dianchi_stop.o dianchi_su
spend.o dianchi_regain.o power_down_recover_or_clean.o changeIP.o alarmLed_contr
ol.o google.o time_test.o pthread_fun.o -o main
/root/softback/arm-2007q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.0/../../../.
./arm-none-linux-gnueabi/bin/ld: main.o: Relocations in generic ELF (EM: 3)
main.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [main] E"

我没有用交叉编译是,make是没有错误的。
我单独用arm-none-linux-gnueabi-gcc 编译单个文件时也没有错误。
希望大家帮帮忙,给我指点一下迷津。
在此感谢大家了。

|
Makefile文件应该改成这样
 obj=main.o buf_send.o tcp_bind.o hua_cheng.o doit_pthread.o shang_chuan.o 
 time_jiaodui.o changee.o
  dianchi_stop.o dianchi_suspend.o dianchi_regain.o power_down_recover_or_cl
 ean.o
 changeIP.o alarmLed_control.o google.o time_test.o pthread_fun.o
  
 target=main
 #cc=gcc
 cc= arm-none-linux-gnueabi-
 C=-g
 LP=-lpthread
  
 $(target):$(obj)
  $(cc)gcc $(C) $(LP) $^ -o $@
 .c.o:
 $(cc)gcc -c $

    
 
 

您可能感兴趣的文章:

  • 从网上载了个C++程序的源代码,包含38个.cpp和.h,还有makefile.in和makefile.am两个文件,但无configure和makefile.请问怎么编译?谢谢!
  • linux下面用makefile编译的问题,请高手指点。
  • makefile 的嵌套编译问题
  • 关于多层Makefile编译的问题
  • 寻本详细讲解MAKEFILE和各编译器的书
  • 如何在Makefile中定义宏进行条件编译?
  • 自己编写一个程序编译进内核,要修改makefile文件吗?
  • 用-g编译器选项编译程序就在makefile中按下面样子的加进去吗:
  • 编译条件“-lpthread”应该加在makefile的哪里阿?
  • 急!请问大虾,如何书写UNXI下的MakeFile以编译C(调用了某些库)程序?
  • 帮帮忙啊!关于用makefile编译?
  • 驱动模块可以编入内核,想单独编译成模块,makefile怎么写?
  • 模块编译的小问题,对makefile的理解
  • 如何编写Makefile,使得只编译改变的文件
  • 有关makefile编译出错的一个问题。。。。
  • 如何在编译的时候输出Makefile中的变量值?
  • 请问编译静态链接库的makefile该如何写?
  • 如何写出兼容于BSD MAKE、GNU MAKE、SOLARIS MAKE的条件编译Makefile?
  • makefile中如何把一个子文件夹中的文件一起编译了?
  • Makefile中编译错误
  • 使用autotools生成makefile,最后一步交叉编译时make出错
  •  
    本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
    本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐
  • 如何在makefile中设置并读取环境变量
  • makefile里面环境变量LD_LIBRARY_PATH的问题
  • 各位大侠,谁知道? 如何在makefile 中得到环境变量中路径,100分相送!!!!!
  • Makefile.in,Makefile.am,Makefile.bor应该怎么用?
  • makefile.am和makefile.in是什么文件,与makefile有什么联系吗?
  • 最近在学习linux C 看到了makefile部分,觉得makefile的语法很难理解,Makefile 的语法是不是shell语法?
  • 求解makefile问题,makefile.conf的作用?
  • 有makefile.am,有 makefine.in 为什么就是没有Makefile?
  • makefile如何调用文件目录下的makefile
  • 请教根据Makefile.am自动生成Makefile的问题
  • 怎麼樣使Makefile.in生成Makefile?
  • 【急!】一个程序里有好多文件夹里都有Makefile,如何找到最管用的makefile
  • 【makefile使用】请问怎样在shell中获取makefile的最终目标?
  • unix下面make makefile文件,提示“makefile is up-to-date",怎么办呀?
  • Makefile使用遇到的问题!"Makefile:3:missing the separator.stop"在线等待.......
  • Makefile是如何输出执行的路径的,表示执行的是那个Makefile
  • 下的tar.gz源码里只有makefile.in和makefile.am
  • 一句 makefile 的解释 -- makefile 与 shel 结合
  • linux makefile error :Makefile:335: *** commands commence before first target。
  • [test@localhost ~]$ cat <makefile >catfile 跟cat > catfile <makefile是一样的吧?
  • 关于makfile,makefile.in, makefile.am. configure之间的关系
  • win32下编译Linux 下的项目(makefile.am和makefile.in)
  • 关于makefile的问题。一个makefile如何生成两个可执行文件。


  • 站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,