Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#33 undefined symbol update_process on mips-sni-sysv4

open
nobody
None
5
2013-01-25
2005-08-18
Bodo
No

I tried making zsh-4.2.5 on this system

$ uname -a
SINIX-N rm200 5.43 C4001 RM400 1/32 R4000

$ gcc --version
2.7.2.3

The make stops with this error:

gcc -s -Wl,-Blargedynsym -o zsh main.o `cat
stamp-modobjs` -lsocket -ldl -lnsl -ltermcap -lm -lc
collect2: ld returned 1 exit status
Undefined first referenced
symbol in file
update_process signals.o
ld: zsh: fatal error: Symbol referencing errors. No
output written to zsh

There are different preprocessor conditions around the
definition and use of function update_process().

jobs.c:

#ifndef HAVE_GETRUSAGE
void
update_process(Process pn, int status)
{
...
}
#endif

signals.c:

#if defined(HAVE_WAIT3) && defined(HAVE_GETRUSAGE)
...
#else
update_process(pn, status);
#endif

HAVE_WAIT3 is not defined, HAVE_GETRUSAGE is.

According to the man pages, getrusage is available with
the standard compiler, wait3 only with "usr/ucb/cc".
(/usr/ucb/cc is a wrapper script around /usr/ccs/bin/cc
or /usr/bin/cc that specifies some -L, -l and -I options.)

I tried the same with CC=cc but I cannot use this
compiler (/usr/bin/cc=/usr/ccs/bin/cc=/usr/ic/bin/cc)
because of missing licence/key:

configure:2194: checking for C compiler default output
file name
configure:2197: cc conftest.c >&5
[fatal]: 2310 C-IC licence/key information
missing 20
[error]: 9025 cc : frontend error while
compiling file 'conftest.c'

I changed the condition in jobs.c to
#if ! defined(HAVE_WAIT3) || ! defined(HAVE_GETRUSAGE)
which produces this error:

jobs.c: In function `update_process':
jobs.c:284: `shtms' undeclared (first use this function)
jobs.c:291: structure has no member named `st'
jobs.c:292: structure has no member named `ut'

Then I changed the condition in signals.c to
#if defined(HAVE_GETRUSAGE)
which produces this error:

signals.c: In function `zhandler':
signals.c:518: `ru' undeclared (first use this function)

Next I changed signals.c and jobs.c back to the
original version and calles configure with LIBS="-lucb"
LDFLAGS="-L/usr/ucblib/libbg -L/usr/ucblib" similar to
the wrapper script /usr/ucb/cc. With this change it
finds wait3.

zsh configuration
-----------------
zsh version : 4.2.5
host operating system : mips-sni-sysv4
source code location : .
compiler : gcc
preprocessor flags :
executable compiler flags : -Wall -Wmissing-prototypes -O2
module compiler flags : -Wall -Wmissing-prototypes
-O2 -fPIC
executable linker flags : -L/usr/ucblib/libbg
-L/usr/ucblib -Wl,-Blargedynsym
module linker flags : -L/usr/ucblib/libbg
-L/usr/ucblib -G
library flags : -lsocket -ldl -lnsl
-ltermcap -lm -lucb -lc
installation basename : zsh
binary install path : /usr/local/bin
man page install path : /usr/local/man
info install path : /usr/local/info
functions install path :
/usr/local/share/zsh/4.2.5/functions

With this change signals.o no longer references
update_process().

make and make install are successful and the shell can
be started, but filename globbing does not work.

rm200%mei ~> ls
Makefile gdb-5.0 setpasswd test.c
cvs out setpasswd.c zsh-4.2.5
rm200%mei ~> echo *.c
st.c tpasswd.c
rm200%mei ~> echo **/*.c
st.c tpasswd.c
(There are lots of .c files in subdirectories.)

I did not check for other problems.
I don't know if that's related to the use of the BSD
compatibility libs.

Bodo

Discussion

  • Bodo
    Bodo
    2005-08-18

    Logged In: YES
    user_id=832927

    make check produces a lot of errors:

    ./A01grammar.ztst: test failed.
    ./A04redirect.ztst: test failed.
    ./A05execution.ztst: test failed.
    ./B01cd.ztst: test failed.
    ./B02typeset.ztst: test failed.
    ./B03print.ztst: test failed.
    ./C02cond.ztst: starting.
    Warning: Not testing [[ -b blockdevice ]] (no devices found)
    Warning: Not testing [[ -f blockdevice ]] (no devices found)
    Warning: Not testing [[ -p pipe ]] (FIFOs not supported)
    Warning: not testing [[ -e /dev/fd/0 ]] (/dev/fd not supported)
    Warning: not testing [[ -O /dev/fd/0 ]] (/dev/fd not supported)
    ./C02cond.ztst: all tests successful.
    ./C03traps.ztst: test failed.
    ./D01prompt.ztst: test failed.
    ./D02glob.ztst: test failed.
    ./D04parameter.ztst: test failed.
    ./D05array.ztst: test failed.
    ./E01options.ztst: test failed.
    ./V01zmodload.ztst: test failed.
    ./V02zregexparse.ztst: starting.
    Illegal Instruction - core dumped
    ./Y01completion.ztst: test failed.
    ./Y02compmatch.ztst: test failed.
    ./Y03arguments.ztst: test failed.

    I can provide more details if necessary.

    Bodo

     
  • Wayne Davison
    Wayne Davison
    2006-03-25

    Logged In: YES
    user_id=35204

    I believe that my attached patch will fix the build problem
    when getrusage() is available, but wait3() is not.

     
  • Bodo
    Bodo
    2006-03-27

    Logged In: YES
    user_id=832927

    Hello Wayne,

    thank you for your help.

    I tried your patch with version 4.2.5 and get these
    compilation errors:

    gcc -c -I. -DHAVE_CONFIG_H -Wall -Wmissing-prototypes -O2
    -o jobs.o jobs.c
    In file included from system.h:114,
    from zsh.mdh:15,
    from jobs.c:30:
    /usr/local/lib/gcc-lib/mips-sni-sysv4/2.7.2.3/include/setjmp.h:18:
    warning: `__mips__' redefined
    *Initialization*:1: warning: this is the location of the
    previous definition
    jobs.c: In function `update_process':
    jobs.c:285: incompatible types in assignment
    jobs.c:286: incompatible types in assignment
    jobs.c:297: structure has no member named `st'
    jobs.c:297: invalid operands to binary -
    jobs.c:298: structure has no member named `ut'
    jobs.c:298: invalid operands to binary -
    jobs.c: In function `bin_fg':
    jobs.c:1800: warning: int format, pid_t arg (arg 3)
    jobs.c:1804: warning: int format, pid_t arg (arg 3)
    jobs.c:1808: warning: int format, pid_t arg (arg 3)
    jobs.c:1812: warning: int format, pid_t arg (arg 3)
    gmake[2]: *** [jobs.o] Error 1

    The incompatible types in lines 285/286 and 297/298 are long
    and struct timeval and the wrong struct fields in lines
    297/298 are because with HAVE_GETRUSAGE pn->ti is struct
    rusage, not struct timeinfo.

    The use of struct timeval makes the subtraction a bit more
    difficult.

    I tried to make the necessary changes. Please check my
    attached patch which includes your changes.

    Now I can successfully compile zsh-2.4.5.
    I did not try version 2.4.6 or the development version.

    make check still produces some errors:

    ./A04redirect.ztst: starting.
    ##
    Test ./A04redirect.ztst failed: output differs from expected
    as shown above for:
    foo=bar
    cat <<' HERE'
    $foo
    HERE
    eval "$(print 'cat <<HERE\n$foo\nHERE')"
    Was testing: Here-documents
    ./A04redirect.ztst: test failed.

    ./B02typeset.ztst: starting.
    #####
    Test ./B02typeset.ztst failed: output differs from expected
    as shown above for:
    typeset -f
    Was testing: Equivalence of functions and typeset -f
    ./B02typeset.ztst: test failed.

    ./B03print.ztst: starting.
    ######
    Test ./B03print.ztst failed: output differs from expected as
    shown above for:
    printf '%x\n' $(printf '"\xf0')
    Was testing: numeric value of high numbered character
    ./B03print.ztst: test failed.

    ./D01prompt.ztst: starting.
    ###
    Test ./D01prompt.ztst failed: output differs from expected
    as shown above for:
    LC_ALL=C
    date1=$(print -P %w)
    date2=$(print -P %W)
    date3=$(print -P %D)
    if [[ $date1 != [A-Z][a-z][a-z][[:blank:]]##[0-9]## ]]; then
    print "Date \`$date1' is not in the form \`Day DD' (e.g.
    \`Mon 1'"
    fi
    if [[ $date2 != [0-9][0-9]/[0-9][0-9]/[0-9][0-9] ]]; then
    print "Date \`$date2' is not in the form \`DD/MM/YYYY'"
    fi
    if [[ $date3 != [0-9][0-9]-[0-9][0-9]-[0-9][0-9] ]]; then
    print "Date \`$date3' is not in the form \`YY-MM-DD'"
    fi
    if (( $date1[5,-1] != $date2[4,5] )) || (( $date2[4,5] !=
    $date3[7,8] ))
    then
    print "Days of month do not agree in $date1, $date2, $date3"
    fi
    if (( $date2[1,2] != $date3[4,5] )); then
    print "Months do not agree in $date2, $date3"
    fi
    if (( $date2[7,8] != $date3[1,2] )); then
    print "Years do not agree in $date2, $date3"
    fi
    Error output:
    (eval):14: bad math expression: operand expected at `!= '
    (eval):18: bad math expression: operand expected at `!= '
    (eval):21: bad math expression: operand expected at `!= '
    Was testing: Dates produced by prompt escapes
    ./D01prompt.ztst: test failed.

    The print -p * output is correct but the tests fail

    ./D02glob.ztst: starting.
    Test ./D02glob.ztst failed: bad status 1, expected 0 from:
    ( regress_absolute_path_and_core_dump )
    Was testing: exclusions regression test
    ./D02glob.ztst: test failed.

    ./D04parameter.ztst: starting.
    #########
    Test ./D04parameter.ztst failed: output differs from
    expected as shown above for:
    print -l "${$(print one word)}" "${=$(print two words)}"
    Was testing: splitting of $(...) inside ${...}
    ./D04parameter.ztst: test failed.

    ./E01options.ztst: starting.
    ########
    Test ./E01options.ztst failed: output differs from expected
    as shown above for:
    setopt NO_equals
    print -n trick; print =cat
    setopt equals
    print -n trick; print =cat
    Was testing: EQUALS option
    ./E01options.ztst: test failed.

    ./V01zmodload.ztst: starting.
    ######
    Test ./V01zmodload.ztst failed: error output differs from
    expected as shown above for:
    mods[(r)zsh/main]=()
    zmodunload $mods
    zmodload zsh/parameter
    Was testing: Unload the modules loaded by this test suite
    ./V01zmodload.ztst: test failed.

    All other test up to
    ./V03mathfunc.ztst
    are successful.

    make check seems to hang at
    ./Y01completion.ztst: starting.

    The installed zsh seems to be usable. Probably I did not
    (yet) use some of the broken features.

    Bodo

     
  • Bodo
    Bodo
    2006-03-27

    new patch for missing update_process() function

     
  • Wayne Davison
    Wayne Davison
    2006-03-27

    Logged In: YES
    user_id=35204

    We can make use of the dtime() function to compute the time
    differences. My updated patch is attached. Thanks for your
    help.

     
  • Wayne Davison
    Wayne Davison
    2006-03-27

    My version of the corrected patch

     
  • Bodo
    Bodo
    2006-03-27

    Logged In: YES
    user_id=832927

    I just tried your patch update_process-fix3.diff. The result
    is the same as with my version.
    For now I can work with this zsh.

    Can you give me some hints how to fix the failed checks?

    Bodo