编译c程序生成可执行文件
user@thundersoft:~/data/work/media-ctl-97077a7$ gcc main.c options.c v4l2subdev.c mediactl.c -o media.exe
push到手机中运行提示没有这个文件或者目录
user@thundersoft:~/data/work/media-ctl-97077a7$ adb push media.exe system/bin
leaf_hill:/system/bin # media.exe
/system/bin/sh: /system/bin/media.exe: No such file or directory
网上找到原因是因为程序使用的是动态链接方式编译的,而Android和Ubuntu的链接库文件路径不同,导致找不到文件
可以用gcc -static命令改用静态链接的方式编译,执行成功。
user@thundersoft:~/data/work/media-ctl-97077a7$ gcc main.c options.c v4l2subdev.c mediactl.c -o media.exe -static
user@thundersoft:~/data/work/media-ctl-97077a7$ adb push media.exe data/misc/cameraserver
leaf_hill:/data/misc/cameraserver # ./media.exe
./media.exe [options] device
-d, --device dev Media device name (default: /dev/media0)
-e, --entity name Print the device name associated with the given entity
-V, --set-v4l2 v4l2 Comma-separated list of formats to setup
--get-v4l2 pad Print the active format on a given pad
-h, --help Show verbose help and exit
-i, --interactive Modify links interactively
-l, --links Comma-separated list of links descriptors to setup
-p, --print-topology Print the device topology
--print-dot Print the device topology as a dot graph
-r, --reset Reset all links to inactive
-v, --verbose Be verbose
参考
https://blog.csdn.net/kraken5142709/article/details/19766759