Opened 11 years ago

Closed 10 years ago

## #2333 closed defect (fixed)

# Can't compile under mingw64 (neither mingw64 or mingw32)

Reported by: | robe | Owned by: | colivier |
---|---|---|---|

Priority: | medium | Milestone: | PostGIS SFCGAL |

Component: | sfcgal | Version: | master |

Keywords: | Cc: |

## Description

I spoke too soon. I cann*t compile SFCGAL. I get erros on both mingw64-w32 and mingw64-w64 and tehy are completely different errors.
*

thw mingw64-w32 I do have compiled with newer version of boost (boost 1.49.0 and mingw64-w64 is compiled with 1.46.

Errors for mingw64-w64 look like this: CMAKE config

-- The C compiler identification is GNU 4.5.4 -- The CXX compiler identification is GNU 4.5.4 -- Check for working C compiler: c:/ming64/mingw64/bin/gcc.exe -- Check for working C compiler: c:/ming64/mingw64/bin/gcc.exe -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: c:/ming64/mingw64/bin/g++.exe -- Check for working CXX compiler: c:/ming64/mingw64/bin/g++.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Boost_USE_STATIC_LIBS=OFF -- Boost_USE_MULTITHREAD=ON -- Boost version: 1.46.1 -- Found the following Boost libraries: -- date_time -- system -- thread -- serialization -- Found GMP: c:/ming64/projects/CGAL/rel-gmp-5.1.1w64/include -- GMP_INCLUDE_DIRS = c:/ming64/projects/CGAL/rel-gmp-5.1.1w64/include -- GMP_LIBRARIES = c:/ming64/projects/CGAL/rel-gmp-5.1.1w64/lib/libgmp.a -- Found MPFR: c:/ming64/projects/CGAL/rel-mpfr-3.1.2w64/include -- MPFR_INCLUDE_DIRS = c:/ming64/projects/CGAL/rel-mpfr-3.1.2w64/include -- MPFR_LIBRARIES = c:/ming64/projects/CGAL/rel-mpfr-3.1.2w64/lib/libmpfr.a -- Found CGAL: c:/ming64/projects/CGAL/rel-cgal-4.2w64/include -- CGAL found -- Configuring done -- Generating done -- Build files have been written to: C:/ming64/projects/CGAL/SFCGAL-0.2/build/mingw

Then starts running into issues about 20% into make

[ 12%] Building CXX object src/CMakeFiles/SFCGAL.dir/SFCGAL/algorithm/distance.c pp.obj c:/ming64/projects/CGAL/SFCGAL-0.2/src/SFCGAL/algorithm/distance.cpp: In functio n 'double SFCGAL::algorithm::distance(const SFCGAL::Geometry&, const SFCGAL::Geo metry&)': c:/ming64/projects/CGAL/SFCGAL-0.2/src/SFCGAL/algorithm/distance.cpp:51:9: warni ng: enumeration value 'TYPE_SOLID' not handled in switch c:/ming64/projects/CGAL/SFCGAL-0.2/src/SFCGAL/algorithm/distance.cpp: In functio n 'double SFCGAL::algorithm::distancePointGeometry(const SFCGAL::Point&, const S FCGAL::Geometry&)': c:/ming64/projects/CGAL/SFCGAL-0.2/src/SFCGAL/algorithm/distance.cpp:79:9: warni ng: enumeration value 'TYPE_SOLID' not handled in switch c:/ming64/projects/CGAL/SFCGAL-0.2/src/SFCGAL/algorithm/distance.cpp: In functio n 'double SFCGAL::algorithm::distanceLineStringGeometry(const SFCGAL::LineString &, const SFCGAL::Geometry&)': c:/ming64/projects/CGAL/SFCGAL-0.2/src/SFCGAL/algorithm/distance.cpp:184:9: warn ing: enumeration value 'TYPE_SOLID' not handled in switch c:/ming64/projects/CGAL/SFCGAL-0.2/src/SFCGAL/algorithm/distance.cpp: In functio n 'double SFCGAL::algorithm::distancePolygonGeometry(const SFCGAL::Polygon&, con st SFCGAL::Geometry&)': c:/ming64/projects/CGAL/SFCGAL-0.2/src/SFCGAL/algorithm/distance.cpp:280:9: warn ing: enumeration value 'TYPE_SOLID' not handled in switch [ 13%] Building CXX object src/CMakeFiles/SFCGAL.dir/SFCGAL/algorithm/distance3d .cpp.obj [ 15%] Building CXX object src/CMakeFiles/SFCGAL.dir/SFCGAL/algorithm/extrude.cp p.obj [ 16%] Building CXX object src/CMakeFiles/SFCGAL.dir/SFCGAL/algorithm/force3D.cp p.obj [ 17%] Building CXX object src/CMakeFiles/SFCGAL.dir/SFCGAL/algorithm/intersecti on.cpp.obj [ 18%] Building CXX object src/CMakeFiles/SFCGAL.dir/SFCGAL/algorithm/Intersecti on2D.cpp.obj [ 20%] Building CXX object src/CMakeFiles/SFCGAL.dir/SFCGAL/algorithm/Intersecti on3D.cpp.obj In file included from c:/ming64/projects/boost/rel-1.46w64/include/boost-1_46_1/ boost/thread/win32/basic_timed_mutex.hpp:14:0, from c:/ming64/projects/boost/rel-1.46w64/include/boost-1_46_1/ boost/thread/win32/mutex.hpp:8, from c:/ming64/projects/boost/rel-1.46w64/include/boost-1_46_1/ boost/thread/mutex.hpp:14, from c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/Kd_tr ee.h:34, from c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/inter nal/K_neighbor_search.h:28, from c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/Ortho gonal_k_neighbor_search.h:24, from c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/inter nal/AABB_tree/AABB_search_tree.h:24, from c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/AABB_ tree.h:28, from c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/Polyh edral_mesh_domain_3.h:33, from c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/inter section_of_Polyhedra_3_refinement_visitor.h:32, from c:/ming64/projects/CGAL/SFCGAL-0.2/src/SFCGAL/algorithm/In tersection3D.cpp:25: c:/ming64/projects/boost/rel-1.46w64/include/boost-1_46_1/boost/thread/win32/int erlocked_read.hpp: In function 'void boost::detail::interlocked_write_release(vo id* volatile*, void*)': c:/ming64/projects/boost/rel-1.46w64/include/boost-1_46_1/boost/thread/win32/int erlocked_read.hpp:71:13: error: cast from 'void*' to 'long int' loses precision In file included from c:/ming64/projects/boost/rel-1.46w64/include/boost-1_46_1/ boost/thread/win32/mutex.hpp:8:0, from c:/ming64/projects/boost/rel-1.46w64/include/boost-1_46_1/ boost/thread/mutex.hpp:14, from c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/Kd_tr ee.h:34, from c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/inter nal/K_neighbor_search.h:28, from c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/Ortho gonal_k_neighbor_search.h:24, from c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/inter nal/AABB_tree/AABB_search_tree.h:24, from c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/AABB_ tree.h:28, from c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/Polyh edral_mesh_domain_3.h:33, from c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/inter section_of_Polyhedra_3_refinement_visitor.h:32, from c:/ming64/projects/CGAL/SFCGAL-0.2/src/SFCGAL/algorithm/In tersection3D.cpp:25: c:/ming64/projects/boost/rel-1.46w64/include/boost-1_46_1/boost/thread/win32/bas ic_timed_mutex.hpp: In member function 'void* boost::detail::basic_timed_mutex:: get_event()': c:/ming64/projects/boost/rel-1.46w64/include/boost-1_46_1/boost/thread/win32/bas ic_timed_mutex.hpp:183:43: error: cast from 'void*' to 'long int' loses precisio n In file included from c:/ming64/projects/CGAL/SFCGAL-0.2/src/SFCGAL/algorithm/In tersection3D.cpp:24:0: c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/intersection_of_Polyhedra_3 .h: In member function 'bool CGAL::internal_IOP::Order_along_a_halfedge<Polyhedr on, Nodes_vector, Is_const>::operator()(int, int) const [with Polyhedron = CGAL: :Polyhedron_3<CGAL::Epeck, SFCGAL::Items_with_mark_on_hedge>, Nodes_vector = CGA L::internal_IOP::Triangle_segment_intersection_points<CGAL::Polyhedron_3<CGAL::E peck, SFCGAL::Items_with_mark_on_hedge>, CGAL::Epeck, CGAL::internal_IOP::Predic ates_on_constructions, true>, Is_const = CGAL::Boolean_tag<false>]': c:\ming64\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.4/../../../../x86_64-w64 -mingw32/include/c++/4.5.4/bits/stl_algo.h:2125:4: instantiated from 'void std ::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<int*, std::vector<int> >, _Compare = CGAL::internal_IOP::Order_along_a_halfedge<CGAL::Polyhedron_3<CGAL::E peck, SFCGAL::Items_with_mark_on_hedge>, CGAL::internal_IOP::Triangle_segment_in tersection_points<CGAL::Polyhedron_3<CGAL::Epeck, SFCGAL::Items_with_mark_on_hed ge>, CGAL::Epeck, CGAL::internal_IOP::Predicates_on_constructions, true>, CGAL:: Boolean_tag<false> >]' c:\ming64\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.4/../../../../x86_64-w64 -mingw32/include/c++/4.5.4/bits/stl_algo.h:2192:4: instantiated from 'void std ::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<int*, std::vector<in t> >, _Compare = CGAL::internal_IOP::Order_along_a_halfedge<CGAL::Polyhedron_3<C GAL::Epeck, SFCGAL::Items_with_mark_on_hedge>, CGAL::internal_IOP::Triangle_segm ent_intersection_points<CGAL::Polyhedron_3<CGAL::Epeck, SFCGAL::Items_with_mark_ on_hedge>, CGAL::Epeck, CGAL::internal_IOP::Predicates_on_constructions, true>, CGAL::Boolean_tag<false> >]' c:\ming64\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.4/../../../../x86_64-w64 -mingw32/include/c++/4.5.4/bits/stl_algo.h:5252:4: instantiated from 'void std ::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator< int*, std::vector<int> >, _Compare = CGAL::internal_IOP::Order_along_a_halfedge< CGAL::Polyhedron_3<CGAL::Epeck, SFCGAL::Items_with_mark_on_hedge>, CGAL::interna l_IOP::Triangle_segment_intersection_points<CGAL::Polyhedron_3<CGAL::Epeck, SFCG AL::Items_with_mark_on_hedge>, CGAL::Epeck, CGAL::internal_IOP::Predicates_on_co nstructions, true>, CGAL::Boolean_tag<false> >]' c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/intersection_of_Polyhedra_3 _refinement_visitor.h:677:5: instantiated from 'void CGAL::Node_visitor_refine _polyhedra<Polyhedron, Kernel, Mark_intersection_halfedges>::sort_vertices_along _hedge(std::vector<int>&, CGAL::Node_visitor_refine_polyhedra<Polyhedron, Kernel , Mark_intersection_halfedges>::Halfedge_handle, const Nodes_vector&) [with Node s_vector = CGAL::internal_IOP::Triangle_segment_intersection_points<CGAL::Polyhe dron_3<CGAL::Epeck, SFCGAL::Items_with_mark_on_hedge>, CGAL::Epeck, CGAL::intern al_IOP::Predicates_on_constructions, true>, Polyhedron = CGAL::Polyhedron_3<CGAL ::Epeck, SFCGAL::Items_with_mark_on_hedge>, Kernel = CGAL::Epeck, Mark_intersect ion_halfedges = CGAL::Boolean_tag<true>, CGAL::Node_visitor_refine_polyhedra<Pol yhedron, Kernel, Mark_intersection_halfedges>::Halfedge_handle = CGAL::internal: :In_place_list_iterator<CGAL::HalfedgeDS_in_place_list_halfedge<CGAL::I_Polyhedr on_halfedge<SFCGAL::Halfedge_with_mark<CGAL::HalfedgeDS_list_types<CGAL::Epeck, CGAL::I_Polyhedron_derived_items_3<SFCGAL::Items_with_mark_on_hedge>, std::alloc ator<int> > > > >, std::allocator<CGAL::HalfedgeDS_in_place_list_halfedge<CGAL:: I_Polyhedron_halfedge<SFCGAL::Halfedge_with_mark<CGAL::HalfedgeDS_list_types<CGA L::Epeck, CGAL::I_Polyhedron_derived_items_3<SFCGAL::Items_with_mark_on_hedge>, std::allocator<int> > > > > > >]' c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/intersection_of_Polyhedra_3 _refinement_visitor.h:1494:7: instantiated from 'void CGAL::Node_visitor_refin e_polyhedra<Polyhedron, Kernel, Mark_intersection_halfedges>::finalize(const Nod es_vector&) [with Nodes_vector = CGAL::internal_IOP::Triangle_segment_intersecti on_points<CGAL::Polyhedron_3<CGAL::Epeck, SFCGAL::Items_with_mark_on_hedge>, CGA L::Epeck, CGAL::internal_IOP::Predicates_on_constructions, true>, Polyhedron = C GAL::Polyhedron_3<CGAL::Epeck, SFCGAL::Items_with_mark_on_hedge>, Kernel = CGAL: :Epeck, Mark_intersection_halfedges = CGAL::Boolean_tag<true>]' c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/intersection_of_Polyhedra_3 .h:1850:7: instantiated from 'OutputIterator CGAL::Intersection_of_Polyhedra_3 <Polyhedron, Kernel, Node_visitor, Node_storage_type, Use_const_polyhedron>::mai n_run(OutputIterator, bool) [with OutputIterator = std::back_insert_iterator<std ::list<std::vector<CGAL::Point_3<CGAL::Epeck> > > >, Polyhedron = CGAL::Polyhedr on_3<CGAL::Epeck, SFCGAL::Items_with_mark_on_hedge>, Kernel = CGAL::Epeck, Node_ visitor = CGAL::Node_visitor_refine_polyhedra<CGAL::Polyhedron_3<CGAL::Epeck, SF CGAL::Items_with_mark_on_hedge>, CGAL::Epeck, CGAL::Boolean_tag<true> >, Node_st orage_type = CGAL::internal_IOP::Predicates_on_constructions, Use_const_polyhedr on = CGAL::Boolean_tag<false>]' c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/intersection_of_Polyhedra_3 .h:1956:24: instantiated from 'OutputIterator CGAL::Intersection_of_Polyhedra_ 3<Polyhedron, Kernel, Node_visitor, Node_storage_type, Use_const_polyhedron>::op erator()(CGAL::Intersection_of_Polyhedra_3<Polyhedron, Kernel, Node_visitor, Nod e_storage_type, Use_const_polyhedron>::Polyhedron_ref, CGAL::Intersection_of_Pol yhedra_3<Polyhedron, Kernel, Node_visitor, Node_storage_type, Use_const_polyhedr on>::Polyhedron_ref, OutputIterator) [with OutputIterator = std::back_insert_ite rator<std::list<std::vector<CGAL::Point_3<CGAL::Epeck> > > >, Polyhedron = CGAL: :Polyhedron_3<CGAL::Epeck, SFCGAL::Items_with_mark_on_hedge>, Kernel = CGAL::Epe ck, Node_visitor = CGAL::Node_visitor_refine_polyhedra<CGAL::Polyhedron_3<CGAL:: Epeck, SFCGAL::Items_with_mark_on_hedge>, CGAL::Epeck, CGAL::Boolean_tag<true> > , Node_storage_type = CGAL::internal_IOP::Predicates_on_constructions, Use_const _polyhedron = CGAL::Boolean_tag<false>, CGAL::Intersection_of_Polyhedra_3<Polyhe dron, Kernel, Node_visitor, Node_storage_type, Use_const_polyhedron>::Polyhedron _ref = CGAL::Polyhedron_3<CGAL::Epeck, SFCGAL::Items_with_mark_on_hedge>&]' c:/ming64/projects/CGAL/SFCGAL-0.2/src/SFCGAL/algorithm/Intersection3D.cpp:124:6 4: instantiated from here c:/ming64/projects/CGAL/rel-cgal-4.2w64/include/CGAL/intersection_of_Polyhedra_3 .h:187:40: warning: unused variable 'p' make[2]: *** [src/CMakeFiles/SFCGAL.dir/SFCGAL/algorithm/Intersection3D.cpp.obj] Error 1 make[1]: *** [src/CMakeFiles/SFCGAL.dir/all] Error 2 make: *** [all] Error 2

### Change History (12)

### comment:1 by , 11 years ago

### comment:2 by , 11 years ago

Hi,

Seems to be related to this bug report : https://svn.boost.org/trac/boost/ticket/4839

If I understand it correctly : you would either have to patch against 1.46 or use the 1.49 version …

### comment:3 by , 11 years ago

### comment:4 by , 11 years ago

Currently focussed on the mingw64-w32 and will revisit the other later. I bumped up to boost 1.53 which is supposed to have all the mingw issues fixed from what I've read, but sadly still failing at linker when it gets to building the SFCGAL.dll

undefined reference to `_imp___ZN5boost6detail12set_tss_dataEPKvNS_10shared_ptrINS0_20tss_cleanup_functionEEEPvb'

I think static building might be my issue so trying to switch boost to dynamic in cgal and sfcgal.

### comment:5 by , 11 years ago

This symbol is part of boost thread. Apprently cmake finds it, so it should work. But, yes I never tried with a static boost, only a dynamic linked one, should be that.

If you still have compiling/linking issues, could you use 'make VERBOSE=1' and copy the last lines in order to have the real compiler command line that is called ?

### comment:6 by , 11 years ago

here is what it looks like at the end before the linker chokes:

: [100%] Building CXX object src/CMakeFiles/SFCGAL.dir/SFCGAL/version.cpp.obj cd /C/ming32/projects/CGAL/SFCGAL-0.2/build/mingw/src && /c/ming32/mingw32/bin/g++.exe -DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB -DSFCGAL_EXPORTS -Wall -Wno-long-long -pedantic @CMakeFiles/SFCGAL.dir/includes_CXX.rsp -frounding-math -o CMakeFiles/SFCGAL.dir/SFCGAL/version.cpp.obj -c /C/ming32/projects/CGAL/SFCGAL-0.2/src/SFCGAL/version.cpp Linking CXX shared library libSFCGAL.dll cd /C/ming32/projects/CGAL/SFCGAL-0.2/build/mingw/src && /c/ming32/cmake-2.8.10.2-win32-x86/bin/cmake.exe -E remove -f CMakeFiles/SFCGAL.dir/objects.a cd /C/ming32/projects/CGAL/SFCGAL-0.2/build/mingw/src && /c/ming32/mingw32/bin/ar.exe cr CMakeFiles/SFCGAL.dir/objects.a @CMakeFiles/SFCGAL.dir/objects1.rsp cd /C/ming32/projects/CGAL/SFCGAL-0.2/build/mingw/src && /c/ming32/mingw32/bin/g++.exe -shared -o libSFCGAL.dll -Wl,--out-implib,libSFCGAL.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -Wl,--whole-archive CMakeFiles/SFCGAL.dir/objects.a -Wl,--no-whole-archive -L/c/ming32/projects/CGAL/rel-cgal-4.2w32/lib -L/c/ming32/projects/boost/rel-1_49_0w32/lib /c/ming32/projects/CGAL/rel-gmp-5.1.1w32/bin/libgmp-10.dll /c/ming32/projects/CGAL/rel-mpfr-3.1.2w32/lib/libmpfr.dll.a /c/ming32/projects/CGAL/rel-cgal-4.2w32/lib/libCGAL.a /c/ming32/projects/CGAL/rel-cgal-4.2w32/lib/libCGAL_Core.a /c/ming32/projects/boost/rel-1_49_0w32/lib/libboost_date_time-mgw45-mt-1_49.a /c/ming32/projects/boost/rel-1_49_0w32/lib/libboost_system-mgw45-mt-1_49.a /c/ming32/projects/boost/rel-1_49_0w32/lib/libboost_thread-mgw45-mt-1_49.a /c/ming32/projects/boost/rel-1_49_0w32/lib/libboost_serialization-mgw45-mt-1_49.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32

This one is trying to use 1.49 again. I've been flip flopping between 1.49 and 1.53 with much the same error. Unfortunately I'm not having much luck getting boost to compile dynamically under mingw if I leave out static — it naturally compiles statically and if I put in explicit dynamic I get a whole slew of errors at the boost compile phase.

For pgrouting I use 1.46 compiled statically and CGAL 3.9 and that seems to work fine together.

### comment:7 by , 11 years ago

Good news, I finally got SFCGAL to compile on my mingw32. Haven't retried on my mingw64 yet and haven't tried next step of building postgis with sfcgal. Trick was I had to change my boost command to also build shared

OS_BUILD=32 PROJECTS=/c/ming${OS_BUILD}/projects BOOST_VER=1.53.0 BOOST_VER_WU=1_53_0 bjam toolset=gcc address-model=${OS_BUILD} threading=multi variant=debug,release link=static,shared --with-thread --with-system --with-date_time --with-serialization --prefix=${PROJECTS}/boost/rel-${BOOST_VER_WU}w${OS_BUILD} install

and then rebuild CGAL

### comment:8 by , 11 years ago

Milestone: | PostGIS 2.1.0 → PostGIS 2.2.0 |
---|

while I have compiles having trouble using in PostGIS — I'm sure its just my paths off or something but fails on finding includes. I'm pushing this to 2.2 since I won't be distributing sfcgal with windows until PostGIS 2.2 especialy since dustymugs found valgrind memory issues with it under linux that concerned him.

### comment:9 by , 10 years ago

Made some big progress. Got sfcgal 1.0.4 compiling with PostGIS 2.2 dev. Unfortunately my make check is not quite working.

However I was able to install in my 9.4beta1 w32 edb and do this:

SELECT ST_AsText(ST_Extrude(ST_Buffer(ST_Point(1,2),10),3,4,5));

and get a poiyhedralsurface z back.

I have to retrace my steps since I ran into a lot of issues.

For example I had to fiddle with the SFCGAL cmake output to get mpfr listed before gmp as documented in FAQ 5: http://www.mpfr.org/faq.html#undef_ref2

I'll retrace my steps to confirm that was what I did to fix it.

Also the sfcgal-config file has the generated .dll being looked for in the lib folder (though the .dll.a was in lib), but CMake had installed it in the bin folder, so had to copy it to lib to be found by PostGIS.

### comment:10 by , 10 years ago

Bah for some reason I can't submit a ticket to github on SFCGALwith my patch. submit button is disabled. I could be imagining things.

Anyrate. Just tried compiling sfcgal on my mingw-w64 64-bit gcc 4.8.0 and ran into same issue during link phase:

Linking CXX shared library libSFCGAL.dll c:/ming64gcc48/projects/CGAL/rel-mpfr-3.1.2w64gcc48/lib/libmpfr.a(init2.o):init2.c:(.text+0x70): undefined reference to `__gmp_get_memory_functions' c:/ming64gcc48/projects/CGAL/rel-mpfr-3.1.2w64gcc48/lib/libmpfr.a(clear.o):clear.c:(.text+0x1e): undefined reference to `__gmp_get_memory_functions' c:/ming64gcc48/projects/CGAL/rel-mpfr-3.1.2w64gcc48/lib/libmpfr.a(div.o):div.c:(.text+0x234): undefined reference to `__gmpn_divrem' c:/ming64gcc48/projects/CGAL/rel-mpfr-3.1.2w64gcc48/lib/libmpfr.a(round_prec.o):round_prec.c:(.text+0xa76): undefined reference to `__gmp_get_memory_functions' c:/ming64gcc48/projects/CGAL/rel-mpfr-3.1.2w64gcc48/lib/libmpfr.a(mulders.o):mulders.c:(.text+0x5c2): undefined reference to `__gmpn_divrem' c:/ming64gcc48/projects/CGAL/rel-mpfr-3.1.2w64gcc48/lib/libmpfr.a(mulders.o):mulders.c:(.text+0x94c): undefined reference to `__gmpn_divrem' c:/ming64gcc48/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.0/../../../../x86_64-w64-mingw32/bin/ld.exe: c:/ming64gcc48/projects/CGAL/rel-mpfr-3.1.2w64gcc48/lib/libmpfr.a(mulders.o): bad reloc address 0x0 in section `.pdata' collect2.exe: error: ld returned 1 exit status

I was able to fix by changing the src/CMakeLists.txt file packaged with sfcgal 1.0.4 by swapping the order of MPFR and GMP (basically moving MPFR above GMP)

So changing from

if( ${SFCGAL_WITH_GMP} ) target_link_libraries( SFCGAL ${GMP_LIBRARIES} ) endif( ${SFCGAL_WITH_GMP} ) if( ${SFCGAL_WITH_MPFR} ) target_link_libraries( SFCGAL ${MPFR_LIBRARIES} ) endif( ${SFCGAL_WITH_MPFR} )

To:

if( ${SFCGAL_WITH_MPFR} ) target_link_libraries( SFCGAL ${MPFR_LIBRARIES} ) endif( ${SFCGAL_WITH_MPFR} ) if( ${SFCGAL_WITH_GMP} ) target_link_libraries( SFCGAL ${GMP_LIBRARIES} ) endif( ${SFCGAL_WITH_GMP} )

I'll close this out once I've successfully posted the issue to github sfcgal issue tracker.

### comment:11 by , 10 years ago

Milestone: | PostGIS 2.2.0 → PostGIS SFCGAL |
---|

Posted to https://github.com/Oslandia/SFCGAL/issues/59

Since this is really an SFCGAL issue entirely and not PostGIS , flipping to PostGIS SFCGAL and will close once fixed in SFCGAL code base.

### comment:12 by , 10 years ago

Resolution: | → fixed |
---|---|

Status: | new → closed |

https://github.com/Oslandia/SFCGAL/issues/59 is closed thanks to robe

**Note:**See TracTickets for help on using tickets.

The mingw64-w32 is failing at the linker phase. For pgRouting I had to apply a patch to boost and cgal that swoodbridge had provided me to get pgrouting to work. I'll see if maybe I need to do the same here.

I also noticed earlier own I had two sets of mpr and gmp so I need to make sure the includ eand lib match its picking up.