mips 平台执行程序报错./test: line 1: syntax error: unexpected "("

m漫漫的大米饭 2017-06-20 09:24:08
在ubantu上用mips-linux-gnu-gcc 交叉编译的程序 在板端执行报错如下:
./test: line 1: syntax error: unexpected "("
...全文
1404 11 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
我已经查看了板子上的其他库 确定了是小端 ,现在新的问题是调用muclibc库出了问题 一些库函数如“sincos”、“exp2”等调用不到,正先办法解决呢
jklinux 2017-06-22
  • 打赏
  • 举报
回复
引用 9 楼 qq_36576657 的回复:
找到原因了 libavutil.so.55.58.100: ELF 32-bit MSB shared object, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, stripped 我编译生成的为MSB 板端为LSB 现在正想办法编译成LSB呢
这个应与你用的编译器有关,如果你的系统是大端的话,编成MSB是对的。除非你的系统是小端, 才需要编成LSB. 当然一般都是小端,除了路由器这类的网络设备才是大端。
  • 打赏
  • 举报
回复
找到原因了 libavutil.so.55.58.100: ELF 32-bit MSB shared object, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, stripped 我编译生成的为MSB 板端为LSB 现在正想办法编译成LSB呢
  • 打赏
  • 举报
回复
用file 看了 库了 架构没错啊
jklinux 2017-06-21
  • 打赏
  • 举报
回复
引用 6 楼 jklinux 的回复:
[quote=引用 5 楼 qq_36576657 的回复:] 普通程序 编译加上-EL 在板端可以执行, 但链接ffmpeg动态库编译就报错“e/lib/libswscale.so: could not read symbols: File in wrong format” 用file看了库: /lib/libswscale.so.4.6.100: ELF 32-bit MSB shared object, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, stripped 实在没办法了
那有可能是ffmpeg 的动态库没有交叉编译好[/quote] 也可以用file命令查看那些动态库
jklinux 2017-06-21
  • 打赏
  • 举报
回复
引用 5 楼 qq_36576657 的回复:
普通程序 编译加上-EL 在板端可以执行, 但链接ffmpeg动态库编译就报错“e/lib/libswscale.so: could not read symbols: File in wrong format” 用file看了库: /lib/libswscale.so.4.6.100: ELF 32-bit MSB shared object, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, stripped 实在没办法了
那有可能是ffmpeg 的动态库没有交叉编译好
  • 打赏
  • 举报
回复
普通程序 编译加上-EL 在板端可以执行, 但链接ffmpeg动态库编译就报错“e/lib/libswscale.so: could not read symbols: File in wrong format” 用file看了库: /lib/libswscale.so.4.6.100: ELF 32-bit MSB shared object, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, stripped 实在没办法了
  • 打赏
  • 举报
回复
用file看了 是mips架构没问题
  • 打赏
  • 举报
回复
make clean NDK=/home/hc/FFmpeg/ffmpeg-3.3.2 TOOLCHAIN=/home/hc/Downloads/mips-4.3 PREFIX=$(pwd)/../ffmpeg-shared_release function build_one { ./configure \ --prefix=$PREFIX \ --enable-shared \ --disable-debug \ --disable-static \ --disable-doc \ --enable-ffmpeg \ --enable-ffplay \ --enable-ffprobe \ --enable-ffserver \ --enable-gpl \ --enable-pic \ --enable-nonfree \ --disable-doc \ --disable-inline-asm \ --disable-symver \ --disable-mipsdspr2\ --disable-mipsfpu \ --disable-mips32r2 \ --cross-prefix=$TOOLCHAIN/bin/mips-linux-gnu- \ --target-os=linux \ --arch=mips \ --sysroot=/mnt/hgfs/share/Flax_4351_376_963/os_linux/toolchain/uclibc/ \ --enable-cross-compile \ --extra-cflags="-EL -march=mips32 -mips32 -mhard-float " \ $ADDITIONAL_CONFIGURE_FLAG } build_one make sudo make install cd ..
jklinux 2017-06-20
  • 打赏
  • 举报
回复
引用 楼主 qq_36576657 的回复:
在ubantu上用mips-linux-gnu-gcc 交叉编译的程序 在板端执行报错如下: ./test: line 1: syntax error: unexpected "("
这种问题极有可能是没有交叉编译好哦, 建议在pc端编译好后用file命令确定编出来的是什么架构的,是不是与板子端一致. 根据提供的信息应编出来的是mips上的系统上执行的,但如在arm上执行也会报错的
LubinLew 2017-06-20
  • 打赏
  • 举报
回复
是shell脚本报错吗,把脚本贴出来

23,216

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧