Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

CGAL 5.0 support #198

Closed
joachim-reichel opened this issue Nov 5, 2019 · 6 comments · Fixed by #219
Closed

CGAL 5.0 support #198

joachim-reichel opened this issue Nov 5, 2019 · 6 comments · Fixed by #219
Assignees

Comments

@joachim-reichel
Copy link

Your package fails to build with CGAL 5.0 Beta 2. I modified the top-level CMakeLists.txt as follows:

  • add set(CMAKE_CXX_STANDARD 14)
  • remove block with "c++98"
  • remove "4.3" from find_package() call

When trying to link the unit test, it fails with
/usr/bin/ld: CMakeFiles/unit-test-SFCGAL.dir/SFCGAL/algorithm/Force3DTest.cpp.o: in function `SFCGAL_algorithm_Force3DTest::testIgnoreEmpty::test_method()': ./obj-x86_64-linux-gnu/test/unit/./test/unit/SFCGAL/algorithm/Force3DTest.cpp:57: undefined reference to `SFCGAL::algorithm::force3D(SFCGAL::Geometry&, CGAL::Lazy_exact_nt<boost::multiprecision::number<boost::multiprecision::backends::gmp_rational, (boost::multiprecision::expression_template_option)1> > const&)' /usr/bin/ld: CMakeFiles/unit-test-SFCGAL.dir/SFCGAL/algorithm/Force3DTest.cpp.o: in function `SFCGAL_algorithm_Force3DTest::testPointForceZ::test_method()': ./obj-x86_64-linux-gnu/test/unit/./test/unit/SFCGAL/algorithm/Force3DTest.cpp:65: undefined reference to `SFCGAL::algorithm::force3D(SFCGAL::Geometry&, CGAL::Lazy_exact_nt<boost::multiprecision::number<boost::multiprecision::backends::gmp_rational, (boost::multiprecision::expression_template_option)1> > const&)' /usr/bin/ld: CMakeFiles/unit-test-SFCGAL.dir/SFCGAL/algorithm/Force3DTest.cpp.o: in function `SFCGAL_algorithm_Force3DTest::testPointForceZWithValue::test_method()': ./obj-x86_64-linux-gnu/test/unit/./test/unit/SFCGAL/algorithm/Force3DTest.cpp:71: undefined reference to `SFCGAL::algorithm::force3D(SFCGAL::Geometry&, CGAL::Lazy_exact_nt<boost::multiprecision::number<boost::multiprecision::backends::gmp_rational, (boost::multiprecision::expression_template_option)1> > const&)' /usr/bin/ld: CMakeFiles/unit-test-SFCGAL.dir/SFCGAL/algorithm/Force3DTest.cpp.o: in function `SFCGAL_algorithm_Force3DTest::test_MixedLineString2D3D::test_method()': ./obj-x86_64-linux-gnu/test/unit/./test/unit/SFCGAL/algorithm/Force3DTest.cpp:82: undefined reference to `SFCGAL::algorithm::force3D(SFCGAL::Geometry&, CGAL::Lazy_exact_nt<boost::multiprecision::number<boost::multiprecision::backends::gmp_rational, (boost::multiprecision::expression_template_option)1> > const&)' /usr/bin/ld: CMakeFiles/unit-test-SFCGAL.dir/SFCGAL/algorithm/UnionTest.cpp.o: in function `SFCGAL_algorithm_UnionTest::PolygonPolygon2::test_method()': ./obj-x86_64-linux-gnu/test/unit/./test/unit/SFCGAL/algorithm/UnionTest.cpp:230: undefined reference to `SFCGAL::algorithm::translate(SFCGAL::Geometry&, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::Lazy_exact_nt<CGAL::Gmpq>)' /usr/bin/ld: ./obj-x86_64-linux-gnu/test/unit/./test/unit/SFCGAL/algorithm/UnionTest.cpp:234: undefined reference to `SFCGAL::algorithm::translate(SFCGAL::Geometry&, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::Lazy_exact_nt<CGAL::Gmpq>)' /usr/bin/ld: CMakeFiles/unit-test-SFCGAL.dir/SFCGAL/algorithm/UnionTest.cpp.o: in function `SFCGAL_algorithm_UnionTest::PolygonPolygon3::test_method()': ./obj-x86_64-linux-gnu/test/unit/./test/unit/SFCGAL/algorithm/UnionTest.cpp:259: undefined reference to `SFCGAL::algorithm::translate(SFCGAL::Geometry&, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::Lazy_exact_nt<CGAL::Gmpq>)' /usr/bin/ld: ./obj-x86_64-linux-gnu/test/unit/./test/unit/SFCGAL/algorithm/UnionTest.cpp:261: undefined reference to `SFCGAL::algorithm::translate(SFCGAL::Geometry&, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::Lazy_exact_nt<CGAL::Gmpq>)' /usr/bin/ld: CMakeFiles/unit-test-SFCGAL.dir/SFCGAL/algorithm/UnionTest.cpp.o: in function `SFCGAL_algorithm_UnionTest::VolumeVolume::test_method()': ./obj-x86_64-linux-gnu/test/unit/./test/unit/SFCGAL/algorithm/UnionTest.cpp:363: undefined reference to `SFCGAL::algorithm::translate(SFCGAL::Geometry&, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::Lazy_exact_nt<CGAL::Gmpq>)' /usr/bin/ld: CMakeFiles/unit-test-SFCGAL.dir/SFCGAL/algorithm/UnionTest.cpp.o:./obj-x86_64-linux-gnu/test/unit/./test/unit/SFCGAL/algorithm/UnionTest.cpp:370: more undefined references to `SFCGAL::algorithm::translate(SFCGAL::Geometry&, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::Lazy_exact_nt<CGAL::Gmpq>)' follow /usr/bin/ld: CMakeFiles/unit-test-SFCGAL.dir/SFCGAL/transform/ForceZOrderPointsTest.cpp.o: in function `SFCGAL_transform_ForceZOrderPointsTest::simple::test_method()': ./obj-x86_64-linux-gnu/test/unit/./test/unit/SFCGAL/transform/ForceZOrderPointsTest.cpp:40: undefined reference to `SFCGAL::transform::ForceZOrderPoints::ForceZOrderPoints(CGAL::Lazy_exact_nt<boost::multiprecision::number<boost::multiprecision::backends::gmp_rational, (boost::multiprecision::expression_template_option)1> > const&)' collect2: error: ld returned 1 exit status

@mhugo
Copy link
Contributor

mhugo commented Nov 6, 2019

A related PR (#197) has just been merged. Could you please test with an updated master ?

@joachim-reichel
Copy link
Author

joachim-reichel commented Nov 7, 2019

Same result. #197 contains the three changes that I mentioned above (plus unrelated auto_ptr/unique_ptr fixes), but nothing that seems related to fixing these linker errors.
Tested on Debian sid, amd64, CGAL 5.0 Beta 2. SFCGAL is configured with -DSFCGAL_BUILD_TESTS=ON.

Update: "set(CMAKE_CXX_STANDARD 14)" is actually not contained in #197, but that does not make a difference.

@joachim-reichel
Copy link
Author

The library provides
SFCGAL::algorithm::force3D(SFCGAL::Geometry&, CGAL::Lazy_exact_nt<CGAL::Gmpq> const&)
whereas the test wants
SFCGAL::algorithm::force3D(SFCGAL::Geometry&, CGAL::Lazy_exact_nt<boost::multiprecision::number<boost::multiprecision::backends::gmp_rational, (boost::multiprecision::expression_template_option)1> > const&)
Looks as if the library and the tests disagree about the CGAL number type.
This can be worked around by adding add_definitions( "-DCGAL_USE_GMPXX=1" ) to top-level CMakeLists.txt and adding gmp to target_link_libraries(...) of all the tests.

@sebastic
Copy link
Contributor

sebastic commented Dec 6, 2019

Note that PostGIS fails to build with SFCGAL when the patches for this issue are applied.

@sebastic
Copy link
Contributor

sebastic commented Dec 8, 2019

The following patch fixed the PostGIS build failure:

Description: Add gmpxx to `sfcgal-config --libs`.
 Fixes link errors:
 .
 /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libSFCGAL.so: undefined reference to `operator>>(std::istream&, __mpz_struct*)'
 /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libSFCGAL.so: undefined reference to `operator<<(std::ostream&, __mpz_struct const*)'
Author: Bas Couwenberg <sebastic@debian.org>

--- a/sfcgal-config.in
+++ b/sfcgal-config.in
@@ -38,7 +38,7 @@ case $1 in
        echo -I${prefix}/include 
        ;;
     --libs)
-       echo -L${libdir} -l@SFCGAL_LIB_NAME@
+       echo -L${libdir} -l@SFCGAL_LIB_NAME@ -lgmpxx
        ;;
     --ldflags)
        echo -L${libdir}

The is similar to the link issue with the tests for which @joachim-reichel provided this patch:

https://salsa.debian.org/debian-gis-team/sfcgal/blob/debian/1.3.7-3/debian/patches/fix-linker-error.patch

@devrimgunduz
Copy link

Hi,

This issue also hits Fedora 32. Will you release a new version?

@lbartoletti lbartoletti self-assigned this Apr 21, 2020
This was referenced Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants