Errors building PCL 1.8 with VTK-7.0.0 - cmake

Trying to build PCL 1.8 using VTK 7.0.0. Target is Visual Studio 2015.
Using the VTK OpenGL2 backend I got errors similar to those reported here and here which indicate OpenGL2 is not supported for PCL yet.
However, using the original VTK OpenGL backend I get different errors:
The list of VTK libraries PCL projects link against includes libraries whose names suggest both OpenGL and OpenGL2, even though VTK is only configured with one or the other backend. For example, "vtkDomainsChemistryOpenGL2.lib" (when VTK backend is OpenGL).
"vtkDomainsChemistryOpenGL2.lib" does not exist, causing a linker error. However, a library called "vtkDomainsChemistryOpenGL2-7.0.lib" exists, so it appears a version suffix is added when VTK is built, but is not added when CMake generates the list of libraries to link PCL projects with.
vtkVertexBufferObject.cxx(104): error C2039: 'GetExtensionManager': is not a member of 'vtkOpenGLRenderWindow'. Class vtkOpenGLRenderWindow is suspiciously tagged with VTKRENDERINGOPENGL2_EXPORT (again in an OpenGL build).
I don't know whether the problem lies in VTK or PCL. The CMake build system is completely opaque to me so I am getting nowhere with this.

Just following up to myself (again)...
The problem was that, because I had initially built the "INSTALL" project of VTK using the OpenGL2 backend, then changed the backend to OpenGL and built the "INSTALL" project of VTK again, both backends existed in the install folder. VTKConfig.cmake (which PCL uses to link with VTK) finds and links against all modules that it finds in the install folder, thus attempting to link against both incompatible backends.
The VTK build system does not detect that conflicting modules are already present when installing, and the "make clean" or "rebuild" options don't remove conflicting modules (VTK does not have an uninstaller). Deleting CMake caches, or creating a new clean build directory, is not sufficient to clear up this mess.
So the only solution was to manually find and delete the VTK install folder ("C:\Program Files (x86)\VTK", for the record) if you need to change the VTK backend.

Related

Problem building GNURadio in custom environment

I am trying to build the latest GNURadio package on my development system. Unfortunately this system configuration is tightly controlled and I can't just install new packages of software on it as it is used to develop a product and all development systems are kept in lockstep. We are currently on an older version of RedHat.
While I cannot modify the system includes I can download and use newer versions of packages locally (in non-system directories) as long as that doesn't affect the product build/debug environment. Normally this isn't a problem.
However, when building GNURadio I found that our development platforms use an older version of the Boost libraries than is required to build GNURadio. So, I got the latest version of Boost and extracted it into my local (home) directory. I found several directions for, I thought, instructing CMake to use additional include directories. Unfortunately, this hasn't seemed to work with the Boost libraries. CMake keeps complaining that it finds the older version of Boost and not the newer one I have extracted locally.
I have tried using
-DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES=<dir>
and
-DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES_BEFORE=<dir>
and this had no effect. I then tried adding the following to the top-level CMakeLists.txt file:
SET(CMAKE_INCLUDE_DIRECTORIES_BEFORE ON)
SET(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES <dir>)
or, even
include_directories(BEFORE <dir>)
Again, no joy.
I did a bit of digging and found that there is a GrBoost.cmake module and it had an additional configuration for the boost directory so I added this:
list(PREPEND BOOST_LIBRARYDIR "<dir>")
to the top of the file. Again, no luck.
I've never used CMake before (and I'm not really keen on learning yet another build system if I don't have to - our company just switched to bazel and I am coming up to speed on that) so I am flying blind here.
What do I have to do to get CMake to look in my local directory to find the Boost stuff I downloaded?
Ok. As it often happens, just after asking the question I was able to find an answer.
It turns out that there is a command-line option to CMake (CMAKE_PREFIX_PATH=<dir>) where you can specify additional base paths to search for CMake config files. I just added this to the command-line and it was found just fine.
I wasn't even aware that Boost came with such config files. Live and learn.
#vre's comment would have probably worked just as well (maybe better, in fact).

CMake not able to find Qt4

I'm working on a project using PCL (point cloud library) for which I need to configure some code files using CMake. But some of these files aren't getting configured and the error CMake shows for those files is "Qt4 not found". I already have Qt 4.8 installed and this is the only Qt version I have. Also, for some of the other files, CMake used Qt without showing any error. And when I run qmake.exe, it shows "Qt : Untested windows version 6.2 detected". And for all the Qt5 related entries, CMake shows "NOT FOUND". Have I installed the correct version of Qt? And how can I get CMake to detect Qt4?
I'm using windows 8.1 64bit
When I typed qmake -v in command prompt, I got this -
Qt: Untested Windows version 6.2 detected!
QMake version 2.01a
Using Qt version 4.8.0 in C:\Qt\4.8.0\lib
cmake to find Qt users qmake, so if you run it not from command line,
make sure that global environment variable PATH set to proper value, so cmake can find qmake
cmake cache libraries search results, bad results also. Because of that, if it can find some library, you install it, then rerun cmake it can show again "library not found" message, even if your setup is corrret. So make sure to remove CMakeCache.txt before rerun cmake.

How can I install MPFI library in Windows?

there!
I'd like to execute example program, Surface_reconstruction_points_3.
I think the program needs additionally 3rd library, MPFI.
So I downloaded the library from http://mpfi.gforge.inria.fr/.
And I unzipped it at proper folder and linked it to the system path.
After configurating the example program using cmake-gui,
I found some error message, 'Could NOT find MPFI (missing: MPFI_LIBRARIES)'.
How can I install MPFI library in Window using visual studio 2008?
Since MPFI is a GNU library, it is completely supported on Windows.
CGAL provides this third-party libraries inside its installation, but Windows has its own replacement.
I installed this correctly with Visual Studio, but you need to uncheck those third-party libraries so CGAL won't mess with the own windows replacements.
Maybe doing this kind of installation isn't working well for all the sample codes inside the installation, but it works fine for development. I used CGAL without those third-libraries for Voronoi and 2D and 3D triangulation and it works fine.
For a clean installation, delete all you installed previously, make sure the new installation isn't messing with the bad previous installation.
EDIT:
About not using those optional libraries for Windows, I just received a similar mail through the CGAL mailing list and these could be the steps for newer versions of CGAL (>4.2):
You have to comment 3 lines in the CMake machinery:
In CGAL-4.1/CMakeList.txt you have to comment:
#list (INSERT CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES 0 GMP MPFR)
#hide_variable(CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES)
In CGAL-4.1/cmake/modules/UseCGAL.cmake you have to comment:
#use_essential_libs()
On the other hand, you can search on internet for precompiled versions of MPFI. For instance, you can find precompiled GMP, MPFR and MPFI for Windows on http://vegas.loria.fr/rs/ .

FreeImage library not found

Installed FreeImage through MacPorts. Everything looked to be OK, but when I builded my app and tried to launch on other computer where is no MacPorts and no FreeImage installed it says
dyld: Library not loaded: /opt/local/lib/libfreeimage.3.dylib
Referenced from: /Users/development/Library/Developer/Xcode/DerivedData/freeimage-dxsornyaxqlkyubqwsrlkgszvxhy/Build/Products/Debug/freeimage.app/Contents/MacOS/freeimage
Reason: image not found
Shouldn't it copy library files together with my project? I added them to my project's build phases "Copy files" list. They are being copied to my app's bundle. But when I try to link them, I get same error. I don't know why but app is still looking for library in /opt/local/lib. How can I fix it so that I could use FreeImage at my project and run it at any computer?
When you install through MacPorts the library is installed in /opt/local/lib, not in your project path. Even if you copy the whole project, the *dylib libraries won't be copied because they are usually in /opt/local/lib.
I believe you have two options here: install FreeImage in every computer that you want to run your application, or copy the libfreeimage.3.dylib to the same folder where your binnary is and, if both systems are similar, that should work. If the two computers are different in terms of operating system version, hardware architecture, etc... then probably the .dylib that you have won't be compatible for the other computer.
Another thing you might want to consider is to modify your DYLD_LIBRARY_PATH variable, which specifies the paths in which the OS will look for libraries when linking. See this answer for more information.

Library search path for libstdc++

I have compiled shared libraries dynamically linked against libstdc++.so using GLIBCXX_3.4.11. I want to send my code to someone whose stdc++ library is only of version 3.4.10. Rather than ask him to update his library version (this is a software customer, so I can't assume they'll be willing or able to change system files) I would like to ship the appropriate version of libstdc++.so, placed in a lib folder with the directory location of my code. How do I get my own code to use the appropriate (later) version? I find that /etc/ld.so.conf includes the directory /lib64, where an offending older version of libstdc++.so resides. Setting LD_LIBRARY_PATH does not override this. This seems to deviate from the advertised behavior. Any idea why this is happening? How do I complete my rather simple task?
Thanks.
I understand that this question is old, but I found it while trying to sort out my own linking trouble which was similar. You will have to build your program against a version of libstdc++ which is compatible with your colleague's version of the library. The easiest solution, of course, is to link against his version of the library so he doesn't need to make special tweaks on his side to link your library.
To do this, you will want to install a version of GCC which can build binary compatible libraries so you can actually link against his version of libstdc++. GLIBCXX_3.4.11 is from gcc-4.4 and later, so you will need gcc-4.3. Build your program using this and you should be in good shape.
You can consult the following page for a list of library ABI compatabilities:
http://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html
You could also build an rpm/deb which requires the version of libstdc++ you already have and if it's not available, refuse to install. This gives you a bit of an interface which gives him a promise that if his system is setup with the correct dependencies, he can use your library. In that sense, it's like a loose SLA for your library in what you do and don't support.
Hope that helps!