编译c文件无法运行
我的ubunu上已经安装了交叉编译环境root@forlinx:/mnt/android_kk4.4.2_1.0.0# arm-fsl-linux-gnueabi-g
arm-fsl-linux-gnueabi-g++ arm-fsl-linux-gnueabi-gcc-4.6.2arm-fsl-linux-gnueabi-gdb arm-fsl-linux-gnueabi-gprof
arm-fsl-linux-gnueabi-gcc arm-fsl-linux-gnueabi-gcov arm-fsl-linux-gnueabi-gdbtui
然后我把\test.rar\test\cmd\watchdog.c文件编译
用arm-fsl-linux-gnueabi-gcc -o wtd_test watchdog.c
然后把生成的wtd_test 放到开发板上执行
root@sabresd_6dq:/system # ls
ls
app
bin
build.prop
etc
fonts
framework
lib
lost+found
media
priv-app
wtd_test
usr
vendor
xbin
root@sabresd_6dq:/system # ./wtd_test
./test
/system/bin/sh: ./wtd_test: No such file or directory
执行错误,而我已经给了可执行权限了
127|root@sabresd_6dq:/system # ls -l
ls -l
drwxr-xr-x root root 2016-09-26 08:41 app
drwxr-xr-x root shell 2016-09-20 09:22 bin
-rw-r--r-- root root 1744 2016-01-23 16:28 build.pr
drwxr-xr-x root root 2016-09-30 14:40 etc
drwxr-xr-x root root 2016-01-23 17:27 fonts
drwxr-xr-x root root 2016-01-23 18:21 framewor
drwxr-xr-x root root 2016-09-22 16:56 lib
drwx------ root root 1970-01-01 08:00 lost+fou
drwxr-xr-x root root 2016-01-23 16:55 media
drwxr-xr-x root root 2016-01-23 18:18 priv-app
-rwxrwxrwx root root 6288 2017-11-28 18:30 wtd_test
drwxr-xr-x root root 2016-01-23 17:00 usr
drwxr-xr-x root shell 2016-01-23 18:11 vendor
drwxr-xr-x root shell 2016-01-23 18:12 xbin
所以请教一下我的编译指令是否有问题,谢谢。我是adb push进开发板的
我已经编译好安卓源码了,所以ubuntu编译没有问题 验证文件和系统版本
这是我在ubuntu下执行的命令
root@forlinx:/mnt/android_kk4.4.2_1.0.0/kernel_imx/drivers/watchdog# uname -a
Linux forlinx 3.5.0-23-generic #35~precise1-Ubuntu SMP Fri Jan 25 17:13:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
root@forlinx:/mnt/android_kk4.4.2_1.0.0/kernel_imx/drivers/watchdog# file ./matt
./matt: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.31, not stripped
下面是在开发板
127|root@sabresd_6dq:/ # busybox uname -a
Linux localhost 3.0.35-g1cedc95-dirty #20 SMP PREEMPT Tue Nov 28 16:58:14 CST 2017 armv7l GNU/Linux arm-fsl-linux-gnueabi-gcc编译的时候加-static试试 ,开发板可能是缺少动态库 您好:
您的命令没什么问题,感觉问题出现在您的程序上,您先测试一个简单的打印hello world的程序,看是否能正常输出 结贴,请参考http://blog.csdn.net/u013308744/article/details/71600913
页:
[1]