This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project. See the Cygwin home page for more information.
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Cygwin newbie, first try


"Schaible, Joerg" <Joerg.Schaible@gft.de> writes:
> Hello,
> 
> our development environment contains several applications and DLL's build
> with several compilers under Windows and OS/2. I wanna port this environment
> for a version with cygwin / mingw32 i.e. I don't wanna use the cygwin.dll,
> but the crtdll.dll or msvcrt.dll. To build the system we use a huge number
> of makefiles with individual settings for each compiler package. For
> compilation I use c++ for C++ files and gcc for C files. For linkage I use
> ld. I've installed the cygwin package and the mingw32 available from Mumit
> Khan's home page.
> 
> Currently I try to build one of our little command line tools.
> 
> All the C++ files were compiled using the following options:
> c++ -D_CONSOLE -c -fno-for-scope -frepo -mpentium -D_GwOS_WIN -D_GwGUI_WIN
> -DWIN32 -D_WIN32 -D__WIN32__ -W -Wreturn-type -Wunused -Wwrite-strings
> -Wconversion -Wmissing-prototypes -Woverloaded-virtual -DWINNT -DSTANDALONE
> -I../../core/win -I../../dde -I../../media -I../../meta -I../../base
> -I../../core -I../../device -I../../gm -I../../help -I../../40ctl
> -I../../cua -I../../chart -I../../dynobj -I../../license -I../../inter
> -I../../comm -I../../gwproc -I../../textedit
> -I//c/egcs-1-1-2/i386-mingw32/include -x c++ -DNDEBUG
> -o../../egcs112/rel/depend/st/main.o  main.cxx
> 
> The ld was invoked by the following line:
> ld -Lc:/egcs-1-1-2/i386-mingw32/lib\\  -S
> ..\\..\\egcs112\\rel\\depend\\st\\cppsetup.o
> ..\\..\\egcs112\\rel\\depend\\st\\ifparser.o
> ..\\..\\egcs112\\rel\\depend\\st\\include.o
> ..\\..\\egcs112\\rel\\depend\\st\\main.o
> ..\\..\\egcs112\\rel\\depend\\st\\parse.o
> ..\\..\\egcs112\\rel\\depend\\st\\pr.o -o ..\\..\\egcs112\\bin\\depend.exe
> -Map ..\\..\\egcs112\\bin\\depend.map -lmingw32 -lcrtdll -lmoldname
> 
> But I have unresolved externals:
> ld: warning: cannot find entry symbol _mainCRTStartup; defaulting to
> 00401000
> ..\..\egcs112\rel\depend\st\include.o(.text+0x53d):include.cc: undefined
> reference to `_alloca'
> ..\..\egcs112\rel\depend\st\main.o(.text+0x1352):main.cc: undefined
> reference to `__builtin_vec_new'
> ..\..\egcs112\rel\depend\st\main.o(.text+0x1a81):main.cc: undefined
> reference to `__builtin_vec_delete'

I suggest you either:

1. use gcc/c++ to link, which is always the preferred way, or
2. use gcc/c++ to link with -v option and see what libraries and startup
   files need to be linked in and *then* use ld.

You need -lgcc to get rid of some of the undefined symbols, and perhaps
all of the above.

You're also missing the startup files (crt*.o) and so on. Using "ld" 
without knowing more about the platform specific startups/libraries 
needed is a *very* bad idea.

> 
> Interesting that my source is not using alloca anywhere (checked with the
> preprocessor output) and the missing operator new[] and delete[] seem to
> identify some basic configuration problem. Any idea how to the ld where to
> find the missing symbols?

"alloca" is used by gcc support code, and that's why you need -lgcc.

Regards,
Mumit


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com