Re: [wxVTK] Installing wxVTK
Brought to you by:
malat
From: Andrey S. <sky...@gm...> - 2008-12-23 09:53:36
|
Thanks for your quick reply! > > 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). I compiled everything using cygwin, including VTK. I used these options with cmake: BUILD_EXAMPLES ON BUILD_SHARED_LIBS OFF BUILD_TESTING ON CMAKE_BACKWARDS_COMPATIBILITY 2.4 CMAKE_BUILD_TYPE CMAKE_INSTALL_PREFIX /usr/local VTK_DATA_ROOT /usr/src/VTKData VTK_USE_INFOVIS ON VTK_USE_PARALLEL OFF VTK_USE_RENDERING ON VTK_USE_VIEWS ON VTK_WRAP_JAVA OFF VTK_WRAP_PYTHON OFF VTK_WRAP_TCL OFF > > > > 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. Would this still work with a VTK and wxVTK that was linked with cygwin? > > > 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 did, and it didn't compile, so I went to the branch. I saw also that they're using SVN now (http://www.wxwidgets.org/develop/svn.htm) and that the cvs repository is "obsolete" (http://wiki.wxwidgets.org/Cvs). > > > I then copied all the files needed for compiling the samples to a new > > directory and did an out of source build using cmake > > > > I did not quite follow what you did. Here is what I would be doing (not tested): > We both ended up doing an out of source build. Ok, that's good, got something right! > > > > 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. Thanks, that explained it. > > 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 don't seem to have a wxrc executable... does the path that you have for wxWidgets_wxrc_EXECUTABLE on your machine point to such an executable? If it's not really needed, is there a way to turn it off (so that cmake doesn't ask you for 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> You have it there. It was just my linker not liking something. > > 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 reason I recompiled wxWidgets was because VTK was built with cygwin libraries, but wxWidgets was built without the. This lead lead to the symbol mismatch problems you described. I think that ___assert and ___errno were some of these symbols that weren't getting exported the same way and thus causing errors. > > 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. I will do that. Once I figure out which libraries I'm missing, how should I edit CMakeList.txt to have cmake add the libraries to the Makefile for linking? Is there a good online reference for CMake file writing (I know there's the book for Kitware...)? > Good luck. > -- > Mathieu Thanks again for your help. - Andrey |