[vtkusers] Problems compiling VTK 4 under cygwin with shared libs

Mumit Khan khan at nanotech.wisc.edu
Wed Dec 19 13:37:36 EST 2001


On Wed, 19 Dec 2001, Carl Hetherington wrote:

> Hi,
>
> Fresh from my success at building a static VTK 4 (CVS checkout) under
> cygwin, I am now trying to do the same thing using shared libraries.
>
> From a clean CVS checkout, I run
> cmake -i
> and answer YES to the "Enable shared libraries" question
>
> I then run make and it bombs out with
>
> ... stuff ...
>
> c++    -g -O2 -mwin32 -o \
>   /usr/local/src/VTK/CVS-nightly/VTK/bin/libvtkzlib \
>   adler32.o gzio.o inftrees.o uncompr.o compress.o infblock.o infutil.o
> zutil.o crc32.o infcodes.o deflate.o inffast.o inflate.o trees.o
> -L/usr/local/src/VTK/CVS-nightly/VTK/bin/ -lpthread -lm
> /usr/lib/libpthread.a(libcmain.o)(.text+0x6a): undefined reference to
> `WinMain at 16'

Take out -lpthread and -lm, and if that fixes the problem, then I know
what the problem is. There is a long standing problem that if you link
a C++ application with a library that is a link to libcygwin1.a (which
libpthread.a and libm.a are), you get link errors. All the pthread code
is already in libcygwin1.a, which is linked in implicitly. Be aware that
the POSIX threading code in Cygwin is incomplete.

Regards,
Mumit





More information about the vtkusers mailing list