Discussion:
[ast-developers] grep and xargs fail to build in "package test"
Terrence J. Doyle
2014-12-28 12:38:44 UTC
Permalink
When I run "package test" for ast-open-2014-09-29, I still see a
couple of places where
test programs won't link because of undefined symbols:

$ package test

.
.
.

cmd/kshlib/cmdtst:
+ cc -O2 -D_BLD_DLL -KPIC -I/usr/include
-I/usr/lib/gcc/powerpc-apple-darwin9/4.2.1/include -I- -I.
-I/Source/AST/2014-09-29/arch/darwin.ppc/include/ast
'-DERROR_CATALOG="kshcmdtst"' -D_PACKAGE_ast
'-DUSAGE_LICENSE="[-author?Glenn Fowler
<***@gmail.com>][-author?Doug McIlroy
<***@research.bell-labs.com>][-copyright?Copyright (c) 1995-2014
AT&T Intellectual
Property][-license?http://www.eclipse.org/org/documents/epl-v10.html][--catalog?kshcmdtst]"'
-c /Source/AST/2014-09-29/src/cmd/kshlib/cmdtst/grep.c
cc1: note: obsolete option -I- used, please use -iquote instead
+ cc -O2 -KPIC -L/Source/AST/2014-09-29/arch/darwin.ppc/lib -o grep
grep.o -last -liconv
ld warning: option -m is obsolete and being ignored
Undefined symbols:
"_main", referenced from:
start in crt1.10.5.o
"__cmd_init", referenced from:
_grep in grep.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make [cmd/kshlib/cmdtst]: *** exit code 1 making grep
+ cc -O2 -D_BLD_DLL -KPIC -I/usr/include
-I/usr/lib/gcc/powerpc-apple-darwin9/4.2.1/include -I- -I.
-I/Source/AST/2014-09-29/arch/darwin.ppc/include/ast
'-DERROR_CATALOG="kshcmdtst"' -D_PACKAGE_ast
'-DUSAGE_LICENSE="[-author?Glenn Fowler
<***@gmail.com>][-author?Doug McIlroy
<***@research.bell-labs.com>][-copyright?Copyright (c) 1995-2014
AT&T Intellectual
Property][-license?http://www.eclipse.org/org/documents/epl-v10.html][--catalog?kshcmdtst]"'
-c /Source/AST/2014-09-29/src/cmd/kshlib/cmdtst/xargs.c
cc1: note: obsolete option -I- used, please use -iquote instead
+ cc -O2 -KPIC -L/Source/AST/2014-09-29/arch/darwin.ppc/lib -o xargs
xargs.o -last -liconv
ld warning: option -m is obsolete and being ignored
Undefined symbols:
"_main", referenced from:
start in crt1.10.5.o
"__cmd_init", referenced from:
_b_xargs in xargs.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make [cmd/kshlib/cmdtst]: *** exit code 1 making xargs
make [cmd/kshlib/cmdtst]: *** 2 actions failed
make: *** exit code 1 making cmd/kshlib/cmdtst

.
.
.


The test suite is trying to build grep and xargs as standalone
executables. This can be done with grep by compiling with -DSTANDALONE,
but there's no way to do this with xargs. What's more, both need to be
linked with -lcmd to define __cmd_init.

But, then I see where "package make" has already built grep.o and
xargs.o and put them in libkshcmdtst:

$ package make

.
.
.

cmd/kshlib/cmdtst:
+ 1> 1.5413754141.h
+ cat
+ 0<< \!
/*
* -lcmdtst function list -- define your own CMDLIST()
*/
!
+ sort -u
+ sed -e '/^b_[a-z_][a-z_0-9]*(/!d' -e s/^b_// -e 's/(.*//' -e
's/.*/CMDLIST(&)/'
/Source/AST/2014-09-29/src/cmd/kshlib/cmdtst/lib.c
/Source/AST/2014-09-29/src/cmd/kshlib/cmdtst/grep.c
/Source/AST/2014-09-29/src/cmd/kshlib/cmdtst/xargs.c
+ cmp -s 1.5413754141.h cmdtstlist.h
+ mv 1.5413754141.h cmdtstlist.h
+ cc -O2 -D_BLD_DLL -KPIC -I. -I/usr/include
-I/usr/lib/gcc/powerpc-apple-darwin9/4.2.1/include -I- -I.
-I/Source/AST/2014-09-29/arch/darwin.ppc/include/ast -D_PACKAGE_ast
-c /Source/AST/2014-09-29/src/cmd/kshlib/cmdtst/lib.c
cc1: note: obsolete option -I- used, please use -iquote instead
+ cc -O2 -D_BLD_DLL -KPIC -I/usr/include
-I/usr/lib/gcc/powerpc-apple-darwin9/4.2.1/include -I- -I.
-I/Source/AST/2014-09-29/arch/darwin.ppc/include/ast
'-DERROR_CATALOG="kshcmdtst"' -D_PACKAGE_ast
'-DUSAGE_LICENSE="[-author?Glenn Fowler
<***@gmail.com>][-author?Doug McIlroy
<***@research.bell-labs.com>][-copyright?Copyright (c) 1995-2014
AT&T Intellectual
Property][-license?http://www.eclipse.org/org/documents/epl-v10.html][--catalog?kshcmdtst]"'
-c /Source/AST/2014-09-29/src/cmd/kshlib/cmdtst/grep.c
cc1: note: obsolete option -I- used, please use -iquote instead
+ cc -O2 -D_BLD_DLL -KPIC -I/usr/include
-I/usr/lib/gcc/powerpc-apple-darwin9/4.2.1/include -I- -I.
-I/Source/AST/2014-09-29/arch/darwin.ppc/include/ast
'-DERROR_CATALOG="kshcmdtst"' -D_PACKAGE_ast
'-DUSAGE_LICENSE="[-author?Glenn Fowler
<***@gmail.com>][-author?Doug McIlroy
<***@research.bell-labs.com>][-copyright?Copyright (c) 1995-2014
AT&T Intellectual
Property][-license?http://www.eclipse.org/org/documents/epl-v10.html][--catalog?kshcmdtst]"'
-c /Source/AST/2014-09-29/src/cmd/kshlib/cmdtst/xargs.c
cc1: note: obsolete option -I- used, please use -iquote instead
+ /usr/bin/ar r libkshcmdtst.a lib.o grep.o xargs.o
ar: creating archive libkshcmdtst.a
+ ignore ranlib libkshcmdtst.a
+ rm -f lib.o grep.o xargs.o
+ : generate libkshcmdtst.a export symbols in _kshcmdtst_.c
+ cc -O2 -D_BLD_DLL -KPIC -I- -c _kshcmdtst_.c
cc1: note: obsolete option -I- used, please use -iquote instead
+ /Source/AST/2014-09-29/arch/darwin.ppc/bin/cc
-L/Source/AST/2014-09-29/arch/darwin.ppc/lib -G -o
libcmdtst.dylib.0.0 _kshcmdtst_.o libkshcmdtst.a -lcmd -lutil -last
-liconv -lm -lc

.
.
.


Should the test suite be trying to rebuild what's already been
built? If so, shouldn't it be applying the same compile and link options
and libraries?

Terrence Doyle

Loading...