← Back to team overview

lidardev team mailing list archive

[Blueprint windows-compilation] Specific issues for Windows compilation

 

Blueprint changed by Olivier Tournaire:

Whiteboard changed:
  Here are some tips on compiling LidarFormat on Windows.
  
  *****************************************************************
  ***** Tests made with Visual 2008 Express Edition *****
  *****************************************************************
  
  1.1) Boost build
  To use boost autolink on windows, you have to build boost libs with the specific toolset associated with your compiler. For example, to build all configurations with Visual 2008 Express and install in default location (C:/Boost), use this command line:
       bjam toolset=msvc-9.0express --build-type=complete install
  In addition, you can choose to exclude some not needed libraries for the build process with the '--without-LIBTOEXCLUDE' option. For more options, see http://www.boost.org/doc/libs/1_39_0/more/getting_started/windows.html
  1.1) Boost settings
  You also need to add to the PATH environment variable where are located Boost DLLs. If you used a standard installation path, it might be C:\Boost\lib. If you do not do this, you may have execution problems (Unable to find boost_xxxxxxx_.dll)
  
  2) XSD
  To use XSD binaries, add the path in Tools > Options > Projects and Solutions > VC++ directories > C:\Program Files\CodeSynthesis XSD 3.2\bin. Please note that this path must be in the top of the list to avoid conflict with Microsoft xsd.exe. For other issues, please consult http://wiki.codesynthesis.com/Using_XSD_with_Microsoft_Visual_Studio
  
  **************************
  ***** To be solved *****
  **************************
  
  1) Compilation of 02_ex_filtering.cpp is still a problem with VC++. It
  generates the following errors:
  
  1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(3172) : error C2666: 'Lidar::operator +' : les 2 surcharges ont des conversions similaires
  1>        C:\code\lidar.repo\branch-windows_compilation\src\LidarFormat/LidarIteratorEcho.h(379): peut être 'const Lidar::LidarConstIteratorEcho::Self Lidar::operator +(const Lidar::LidarConstIteratorEcho::Self &,const size_t)' [trouvé à l'aide d'une recherche dépendante d'un argument]
  1>        C:\code\lidar.repo\branch-windows_compilation\src\LidarFormat/LidarIteratorEcho.h(261): ou       'const Lidar::LidarIteratorEcho::Self Lidar::operator +(const Lidar::LidarIteratorEcho::Self &,__w64 const int)' [trouvé à l'aide d'une recherche dépendante d'un argument]
  1>        lors de la tentative de mise en correspondance de la liste des arguments '(Lidar::LidarIteratorEcho, size_t)'
  1>        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(3187) : voir la référence à l'instanciation de la fonction modèle 'void std::_Median<_RanIt,_Pr>(_RanIt,_RanIt,_RanIt,_Pr)' en cours de compilation
  1>        with
  1>        [
  1>            _RanIt=Lidar::LidarIteratorEcho,
  1>            _Pr=LessEcho
  1>        ]
  1>        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(3249) : voir la référence à l'instanciation de la fonction modèle 'std::pair<_Ty1,_Ty2> std::_Unguarded_partition<_RanIt,_Pr>(_RanIt,_RanIt,_Pr)' en cours de compilation
  1>        with
  1>        [
  1>            _Ty1=Lidar::LidarIteratorEcho,
  1>            _Ty2=Lidar::LidarIteratorEcho,
  1>            _RanIt=Lidar::LidarIteratorEcho,
  1>            _Pr=LessEcho
  1>        ]
  1>        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(3279) : voir la référence à l'instanciation de la fonction modèle 'void std::_Sort<Lidar::LidarIteratorEcho,__w64 int,_Pr>(_RanIt,_RanIt,_Diff,_Pr)' en cours de compilation
  1>        with
  1>        [
  1>            _Pr=LessEcho,
  1>            _RanIt=Lidar::LidarIteratorEcho,
  1>            _Diff=__w64 int
  1>        ]
  1>        .\tests\02_ex_filtering.cpp(145) : voir la référence à l'instanciation de la fonction modèle 'void std::sort<Lidar::LidarDataContainer::iterator,LessEcho>(_RanIt,_RanIt,_Pr)' en cours de compilation
  1>        with
  1>        [
  1>            _RanIt=Lidar::LidarDataContainer::iterator,
  1>            _Pr=LessEcho
  1>        ]
  1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(3172) : error C2666: 'Lidar::operator +' : les 2 surcharges ont des conversions similaires
  1>        C:\code\lidar.repo\branch-windows_compilation\src\LidarFormat/LidarIteratorEcho.h(379): peut être 'const Lidar::LidarConstIteratorEcho::Self Lidar::operator +(const Lidar::LidarConstIteratorEcho::Self &,const size_t)' [trouvé à l'aide d'une recherche dépendante d'un argument]
  1>        C:\code\lidar.repo\branch-windows_compilation\src\LidarFormat/LidarIteratorEcho.h(261): ou       'const Lidar::LidarIteratorEcho::Self Lidar::operator +(const Lidar::LidarIteratorEcho::Self &,__w64 const int)' [trouvé à l'aide d'une recherche dépendante d'un argument]
  1>        lors de la tentative de mise en correspondance de la liste des arguments '(Lidar::LidarIteratorEcho, size_t)'
  1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(3172) : error C2780: 'void std::_Med3(_RanIt,_RanIt,_RanIt)' : 3 arguments attendus - 4 fournis
  1>        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(2997) : voir la déclaration de 'std::_Med3'
  1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(3173) : error C2666: 'Lidar::operator -' : les 2 surcharges ont des conversions similaires
  1>        C:\code\lidar.repo\branch-windows_compilation\src\LidarFormat/LidarIteratorEcho.h(384): peut être 'const Lidar::LidarConstIteratorEcho::Self Lidar::operator -(const Lidar::LidarConstIteratorEcho::Self &,const size_t)' [trouvé à l'aide d'une recherche dépendante d'un argument]
  1>        C:\code\lidar.repo\branch-windows_compilation\src\LidarFormat/LidarIteratorEcho.h(266): ou       'const Lidar::LidarIteratorEcho::Self Lidar::operator -(const Lidar::LidarIteratorEcho::Self &,__w64 const int)' [trouvé à l'aide d'une recherche dépendante d'un argument]
  1>        lors de la tentative de mise en correspondance de la liste des arguments '(Lidar::LidarIteratorEcho, size_t)'
  1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(3173) : error C2666: 'Lidar::operator +' : les 2 surcharges ont des conversions similaires
  1>        C:\code\lidar.repo\branch-windows_compilation\src\LidarFormat/LidarIteratorEcho.h(379): peut être 'const Lidar::LidarConstIteratorEcho::Self Lidar::operator +(const Lidar::LidarConstIteratorEcho::Self &,const size_t)' [trouvé à l'aide d'une recherche dépendante d'un argument]
  1>        C:\code\lidar.repo\branch-windows_compilation\src\LidarFormat/LidarIteratorEcho.h(261): ou       'const Lidar::LidarIteratorEcho::Self Lidar::operator +(const Lidar::LidarIteratorEcho::Self &,__w64 const int)' [trouvé à l'aide d'une recherche dépendante d'un argument]
  1>        lors de la tentative de mise en correspondance de la liste des arguments '(Lidar::LidarIteratorEcho, size_t)'
  1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(3173) : error C2780: 'void std::_Med3(_RanIt,_RanIt,_RanIt)' : 3 arguments attendus - 4 fournis
  1>        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(2997) : voir la déclaration de 'std::_Med3'
  1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(3174) : error C2666: 'Lidar::operator -' : les 2 surcharges ont des conversions similaires
  1>        C:\code\lidar.repo\branch-windows_compilation\src\LidarFormat/LidarIteratorEcho.h(384): peut être 'const Lidar::LidarConstIteratorEcho::Self Lidar::operator -(const Lidar::LidarConstIteratorEcho::Self &,const size_t)' [trouvé à l'aide d'une recherche dépendante d'un argument]
  1>        C:\code\lidar.repo\branch-windows_compilation\src\LidarFormat/LidarIteratorEcho.h(266): ou       'const Lidar::LidarIteratorEcho::Self Lidar::operator -(const Lidar::LidarIteratorEcho::Self &,__w64 const int)' [trouvé à l'aide d'une recherche dépendante d'un argument]
  1>        lors de la tentative de mise en correspondance de la liste des arguments '(Lidar::LidarIteratorEcho, size_t)'
  1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(3174) : error C2666: 'Lidar::operator -' : les 2 surcharges ont des conversions similaires
  1>        C:\code\lidar.repo\branch-windows_compilation\src\LidarFormat/LidarIteratorEcho.h(384): peut être 'const Lidar::LidarConstIteratorEcho::Self Lidar::operator -(const Lidar::LidarConstIteratorEcho::Self &,const size_t)' [trouvé à l'aide d'une recherche dépendante d'un argument]
  1>        C:\code\lidar.repo\branch-windows_compilation\src\LidarFormat/LidarIteratorEcho.h(266): ou       'const Lidar::LidarIteratorEcho::Self Lidar::operator -(const Lidar::LidarIteratorEcho::Self &,__w64 const int)' [trouvé à l'aide d'une recherche dépendante d'un argument]
  1>        lors de la tentative de mise en correspondance de la liste des arguments '(Lidar::LidarIteratorEcho, size_t)'
  1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(3174) : error C2780: 'void std::_Med3(_RanIt,_RanIt,_RanIt)' : 3 arguments attendus - 4 fournis
  1>        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(2997) : voir la déclaration de 'std::_Med3'
  1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(3175) : error C2666: 'Lidar::operator +' : les 2 surcharges ont des conversions similaires
  1>        C:\code\lidar.repo\branch-windows_compilation\src\LidarFormat/LidarIteratorEcho.h(379): peut être 'const Lidar::LidarConstIteratorEcho::Self Lidar::operator +(const Lidar::LidarConstIteratorEcho::Self &,const size_t)' [trouvé à l'aide d'une recherche dépendante d'un argument]
  1>        C:\code\lidar.repo\branch-windows_compilation\src\LidarFormat/LidarIteratorEcho.h(261): ou       'const Lidar::LidarIteratorEcho::Self Lidar::operator +(const Lidar::LidarIteratorEcho::Self &,__w64 const int)' [trouvé à l'aide d'une recherche dépendante d'un argument]
  1>        lors de la tentative de mise en correspondance de la liste des arguments '(Lidar::LidarIteratorEcho, size_t)'
  1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(3175) : error C2666: 'Lidar::operator -' : les 2 surcharges ont des conversions similaires
  1>        C:\code\lidar.repo\branch-windows_compilation\src\LidarFormat/LidarIteratorEcho.h(384): peut être 'const Lidar::LidarConstIteratorEcho::Self Lidar::operator -(const Lidar::LidarConstIteratorEcho::Self &,const size_t)' [trouvé à l'aide d'une recherche dépendante d'un argument]
  1>        C:\code\lidar.repo\branch-windows_compilation\src\LidarFormat/LidarIteratorEcho.h(266): ou       'const Lidar::LidarIteratorEcho::Self Lidar::operator -(const Lidar::LidarIteratorEcho::Self &,__w64 const int)' [trouvé à l'aide d'une recherche dépendante d'un argument]
  1>        lors de la tentative de mise en correspondance de la liste des arguments '(Lidar::LidarIteratorEcho, size_t)'
  1>C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(3175) : error C2780: 'void std::_Med3(_RanIt,_RanIt,_RanIt)' : 3 arguments attendus - 4 fournis
  1>        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\algorithm(2997) : voir la déclaration de 'std::_Med3'
  
  See http://msdn.microsoft.com/en-us/library/dyafzty4%28VS.71%29.aspx for
  more information
  
  2) If the lib is compiled as a .DLL, tests are looking for a .LIB. Can be solved by adding specific linking rules in CMakeLists.txt depending on the value of the variable LIBRARY_TYPE (or BUILD_LIBRARY_SHARED).
  Some tips or explanations can be found here:
  http://xenophilia.org/winvunix.html
  http://www.vtk.org/Wiki/CMake_FAQ#Why_does_FIND_LIBRARY_not_find_.DLL_libraries_under_WIN32.3F
  
  3) Maybe after the previous fix, CPack options for Windows have to be
  updated.
  
  4) The most important: on Windows platforms, the factory does not
  properly handle registering formats. It needs an explicit call. Have to
  fix that in some way ASAP. (Adrien: if the lib is compiled as a DLL, it
  should work out of the box... ? nevertheless, it would be good to create
  a function to manually register every formats in case of static lib.)
  
+ 5) Naming conventions for libraries.
+ Nicolas D proposed to use Boost naming conventions for compiled libraries (https://answers.edge.launchpad.net/lidarformat/+question/79469). Here is a full description:
+ http://www.boost.org/doc/libs/1_38_0/more/getting_started/windows.html#library-naming
+ Thus, on Windows:
+  - debug/dynamic: lidarformat(-mt)-dg.dll and lidarformat(-mt)-dg.lib
+  - debug/static: liblidarformat(-mt)-dg.lib
+  - release/dynamic: lidarformat(-mt).dll and lidarformat(-mt).lib
+  - release/static: liblidarformat(-mt).lib
+ 
+ We also have to decide wether the libs names are upper or lower case.
+ Boost conventions: all lower. ;-)
+ 
+ 6) On Windows, in order to create a DLL, a specific declaration is needed for the methods/functions. GCC exports all symbols by default, Visual does not ... I propose the following as a portable way of solving the problem:
+ In a config.hpp file, add:
+ 
+ #ifdef WIN32
+ #	define LIDARFORMAT_DECL __declspec(dllexport)
+ #else
+ #	define LIDARFORMAT_DECL
+ #endif // WIN32
+ 
+ Then, include LidarFormat/config.hpp in all headers of the lib.
+ 
  *************************************************
  ***** Remaining compilation warnings *****
  *************************************************
  
  1) TerraBin.cpp (2 times): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead.
  --> 2 solutions: 1) use fopen_s 2) add a compilation flag in CMakeLists.txt (see Windows specific section line 146) ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
  
  2) Orientation2D.cpp(96) : warning C4101: 'e' : variable locale non
  référencée
  
  3) LidarFile.cpp(127) : warning C4101: 'e' : variable locale non
  référencée
  
  Note: only 4 warnings ...

-- 
  Specific issues for Windows compilation
  https://blueprints.edge.launchpad.net/lidarformat/+spec/windows-compilation