Modify

Opened 9 years ago

Closed 7 years ago

Last modified 7 years ago

#2508 closed defect (fixed)

SDK: "syntax error near unexpected token" at end of build

Reported by: b.candler@… Owned by: developers
Priority: low Milestone:
Component: other Version:
Keywords: Cc:

Description

I am running under Ubuntu 6.06.1 on i386.

First I built the SDK for 7.09 thusly:

svn co https://svn.openwrt.org/openwrt/tags/kamikaze_7.09
cd kamikaze_7.09
make menuconfig
# Leave target at Broadcom 2.4
# Select "Build the Imagebuilder"
# Select "Build the SDK"
# Select "Exit"
# Select "Yes" to save changes
make
cd ..

Then I unpacked a copy of the SDK and used it to build a couple of packages:

tar -xvjf kamikaze_7.09/bin/OpenWrt-SDK-brcm-2.4-for-Linux-i686.tar.bz2
cd OpenWrt-SDK-brcm-2.4-for-Linux-i686/package
svn co -r9260 https://svn.openwrt.org/openwrt/packages/lang/ruby
svn co -r9260 https://svn.openwrt.org/openwrt/packages/net/ntpclient
cd ..
make

(I don't think it actually matters what packages you build here)

Now, the packages build successfully, but a strange syntax error is reported at the end. This is what I see:

$ make
  make[2] -C /v/build/bgm/OpenWrt-SDK-brcm-2.4-for-Linux-i686 package/compile
  make[3] -C package compile
  make[4] -C package/ruby compile
  make[4] -C package/ntpclient compile
/bin/sh: -c: line 4: syntax error near unexpected token `('
/bin/sh: -c: line 4: `          xargs -n1 cmd() { &>/dev/null make $* || {  echo "Build failed. Please re-run make with V=99 to see what's going on"; false; } } 3>&1 4>&2; cmd compile -C; \'

If I repeat with make V=99 then I see:

$ make V=99
make package/compile
make[1]: Entering directory `/data/v/build/bgm/OpenWrt-SDK-brcm-2.4-for-Linux-i686'
make -C package compile SDK=1
make[2]: Entering directory `/data/v/build/bgm/OpenWrt-SDK-brcm-2.4-for-Linux-i686/package'
make -j1 -C ruby compile
make[3]: Entering directory `/data/v/build/bgm/OpenWrt-SDK-brcm-2.4-for-Linux-i686/package/ruby'
make[3]: `compile' is up to date.
make[3]: Leaving directory `/data/v/build/bgm/OpenWrt-SDK-brcm-2.4-for-Linux-i686/package/ruby'
make -j1 -C ntpclient compile
make[3]: Entering directory `/data/v/build/bgm/OpenWrt-SDK-brcm-2.4-for-Linux-i686/package/ntpclient'
make[3]: `compile' is up to date.
make[3]: Leaving directory `/data/v/build/bgm/OpenWrt-SDK-brcm-2.4-for-Linux-i686/package/ntpclient'
make[2]: Leaving directory `/data/v/build/bgm/OpenWrt-SDK-brcm-2.4-for-Linux-i686/package'
make[1]: Leaving directory `/data/v/build/bgm/OpenWrt-SDK-brcm-2.4-for-Linux-i686'
( \
                cd package; \
                find . -maxdepth 2 -name Config.in | \
                        sed -e 's,/Config.in,,g' | \
                        xargs -n1 make compile -C; \
        )
make: option requires an argument -- C
Usage: make [options] [target] ...
Options:
  -b, -m Ignored for compatibility.
  -B, --always-make Unconditionally make all targets.
  -C DIRECTORY, --directory=DIRECTORY
                              Change to DIRECTORY before doing anything.
  -d Print lots of debugging information.
  --debug[=FLAGS] Print various types of debugging information.
  -e, --environment-overrides
                              Environment variables override makefiles.
  -f FILE, --file=FILE, --makefile=FILE↵
                              Read FILE as a makefile.↵
  -h, --help Print this message and exit.
  -i, --ignore-errors Ignore errors from commands.
  -I DIRECTORY, --include-dir=DIRECTORY
                              Search DIRECTORY for included makefiles.
  -j [N], --jobs[=N] Allow N jobs at once; infinite jobs with no arg.
  -k, --keep-going Keep going when some targets can't be made.
  -l [N], --load-average[=N], --max-load[=N]
                              Don't start multiple jobs unless load is below N.
  -L, --check-symlink-times Use the latest mtime between symlinks and target.
  -n, --just-print, --dry-run, --recon
                              Don't actually run any commands; just print them.
  -o FILE, --old-file=FILE, --assume-old=FILE
                              Consider FILE to be very old and don't remake it.
  -p, --print-data-base Print make's internal database.
  -q, --question Run no commands; exit status says if up to date.
  -r, --no-builtin-rules Disable the built-in implicit rules.
  -R, --no-builtin-variables Disable the built-in variable settings.
  -s, --silent, --quiet Don't echo commands.
  -S, --no-keep-going, --stop
                              Turns off -k.
  -t, --touch Touch targets instead of remaking them.
  -v, --version Print the version number of make and exit.
  -w, --print-directory Print the current directory.
  --no-print-directory Turn off -w, even if it was turned on implicitly.
  -W FILE, --what-if=FILE, --new-file=FILE, --assume-new=FILE
                              Consider FILE to be infinitely new.
  --warn-undefined-variables Warn when an undefined variable is referenced.

This program built for i486-pc-linux-gnu
Report bugs to <bug-make@gnu.org>
make: [world] Error 123 (ignored)

This suggests that make -C is being run without any arguments, so I tried adding -r to xargs, and now all is OK for V=99:

$ make V=99 make package/compile
make[1]: Entering directory `/data/v/build/bgm/OpenWrt-SDK-brcm-2.4-for-Linux-i686'
make -C package compile SDK=1
make[2]: Entering directory `/data/v/build/bgm/OpenWrt-SDK-brcm-2.4-for-Linux-i686/package'
make -j1 -C ruby compile
make[3]: Entering directory `/data/v/build/bgm/OpenWrt-SDK-brcm-2.4-for-Linux-i686/package/ruby'
make[3]: `compile' is up to date.
make[3]: Leaving directory `/data/v/build/bgm/OpenWrt-SDK-brcm-2.4-for-Linux-i686/package/ruby'
make -j1 -C ntpclient compile
make[3]: Entering directory `/data/v/build/bgm/OpenWrt-SDK-brcm-2.4-for-Linux-i686/package/ntpclient'
make[3]: `compile' is up to date.
make[3]: Leaving directory `/data/v/build/bgm/OpenWrt-SDK-brcm-2.4-for-Linux-i686/package/ntpclient'
make[2]: Leaving directory `/data/v/build/bgm/OpenWrt-SDK-brcm-2.4-for-Linux-i686/package'
make[1]: Leaving directory `/data/v/build/bgm/OpenWrt-SDK-brcm-2.4-for-Linux-i686'
( \
                cd package; \
                find . -maxdepth 2 -name Config.in | \
                        sed -e 's,/Config.in,,g' | \
                        xargs -r -n1 make compile -C; \
        )
$ echo $?
0
$

But it doesn't fix the case of "make" without "V=99":

$ make
  make[2] -C /v/build/bgm/OpenWrt-SDK-brcm-2.4-for-Linux-i686 package/compile
  make[3] -C package compile
  make[4] -C package/ruby compile
  make[4] -C package/ntpclient compile
/bin/sh: -c: line 4: syntax error near unexpected token `('
/bin/sh: -c: line 4: `          xargs -r -n1 cmd() { &>/dev/null make $* || {  echo "Build failed. Please re-run make with V=99 to see what's going on"; false; } } 3>&1 4>&2; cmd compile -C; \'
$ grep compile Makefile
        $(MAKE) package/compile
                        xargs -r -n1 $(MAKE) compile -C; \

It looks like $(MAKE) has expanded into something which it shouldn't have?

Since this doesn't actually prevent packages from being built this is a relatively low priority problem, but it is rather confusing.

Attachments (0)

Change History (4)

comment:1 in reply to: ↑ description Changed 9 years ago by anonymous

This patch corrects the problem :

Index: target/sdk/files/Makefile
===================================================================
--- target/sdk/files/Makefile~
+++ target/sdk/files/Makefile
@@ -74,9 +74,9 @@
 	$(MAKE) package/compile
 	-( \
 		cd package; \
-		find . -maxdepth 2 -name Config.in | \
-			sed -e 's,/Config.in,,g' | \
-			xargs -n1 $(MAKE) compile -C; \
+		for configfile in `find . -maxdepth 2 -name Config.in` ; do \
+			$(MAKE) compile -C `dirname $$configfile` ; \
+		done \
 	)
 
 clean: FORCE

comment:2 Changed 9 years ago by anonymous

This is salimsaay,
i have a problem with SDK, i want to cross compile the Openssl from linux fedora to Wrt54gl lunksys router, but when i run the make i see this error:
[salimsaay@salims OpenWrt-SDK-Linux-i686-1]$ make
make package/compile
make[1]: Entering directory `/home/salimsaay/OpenWrt-SDK-Linux-i686-1'
make -C package compile SDK=1
make[2]: Entering directory `/home/salimsaay/OpenWrt-SDK-Linux-i686-1/package'
make[4] -C package compile-targets
Build failed. Please re-run make with V=99 to see what's going on
make[2]: * [compile] Error 1
make[2]: Leaving directory `/home/salimsaay/OpenWrt-SDK-Linux-i686-1/package'
make[1]:
* [package/compile] Error 2
make[1]: Leaving directory `/home/salimsaay/OpenWrt-SDK-Linux-i686-1'
make: * [world] Error 2
[salimsaay@salims OpenWrt-SDK-Linux-i686-1]$

is some one to help me

comment:3 Changed 7 years ago by nico

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [9692]

comment:4 Changed 7 years ago by sudhakar45_sai@…

sir,

where is build failed error in mac os for example...

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.