under cygwin, zsh cannot run when built against ncurses9-5.7-13

Peter A. Castro doctor@fruitbat.org
Sat Mar 21 09:40:00 GMT 2009


On Tue, 17 Mar 2009, Dave Korn wrote:

Hi Dave!

> Peter A. Castro wrote:
>
>>   The offending symbol entries are the following (functions)
>>   tgetent
>>   tgetflag
>>   tgetnum
>>   tgetstr
>>   tgoto
>>   tputs
>>   pow      (but this is not an unresolve symbol, see below)
>>
>> 'pow' is not an unresolve symbol in this mess, but it is lumped into the
>> chunk with the bad symbols.
>>
>> libzsh-4.3.9.dll is
>
> ... peculiarly named with no 'cyg' prefix.  I suspect something may have gone
> bad in the libtoolification or whatever other procedure zsh uses to build this
> dll.

True, the name does not fit the "current" naming convention for cygwin
DLLs, but it doesn't really matter too much, since this particular DLL is
private to zsh (it's really the core of zsh, which zsh.exe loads
implicitly).  Since its an "internal" (to zsh) DLL and not useable by any
other program I felt it was exempt from the naming "rules".  Is there a
strong technical reason to rename it?  If so, I will do so.

BTW, good catch on the import libs being bad.  It's nice to know it's
*not my fault, man!* :-)

>> the one who needs these symbols, but the import list
>> is wrong:
>
>> And, here's the imports from compiling/linking with libncurses-9 (bad):
>
>>  0009e03c       0009e398 00000000 00000000 0009f374 0009e6d0
>>
>>         DLL Name: cygwin1.dll
>>         vma:  Hint/Ord Member-Name Bound-To
>>         9f010    1285  pow
>>         9f018     468  tgetent
>>         9f024     469  tgetflag
>>         9f030     470  tgetnum
>>         9f03c     471  tgetstr
>>         9f048     472  tgoto
>>         9f050     480  tputs
>>
>>  0009e050       0009e39c 00000000 00000000 0009f39c 0009e6d4
>>
>>         DLL Name: cygncurses-9.dll
>>         vma:  Hint/Ord Member-Name Bound-To
>>         9f018     468  tgetent
>>         9f024     469  tgetflag
>>         9f030     470  tgetnum
>>         9f03c     471  tgetstr
>>         9f048     472  tgoto
>>         9f050     480  tputs
>>
>> It appears to trying to import the symbols twice.
>
>  While it is not unusual to see multiple imports for the same symbols
> (auto-import works by generating loads of mini-pseudo-IATs scattered through
> the .text section at addresses coinciding with instruction operand fields that
> need relocating), it's very wrong to see them listed under the wrong DLL name.
>
>  BTW, I've now tried this with both old and latest CVS binutils, and it makes
> no difference.
>
>> I've checked the import libs for both 5.5-3 (good) 5.7-13 (bad) and they
>> don't appear to have anything funny about them.  libncurses.a and
>> libncurses.dll.a both appear to have the correct exports.  There's no
>> difference in how zsh is compiled between ncurses 8 & 9.
>>
>> Could this really be a linker problem?
>
>  I don't know why exactly it's the problem yet, but I know a solution:
>
> Here's the command from my build log that links libzsh dll:
>
> i686-pc-cygwin-gcc  -s -shared -Wl,--export-all-symbols -o libzsh-4.3.9.dll
> `cat stamp-modobjs` -lgdbm -L/usr/lib -lpcre -liconv -ldl -lncurses -lm  -lc
>
>
>  I re-ran it with -v and got the following actual commandline passed to the
> linker:
>
> /usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../i686-pc-cygwin/bin/ld --shared
> -Bdynamic -e __cygwin_dll_entry@12 --enable-auto-image-base
> --dll-search-prefix=cyg -o libzsh-4.3.9.dll -s
> /usr/lib/gcc/i686-pc-cygwin/4.3.2/crtbegin.o -L/usr/lib
> -L/usr/lib/gcc/i686-pc-cygwin/4.3.2 -L/usr/lib/gcc/i686-pc-cygwin/4.3.2
> -L/usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../i686-pc-cygwin/lib
> -L/usr/lib/gcc/i686-pc-cygwin/4.3.2/../../.. --export-all-symbols builtin.o
> compat.o cond.o exec.o glob.o hashtable.o hist.o init.o input.o jobs.o lex.o
> linklist.o loop.o math.o mem.o module.o options.o params.o parse.o pattern.o
> prompt.o signals.o signames.o sort.o string.o subst.o text.o utils.o watch.o
> -lgdbm -lpcre -liconv -ldl -lncurses -lm -lc -v -lgcc_s -lcygwin -luser32
> -lkernel32 -ladvapi32 -lshell32 -lgcc_s /usr/lib/gcc/i686-pc-cygwin/4.3.2/crtend.o
>
>
>  Anyway, I found that removing "-lm -lc" from the options fixes the build
> problem, and that it makes no difference what version of ld you use.  Remove
> those two -l options and you get a good DLL, leave them in and you get a bad
> one.  I don't know yet what effect these options have that does the damage,
> but will look later.
>
>  I then ran make install which went smoothly, and invoked zsh:
>
> This is the Z Shell configuration function for new users,
> zsh-newuser-install.
> You are seeing this message because you have no zsh startup files
> (the files .zshenv, .zprofile, .zshrc, .zlogin in the directory
> ~).  This function can help you with a few settings that should
> make your use of the shell easier.
>
> You can:
>
> (q)  Quit and do nothing.  The function will be run again next time.
>
> (0)  Exit, creating the file ~/.zshrc containing just a comment.
>     That will prevent this function being run again.
>
> (1)  Continue to the main menu.
>
> --- Type one of the keys in parentheses ---
>
>
>  So I conclude it's more or less working.  I do however get this warning:
>
> $ zsh
> zsh: failed to load module `zsh/zle': No such process
> $P$G
>
>  Also I tried a test suite run.  It got some way before one of the testcases
> appeared to hang and I killed it:
>
>
> cd Test ; make check
> make[1]: Entering directory `/usr/src/zsh2/zsh-4.3.9/.build/Test'
> if test -n "i686-pc-cygwin-gcc"; then \
> 	  cd .. && DESTDIR= \
> 	  make MODDIR=`pwd`/Test/Modules install.modules > /dev/null; \
> 	fi
> /usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../i686-pc-cygwin/bin/ld: warning:
> auto-importing has been activated without --enable-auto-import specified on
> the command line.
> This should work unless it involves constant data structures referencing
> symbols from auto-imported
> DLLs./usr/lib/gcc/i686-pc-cygwin/4.3.2/../../../../i686-pc-cygwin/bin/ld:
> warning: auto-importing has been activated without --enable-auto-import
> specified on the command line.
> This should work unless it involves constant data structures referencing
> symbols from auto-imported DLLs.if ZTST_testlist="`for f in
> /usr/src/zsh2/zsh-4.3.9/Test/*.ztst; \
>           do echo $f; done`" \
> 	 ZTST_srcdir="/usr/src/zsh2/zsh-4.3.9/Test" \
> 	 ZTST_exe=../Src/zsh.exe \
> 	 ../Src/zsh.exe +Z -f /usr/src/zsh2/zsh-4.3.9/Test/runtests.zsh; then \
> 	 stat=0; \
> 	else \
> 	 stat=1; \
> 	fi; \
> 	rm -rf Modules .zcompdump; \
> 	exit $stat
> /usr/src/zsh2/zsh-4.3.9/Test/A01grammar.ztst: starting.
> This test hangs the shell when it fails...
> /usr/src/zsh2/zsh-4.3.9/Test/A01grammar.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/A02alias.ztst: starting.
> /usr/src/zsh2/zsh-4.3.9/Test/A02alias.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/A03quoting.ztst: starting.
> /usr/src/zsh2/zsh-4.3.9/Test/A03quoting.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/A04redirect.ztst: starting.
> /usr/src/zsh2/zsh-4.3.9/Test/A04redirect.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/A05execution.ztst: starting.
> /usr/src/zsh2/zsh-4.3.9/Test/A05execution.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/A06assign.ztst: starting.
> /usr/src/zsh2/zsh-4.3.9/Test/A06assign.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/A07control.ztst: starting.
> /usr/src/zsh2/zsh-4.3.9/Test/A07control.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/B01cd.ztst: starting.
> /usr/src/zsh2/zsh-4.3.9/Test/B01cd.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/B02typeset.ztst: starting.
> /usr/src/zsh2/zsh-4.3.9/Test/B02typeset.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/B03print.ztst: starting.
> /usr/src/zsh2/zsh-4.3.9/Test/B03print.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/B04read.ztst: starting.
> /usr/src/zsh2/zsh-4.3.9/Test/B04read.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/B05eval.ztst: starting.
> /usr/src/zsh2/zsh-4.3.9/Test/B05eval.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/B06fc.ztst: starting.
> /usr/src/zsh2/zsh-4.3.9/Test/B06fc.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/C01arith.ztst: starting.
> /usr/src/zsh2/zsh-4.3.9/Test/C01arith.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/C02cond.ztst: starting.
> Warning: Not testing [[ -b blockdevice ]] (no devices found)
> Warning: Not testing [[ -f blockdevice ]] (no devices found)
> Test /usr/src/zsh2/zsh-4.3.9/Test/C02cond.ztst failed: bad status 1, expected
> 0 from:
>  if (( EUID == 0 )); then
>    print -u$ZTST_fd 'Warning: Not testing [[ ! -r file ]] (root reads anything)'
>    [[ -r zerolength && -r unmodish ]]
>  else
>    [[ -r zerolength && ! -r unmodish ]]
>  fi
> Was testing: -r cond
> /usr/src/zsh2/zsh-4.3.9/Test/C02cond.ztst: test failed.
> /usr/src/zsh2/zsh-4.3.9/Test/C03traps.ztst: starting.
> This test takes at least three seconds...
> This test, too, takes at least three seconds...
> Another test that takes three seconds
> /usr/src/zsh2/zsh-4.3.9/Test/C03traps.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/C04funcdef.ztst: starting.
> /usr/src/zsh2/zsh-4.3.9/Test/C04funcdef.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/C05debug.ztst: starting.
> /usr/src/zsh2/zsh-4.3.9/Test/C05debug.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/D01prompt.ztst: starting.
> /usr/src/zsh2/zsh-4.3.9/Test/D01prompt.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/D02glob.ztst: starting.
> /usr/src/zsh2/zsh-4.3.9/Test/D02glob.ztst: all tests successful.
> /usr/src/zsh2/zsh-4.3.9/Test/D03procsubst.ztst: starting.
>
>
>  I'm now going to try building it again, from scratch, but with the LDFLAGS
> edited to a) remove "-lm -lc" and b) add "-Wl,--enable-auto-import".  Let's
> see if that improves things any.
>
>    cheers,
>      DaveK
>
>
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:       http://cygwin.com/problems.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
>

-- 
Peter A. Castro <doctor@fruitbat.org> or <Peter.Castro@oracle.com>
 	"Cats are just autistic Dogs" -- Dr. Tony Attwood

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list