[vtkusers] Problems compiling VTK 4 under cygwin with shared libs
William A. Hoffman
billlist at nycap.rr.com
Thu Dec 20 08:29:46 EST 2001
You are missing a -shared flag. What version of cmake are you using?
In your CMakeCache.txt file you should have this:
//Flag used by CXX to build a shared library.
CMAKE_SHLIB_BUILD_FLAGS:STRING=-shared
I suspect for some reason it is empty.
What version of cygwin are you using?
-Bill
At 10:50 AM 12/20/2001 +0000, Carl Hetherington wrote:
>On Wed, 19 Dec 2001, Mumit Khan wrote:
>
> > On Wed, 19 Dec 2001, Carl Hetherington wrote:
>[snip]
> > > 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.
>
>Thanks Mumit.
>
>Removing -lpthread and -lm does not fix the problem, unfortunately.
>
>I note that the "undefined reference to WinMain at 16" error is exactly what
>is returned when I try to link any code which does not contain a main() or
>WinMain() routine. It seems to me that the link step for libvtkzlib
>should be a /partial/ linkage, not one that tries to create an executable.
>
>For example:
>
>% cat test.cxx
>#include <iostream>
>int thing()
>{
> cout << "Hello" << endl;
>}
>
>% c++ -c -o test.o test.cxx
>% c++ -o test test.o
>/usr/lib/libcygwin.a(libcmain.o)(.text+0x6a): undefined reference to
>`WinMain at 16'
>collect2: ld returned 1 exit status
>
>It seems that the Makefile has not been built correctly and that the c++
>command for linking this library should be replaced by something else
>(e.g. an ar?)
>
>Any comments would be welcome (especially if I am on completely the wrong
>track!)
>
>Cheers
>Carl
>
>
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at:
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list