Re: [wxVTK] Installing wxVTK
Brought to you by:
malat
|
From: Mathieu M. <mat...@gm...> - 2008-12-23 09:06:08
|
Andrey, Sorry to hear about your misfortune trying to use wxVTK. On Tue, Dec 23, 2008 at 9:22 AM, Andrey Sklyar <sky...@gm...> wrote: > Hi all, > > I am having some trouble linking the samples provided with wxVTK. > Could somebody please point me to a reference that explains: > > - how one should install wxWidgets in order for it to work with wxVTK > - how one should install VTK to have it work with wxVTK > - how to compile and link the sample programs provided with wxVTK using cmake > - what wxWidgets_CONFIG_EXECUTABLE and wxWidgets_wxrc_EXECUTABLE are > - how to have cmake find those directories automatically I am mostly a UNIX guy, so this might not be the best way. I used a page explaining how to build wxWidgets using the Free Compiler Tools (released in 2003, this is a equivalent to MS VS7.1 compiler). I then set `cl` in the path (+proper INCLUDE and LIBS), I start cmakesetup, select 'NMake Makefiles', then from the cygwin shell starts 'nmake': repeat for (1) VTK and (2) wxVTK. I *think* if you do it in this order cmakesetup will be able to figure out where you build VTK and will fill in VTK_DIR when configuring wxVTK. Technically this should work with cygwin...but this is true (1) I never tried, (2) I hardly ever play with the -mno-cygwin option. > Details: > ----------------------------------------------------- > I'm running cygwin 1.5.25 on Windows XP. > I'm using > - g++ version 3.4.4 (sygming special, gdc 0.12, using dmd 0.125) > - cmake version 2.6-patch 2 > - VTK 5.2.0 > - wxWidgets version 2.8 Perfect. > > VTK Setup > ----------------------------------------------------- > I installed VTK on 10/29/2008. I am able to run the sample programs > that came with it. Hum... I am not an expert, but I do not think you can mix symbol from a M$ compiled binary and a cygwin compiled binary. I do not think the linker can find the symbols (C++) in the other one. I would suggest you try compiling VTK yourself, with the *exact* same set of option (esp. your -mno-cygwin). > > wxWidgets Setup > ----------------------------------------------------- > I acquired and compiled wxWidgets following directions on > http://wiki.wxwidgets.org/Cygwin > > I entered this in the shell (following the "To get an executable > independent of Cygwin DLL" directions) > > $ cvs -d :pserver:an...@cv...:/pack/cvsroots/wxwidgets > checkout -r WX_2_8_BRANCH wxMSW > $ cd wxWidgets > $ export CFLAGS=-mno-cygwin > $ export CPPFLAGS=-mno-cygwin > $ export CXXFLAGS=-mno-cygwin > $ export LDFLAGS="-mno-cygwin -mwindows" > $ ./configure --with-msw --enable-debug --enable-debug_gdb > --disable-shared --with-libjpeg=builtin --disable-precomp-headers > --without-expat > $ make Looks fine to me, and should work with VTK & wxVTK. > wxVTK Setup > ----------------------------------------------------- > I then proceeded to try to get wxVTK to work. > I downloaded wxVTK from > > http://sourceforge.net/project/showfiles.php?group_id=114757&package_id=124328&release_id=603693 > > and extracted it to ~/wxVTK You may want to have a look at the CVS HEAD sometimes it is a little old... > I then copied all the files needed for compiling the samples to a new > directory and did an out of source build using cmake > > $ mkdir ~/test > $ cd ~/test > $ mkdir src > $ mkdir bin > $ cd ~/wxVTK > $ cp -r src/ Sample/ CMakeLists.txt ~/test/src > $ cd ~/test/bin > $ ccmake ../src I did not quite follow what you did. Here is what I would be doing (not tested): $ cd ~/wxVTK $ mkdir ~/wxVTK-bin $ cd ~/wxVTK-bin $ cmake ~/wxVTK $ make > wxWidgets_CONFIG_EXECUTABLE = /usr/local/bin/wx-config yup. > which is a pointer to usr/ocal/lib/wx/config/msw-ansi-debug-static-2.8 > - what is this and why is it needed for using wxWidgets? On UNIX this is the way people have been distributing executable and little helper that would tell developers how to link executable. Just enter `wx-config` in your shell, this is pretty much self-explained. > Getting a value for wxWidgets_wxrc_EXECUTABLE was harder. Using This should refer to the wxrc executable. I am not sure if this is required or not. I would think this is located in /usr/local/bin (funny cmake did not find it...). > I generated the make file and ran make. It wxImagePlaneWidgets.cxx > and then wxVTKRenderWindowInteractor.cxx, then tried to link them, and > spewed a lot of errors concerning ___assert and ___errno. I might be missing a #include <assert.h> > Unfortunately I didn't save the errors and have recompiled wxWindows > since then and don't want to spend a third hour recompiling that > library. Upon examining wxVTKRenderWindowInteractor.cxx I saw that it > used <assert.h> and the assert macro. It seemed like the linker > wasn't linking libc because I compiled wxWidgets with -mno-cygwin, > thus leading to ___assert and ___errno not being found when linking. > > I recompiled wxWidgets without the -mno-cygwin flags. I used these No ! You cannot link a -mno-cygwin and a regular cygwin lib. They do not export symbols the same way (AFAIK). > The ___assert and ___errno errors promptly disappeared, but the linker > is still complaining. I tried building the samples again using the > same cmake configuration as before and I am currently received the > warning > > /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../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 Looks like a warning... > Seems like it didn't work... The full error message is below: > > $ make > Scanning dependencies of target wxImagePlaneWidget > [ 10%] Building CXX object > CMakeFiles/wxImagePlaneWidget.dir/Sample/wxImagePlaneWidget.cxx.o > [ 20%] Building CXX object > CMakeFiles/wxImagePlaneWidget.dir/src/wxVTKRenderWindowInteractor.cxx.o > Linking CXX executable bin/wxImagePlaneWidget.exe > /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../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/local/lib/libwx_mswd_core-2.8.a(corelib_window.o):/usr/src/wxWidgets/. > /src/msw/window.cpp:1340: undefined reference to > `wxSystemOptions::GetOptionInt(wxString const&)' > /usr/local/lib/libwx_mswd_core-2.8.a(corelib_window.o):/usr/src/wxWidgets/./src/msw/window.cpp:3956: > undefined reference to `_wxEVT_POWER_SUSPENDING' Your linker is lost IMHO. You may want to inspect the output of: $ make VERBOSE=1 To check that library are properly passed to the linker. Good luck. -- Mathieu |