Opened 5 years ago
Closed 5 years ago
#975 closed defect (fixed)
Error building with Visual Studio 2017
Reported by: | Alberto Bignotti | Owned by: | strk |
---|---|---|---|
Priority: | blocker | Milestone: | |
Component: | Core | Version: | main |
Severity: | Unassigned | Keywords: | |
Cc: |
Description
git clone git@…:libgeos/geos.git
commit id: 6998041 (done on 11 Jul 2019 16:54)
generating project for Visual Studio 2017 x64
-DBUILD_SHARED_LIBS=ON
Build of "geos" project fail with this log:
... 2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\map(82): note: see reference to class template instantiation 'std::_Tree<std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,false>>' being compiled 2> with 2> [ 2> _Kty=std::string, 2> _Ty=std::unique_ptr<geos::util::Profile,std::default_delete<geos::util::Profile>>, 2> _Pr=std::less<std::string>, 2> _Alloc=std::allocator<std::pair<const std::string,std::unique_ptr<geos::util::Profile,std::default_delete<geos::util::Profile>>>> 2> ] 2>C:\dev_qt\experiments\last\build_geos\geos\include\geos/profiler.h(166): note: see reference to class template instantiation 'std::map<std::string,std::unique_ptr<geos::util::Profile,std::default_delete<_Ty>>,std::less<_Kty>,std::allocator<std::pair<const _Kty,std::unique_ptr<_Ty,std::default_delete<_Ty>>>>>' being compiled 2> with 2> [ 2> _Ty=geos::util::Profile, 2> _Kty=std::string 2> ] 2>math.cpp 2>Generating Code... 2>Done building project "geos.vcxproj" -- FAILED. ========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
this happend in classes:
geos::operation::distance::ConnectedElementLocationFilter geos::util::Profiler
When Visual Studio needs to export a class in a DLL, it instantiates everything possible. It will also try to create a copy constructor and copy assignment operator if they are not explicitly deleted. Unfortunately, the member variables
geos::operation::distance::ConnectedElementLocationFilter::locations geos::util::Profiler::profs
cannot be copied because of the unique pointer. So when it tries to export the class, it fails.
To solve I added this:
class GEOS_DLL Profiler { public: ... Profiler(const Profiler&) = delete; Profiler& operator=(const Profiler&) = delete; ... };
class GEOS_DLL ConnectedElementLocationFilter: public geom::GeometryFilter { private: ... ConnectedElementLocationFilter(const ConnectedElementLocationFilter&) = delete; ConnectedElementLocationFilter& operator=(const ConnectedElementLocationFilter&) = delete; ... }
Change History (5)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
Alberto, can you provide these changes as a pull request (https://github.com/libgeos/geos/) ?
comment:3 by , 5 years ago
PR made in https://github.com/libgeos/geos/pull/226 but I have no idea why drony is whining.
comment:5 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
There are something more in order to build unit tests:
geos\include\geos\geom\Location.h add GEOS_DLL before
Correct version:
geos\include\geos\geom\Geometry.h add missing GEOS_DLL:
With previous fix and this I'm able to run succesfully the test suite.