#author("2019-10-31T13:33:12+08:00","default:Admin","Admin") OpenWRT

unexpected word (expecting ")")

开发板运行一个简单的helloworld而已,却出现如下错误. unexpected word (expecting ")") 

有以下可能

  • 交叉工具链不对
  • 编译选项错误:假设工具链是 arm-linux-gcc  编译hello.c arm-linux-gcc hello.c -o hello    把hello 拷贝到你的板子上去 ./hello 试试
ald@ald888:/work/openwrt/trunk/package/sncom/src$ mipsel-openwrt-linux-gcc -c serial.c -o serial
mipsel-openwrt-linux-uclibc-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
ald@ald888:/work/openwrt/trunk/package/sncom/src$ cp serial /mnt/hgfs/share/
ald@ald888:/work/openwrt/trunk/package/sncom/src$ file serial
serial: ELF 32-bit LSB relocatable, MIPS, MIPS-I version 1 (SYSV), with unknown capability 0xf41 = 0x756e6700, with unknown capability 0x70100 = 0x3040000, not stripped

下面是正常的

ald@ald888:/work/openwrt/trunk/package/sncom/src$ mipsel-openwrt-linux-gcc serial.c -o serial
mipsel-openwrt-linux-uclibc-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
mipsel-openwrt-linux-uclibc-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
mipsel-openwrt-linux-uclibc-gcc.bin: warning: environment variable 'STAGING_DIR' not defined
ald@ald888:/work/openwrt/trunk/package/sncom/src$ ls
Makefile  serial  serial.c  serial_pc  snshm
ald@ald888:/work/openwrt/trunk/package/sncom/src$ file serial
serial: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs), with unknown capability 0xf41 = 0x756e6700, with unknown capability 0x70100 = 0x3040000, not stripped

ald@ald888:/work/openwrt/trunk/package/sncom/src$ cp serial /mnt/hgfs/share/ald@ald888:/work/openwrt/trunk/package/sncom/src$
make package/mydrv_app/compile V=99

命令生成安装包的路径

/work/openwrt/trunk/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/snsh/ipkg-ramips_24kec/snsh/usr/sbin

最终生成安装包ipk文件的路径

/work/openwrt/trunk/bin/ramips/packages/base

解决方法

在头部加分号;

/bin/ash :./helloworld permission denied.

问题:/bin/ash :./helloworld permission denied.

没有root账户就无法创建文件,如果用root就不许编译

原因:

ls -l helloworld

发现helloworld 根本没有执行权限。

解决方法: 1. arm-linux-gcc helloworld.c -o helloworld 之前是arm-linux-gcc -c helloworld.c -o helloworld
是没有执行权限的。
不加上-c,默认是编译成可执行文件,加上-c是编译为对象文件的。

因为gcc -c是编译为目标文件,-o是指定生成文件的名字。

2. chmod -x helloworld.

connect error: Connection refused

root@OpenWrt:/# snsh
[init] ser2netThread starting...
[socket] ser2netThread starting....
[socket] connect error: Connection refused

ser2net没有启动造成的



あなたのお住まいの地域で最安のブロードバンド選び

コメント:



(画像の文字列を入力して下さい)

トップ   編集 凍結 差分 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2019/12/02 (月) 12:34:59 (1627d)

G|Cg|C@Amazon Yahoo yV

z[y[W yVoC[UNLIMITȂ1~] COiq COsیI