To: ginac-list@ginac.de Subject: ginsh.exe undefined references [related to: 1) stdio.h and crtdll.dll, and 2) undef. ref. from within libreadline.a] I have been working on building CLN and GiNaC for about two months now. It took me about two weeks to build CLN by running make for two or three hours at a time with occasional interventions for inspections and modifications. I have been having much more trouble with building GiNaC. ./configure takes a great deal of time to run; so I prefer to modify makefiles and adjust an alias that sets up environment variables. In order not to get confused about the many files with identical names, I keep libraries and include files in their original hierarchies, but I use several -I and -L directory flags; with this approach, occasionally a "#include" in one system header will include a header from a different package rather from the intended sibling header. (By the way, there needs to be a way to tell the preprocessor to prefer sibling headers of the invoking header rather than to always follow a fixed ordering in the search for headers.) Because of the potential for unintended includes I also have a special header directory listed first in order to explicitly "alias" specific headers when necessary using absolute pathnames. Because of using multiple header packages, this process requires very careful and painstaking manual checking to be sure appropriate headers are included; of course, I can't possibly check all such possible conflicts, but it seems reasonable to check those that seem to be a likely cause of error messages (usually via searching for significant embedded strings related to the error messages. (Similar considerations probably apply to library directories as well.) There needs to be a way to make life much simpler in this regard; if anyone knows of some excellent ways to organized multiple directories for headers (and for libraries), please let me know. It would also be nice, for example, to have a program that systematically investigates, categorizes (e.g., as a define, a prototype, a reference, or other, etc.), and perhaps even provides a dependency tree (or other graph?) for specified strings, even if the strings are "mangled" so that they are hidden from programs like window find or grep. Incidentally, the cygwin grep I have does recursive searching into subdirectories only when I specify * (all files) as the filename; if I try to limit the search to source files or header files, grep searches only the current directory; a fix for this problem would also be handy. One side-effect of my approach to organization is the prevalence of long pathnames. So I apologize in advance for having so many of them that they lengthen this message considerably. 1) Undefined references related to stdio.h and crtdll.dll: The first undefined reference is to "__imp__iob", which is apparently declared as an external in stdio.h; apparently (from comments in stdio.h) it is used for dynamic linking to 'crtdll.dll'. It seems to me that libtool and the linker do not know how to set up ginsh.exe for dynamic linking, and insist on doing static linking only via the linker. But a test compile & link using gcc to compile and link a simple C++ program that includes stdio.h and executes printf does work as expected, and Windows find finds a "__imp__iob" in the resulting executable but not in the object module. 2) The other undefined references are apparently from within various object modules in "libreadline.a'. There are lots of them. I've included only a few in the sample make output below. Incidentally, ./configure did not succeed with the final of about four libreadline tests. So I made manual modifications to config.h for libreadline (and a few other parameters). I have inserted a ${STARTFILE} at the end of the command line for linking 'ginsh.exe'; STARTFILE is defined as an environment variable--see setgccparms alias below. I have also played with changing "build_libtool_libs=no" in libtool to "build_libtool_libs=yes", but that doesn't seem to make any difference. And I have also tried using the -export-dynamic flag on the libtool command line, but libtool either objects that the flag is not valid or seems to completely ignore it altogether, depending or where in the command line I put it. I am using a cygwin/bash overlay (downloaded and installed from a nasa web site) on a Windows 98 SE platform; libreadline.a is a part of the cygwin package. CLN is version 1.1.5; GiNaC is version 1.0.9. The readline version is apparently 4.3. The bash version is 2.05b. The build requirement in cygwin's libreadline readme file lists "gcc-2.95.3-5 or newer"; so that may be a problem. I'm using gcc 2.95.2; I have a copy of the gcc 3.2 source package, which is horrendous in size. I'm trying to be very conservative about not building any more packages than I have to; package expansions and builds eat up disk space very quickly and they tend to require horrendous amounts of my time. I'm trying to keep my work portable -- on a notebook often powered from a 12v deep-cycle auxiliary lead-acid battery. When Intel finally comes out with its super-high-speed, very-low-power-consuming CPU for economical notebooks, I may then splurge and start building software packages more freely. The version tab page on the cygwin1.dll properties page says: File version: 1.3.12-cygwin-1-3-12-1 Description: Cygwin POSIX Emulation DLL API version: 0.54 BuildDate: 2002-07-06 02:16 Company Name: Red Hat Internal Name: cygwin1.dll Product Version: same as for "File version" SharedMemoryVersion: 3 I have also attempted to build libreadline from scratch, but found horrendous problems with that approach. (The fact that libreadline seems to be processed (for ginsh.exe) as far as finding undefined references in it, provides some hope that I won't have to build libreadline.) Can anyone help resolve these problems? Reference information: ********* *********** First, a snapshot of my "setgccparms" alias for setting some environment variables. *** ******* **** *********** ********* alias 'setgccparms= export CC="c:/gcc/bin/gcc" export CXX=c:/gcc/bin/c++ export CFLAGS="-g -O2" export CXXFLAGS="-g -O2" export LIBS="-lstdc++ -lmingw32 -lcln" # LIBS for linking ginsh.exe -- subject to experimental additions -- export LIBSGINSH="-lcygwin -lreadline -lhistory ${LIBS}" # standard CPPFLAGS -- includes no cygwin system headers -- export CPPFLAGS="-DDO_GINAC_ASSERT -Ic:/cygwin/home/Default/include -Ic:/gcc/include/g++-3 -Ic:/gcc/mingw32/include -Ic:/gnu/gcc_downloads--2002-08-18/mingw32-980701-4_zip/include -Ic:/gnu/source_pkgs_only/cln-1_1_5_tar_gz/cln-1.1.5/install/include" # Generic value for overriding in make files -- export CPPFLGEN="${CPPFLAGS}" # cygwin system include is last -- preferred approach if this works # allows cygwin dependence but least so export CPPFCYG="${CPPFLAGS} -Ic:/cygwin/usr/include" # cygwin system include is second -- # prefers cygwin headers to all other system headers -- export CPPFGINSH="-DDO_GINAC_ASSERT -Ic:/cygwin/home/Default/include -Ic:/cygwin/usr/include -Ic:/gcc/include/g++-3 -Ic:/gcc/mingw32/include -Ic:/gnu/gcc_downloads--2002-08-18/mingw32-980701-4_zip/include -Ic:/gnu/source_pkgs_only/cln-1_1_5_tar_gz/cln-1.1.5/install/include" # value for LDFLAGS when making libraries export LDFLIB="-s -Lc:/cygwin/home/Default/lib -Lc:/gcc/lib/gcc-lib/mingw32/2.95.2 -Lc:/gnu/mingw-20001225-1_tar_gz/usr/lib/mingw -Lc:/gnu/gcc-2.95.2-20001116_zip/lib -Lc:/gnu/gcc_downloads--2002-08-18/mingw32-980701-4_zip/lib -Lc:/gnu/gcc_downloads--2002-08-18/win32api-980701-4_zip/lib -Lc:/gnu/gcc_downloads--2002-08-18/egcs-1.1.1_zip/lib/gcc-lib/i386-mingw32/egcs-2.91.60 -Lc:/gnu/source_pkgs_only/cln-1_1_5_tar_gz/cln-1.1.5/install/lib" # standard LDFLAGS for executables export LDFEXE="${LDFLIB} -nostartfiles c:/gnu/mingw-20001225-1_tar_gz/usr/lib/mingw/crt2.o" # Default LDFLAGS for general use -- export LDFLAGS="${LDFEXE}" # Something to concatenate with LDFLAGS for linking ginsh -- export LDFCYGAD="-Lc:/cygwin/lib" # Something to add to link command lines for executables export STARTFILE="-nostartfiles c:/gnu/mingw-20001225-1_tar_gz/usr/lib/mingw/crt2.o"' Second, a part of the make output ****** **** ****** (For readability, a blank line is inserted between command lines and processing output. Note that rather than rerun CLN's ./configure (Ugh!) I manually placed the CLN libraries where I wanted them; so the location does not agree with 'cln-config', but presumably libtool found them anyway. Note that some 'newlines' have been re-edited for readability.) C:/cygwin/bin/sh.exe ../libtool --mode=link c:/gcc/bin/c++ -g -O2 -ggdb -Wall -pedantic -s -Lc:/cygwin/home/Default/lib -Lc:/gcc/lib/gcc-lib/mingw32/2.95.2 -Lc:/gnu/mingw-20001225-1_tar_gz/usr/lib/mingw -Lc:/gnu/gcc-2.95.2-20001116_zip/lib -Lc:/gnu/gcc_downloads--2002-08-18/mingw32-980701-4_zip/lib -Lc:/gnu/gcc_downloads--2002-08-18/win32api-980701-4_zip/lib -Lc:/gnu/gcc_downloads--2002-08-18/egcs-1.1.1_zip/lib/gcc-lib/i386-mingw32/egcs-2.91.60 -Lc:/gnu/source_pkgs_only/cln-1_1_5_tar_gz/cln-1.1.5/install/lib -Lc:/cygwin/lib -o ginsh.exe ginsh_parser.o ginsh_lexer.o ../ginac/libginac.la -lstdc++ -lmingw32 -lcln -lcygwin -lreadline -lhistory -lstdc++ -lmingw32 -lcln -nostartfiles c:/gnu/mingw-20001225-1_tar_gz/usr/lib/mingw/crt2.o libtool: link: warning: library `c:/gnu/source_pkgs_only/cln-1_1_5_tar_gz/cln-1.1.5/install/lib/libcln.la' was moved. libtool: link: warning: library `c:/gnu/source_pkgs_only/cln-1_1_5_tar_gz/cln-1.1.5/install/lib/libcln.la' was moved. c:/gcc/bin/c++ -g -O2 -ggdb -Wall -pedantic -s -o ginsh.exe ginsh_parser.o ginsh_lexer.o -nostartfiles c:/gnu/mingw-20001225-1_tar_gz/usr/lib/mingw/crt2.o -Lc:/cygwin/home/Default/lib -Lc:/gcc/lib/gcc-lib/mingw32/2.95.2 -Lc:/gnu/mingw-20001225-1_tar_gz/usr/lib/mingw -Lc:/gnu/gcc-2.95.2-20001116_zip/lib -Lc:/gnu/gcc_downloads--2002-08-18/mingw32-980701-4_zip/lib -Lc:/gnu/gcc_downloads--2002-08-18/win32api-980701-4_zip/lib -Lc:/gnu/gcc_downloads--2002-08-18/egcs-1.1.1_zip/lib/gcc-lib/i386-mingw32/egcs-2.91.60 -Lc:/gnu/source_pkgs_only/cln-1_1_5_tar_gz/cln-1.1.5/install/lib -Lc:/cygwin/lib ../ginac/.libs/libginac.a -Lc:/gnu/source_pkgs_only/cln-1_1_5_tar_gz/cln-1.1.5/lib -lcln -lcygwin -lreadline -lhistory -lmingw32 c:/gnu/source_pkgs_only/cln-1_1_5_tar_gz/cln-1.1.5/install/lib/libcln.a -L/home/Default/lib -Lc:/gnu/gcc-2.95.2-20001116_zip/lib/gcc-lib/mingw32/2.95.2 -lstdc++ ../ginac/.libs/libginac.a(input_lexer.o): In function `ginac_yylex(void)': //c/gnu/source_pkgs_only/GiNaC-1.0.9.tar_bz2/GiNaC-1.0.9/ginac/lex.yy.c:690: undefined reference to `__imp__iob' //c/gnu/source_pkgs_only/GiNaC-1.0.9.tar_bz2/GiNaC-1.0.9/ginac/lex.yy.c:693: undefined reference to `__imp__iob' ../ginac/.libs/libginac.a(input_lexer.o): In function `yy_fatal_error(char const *)': //c/gnu/source_pkgs_only/GiNaC-1.0.9.tar_bz2/GiNaC-1.0.9/ginac/lex.yy.c:1644: undefined reference to `__imp__iob' c:/cygwin/lib\libreadline.a(readline.o)(.text+0x391):readline.c: undefined reference to `sigprocmask' c:/cygwin/lib\libreadline.a(readline.o)(.text+0x39e):readline.c: undefined reference to `setjmp' c:/cygwin/lib\libreadline.a(readline.o)(.text+0x670):readline.c: undefined reference to `_imp___ctype_' c:/cygwin/lib\libreadline.a(complete.o)(.text+0x218):complete.c: undefined reference to `lstat' === segment of output deleted === c:/cygwin/lib\libreadline.a(util.o)(.text+0x46d):util.c: undefined reference to `_imp___ctype_' c:/cygwin/lib\libreadline.a(tilde.o)(.text+0x756):tilde.c: undefined reference to `getpwnam' c:/cygwin/lib\libreadline.a(tilde.o)(.text+0x83b):tilde.c: undefined reference to `endpwent' c:/cygwin/lib\libreadline.a(parens.o)(.text+0x199):parens.c: undefined reference to `select' c:\GCC\BIN\make.exe: *** [ginsh.exe] Error 1 Richard Haney __________________________________________________ Do you Yahoo!? Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/