Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] compiling CGAL into a static library for use in a DLL

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] compiling CGAL into a static library for use in a DLL


Chronological Thread 
  • From: "Laurent Rineau (CGAL/GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] compiling CGAL into a static library for use in a DLL
  • Date: Wed, 05 Jun 2013 11:51:20 +0200
  • Organization: GeometryFactory

Le mardi 04 juin 2013 14:35:00 Cody Rose a écrit :
> Hello,
>
> I'd like to compile CGAL into a static library for use in a dynamic
> library we're distributing (we have a commercial license for this), but
> I'm having some trouble getting it to link. I can generate the static
> versions of the CGAL libraries fine (by unsetting BUILD_SHARED_LIBS in
> Cmake). When I try to build a static library or an .exe using them,
> everything is great, but when I try to build them into a .dll I get the
> following link errors:

Hi,

Your compilation process tries to link two different versions of boost_thread
into one binary:

> libboost_thread-vc100-mt-gd-1_47.lib(thread.obj) : error LNK2005: "void
> __cdecl boost::detail::free_raw_heap_memory(void *)"
> (?free_raw_heap_memory@detail@boost@@YAXPAX@Z) already defined in
> boost_thread-vc100-mt-gd-1_47.lib(boost_thread-vc100-mt-gd-1_47.dll)

The error says that a part of of the static libboost_thread-vc100-mt-
gd-1_47.lib (the obj thread.obj) is scheduled to be linked, but the shared
boost library boost_thread-vc100-mt-gd-1_47.lib is already linked.

I see that you have modified BUILD_SHARED_LIBS so that CGAL libraries are
compiled to static libraries. By default, then, the static boost_thread is
linked into CGAL.lib. I think you should reconfigure the CGAL libraries with
CGAL_Boost_USE_STATIC_LIBS set to FALSE, so that your build process always
use
shared Boost libraries (if that is what you want).

Best regards,

--
Laurent Rineau, PhD
R&D Engineer at GeometryFactory http://www.geometryfactory.com/
Release Manager of the CGAL Project http://www.cgal.org/




Archive powered by MHonArc 2.6.18.

Top of Page