1

I started using vcpkg for my code base. I have included the following manifest

{
  "name": "project",
  "version-string": "0.1.1",
  "dependencies" : [
    "boost-filesystem",
    "boost-system",
    "boost-timer",
    "eigen3",
    "opencv",
    "spdlog",
    "jsoncpp",
    {
      "name": "opencascade",
      "features" : [ "freeimage" ]
    }
}

My OS is Linux Mint, I then configure my project using cmake

cmake -DCMAKE_TOOLCHAIN_FILE=/home/ali/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -GNinja ..

When I build my software in this setting I get the following errors ( reduced to a few lines but the rest is the same as these )

/usr/bin/ld: ShapeUpgrade_ConvertSurfaceToBezierBasis.cxx:(.text+0x4c62): undefined reference 
 to `GeomConvert_BSplineSurfaceToBezierSurface::UKnots(NCollection_Array1<double>&) const'                                                       
/usr/bin/ld: ShapeUpgrade_ConvertSurfaceToBezierBasis.cxx:(.text+0x4e96): undefined reference 
to `GeomConvert_BSplineSurfaceToBezierSurface::VKnots(NCollection_Array1<double>&) const'                                                       
/usr/bin/ld: ShapeUpgrade_ConvertSurfaceToBezierBasis.cxx:(.text+0x5280): undefined reference 
to `GeomConvert_BSplineSurfaceToBezierSurface::Patches(NCollection_Array2<opencascade::handle<Geom_BezierSurface> >&)'                          
/usr/bin/ld: /home/ali/vcpkg/installed/x64-linux/lib/libTKGeomBase.a(IntAna2d_Conic.cxx.o): in 
function `IntAna2d_Conic::IntAna2d_Conic(gp_Elips2d const&)':
IntAna2d_Conic.cxx:(.text+0xe7): undefined reference to `gp_Elips2d::Coefficients(double&, 
double&, double&, double&, double&, double&) const'                                                                                                
/usr/bin/ld: /home/ali/vcpkg/installed/x64-linux/lib/libTKGeomBase.a(IntAna2d_Conic.cxx.o): in 
function `IntAna2d_Conic::IntAna2d_Conic(gp_Hypr2d const&)':                                                                                   
IntAna2d_Conic.cxx:(.text+0x147): undefined reference to `gp_Hypr2d::Coefficients(double&, 
double&, double&, double&, double&, double&) const'                                                                                                
/usr/bin/ld: /home/ali/vcpkg/installed/x64-linux/lib/libTKGeomBase.a(gce_MakeLin2d.cxx.o): in 
function `gce_MakeLin2d::gce_MakeLin2d(double, double, double)':                                                                                
gce_MakeLin2d.cxx:(.text+0xd4): undefined reference to `gp_Lin2d::gp_Lin2d(double, double, 
double)'                                                                                                                                           
collect2: error: ld returned 1 exit status

I don't see how there should be a linker issue with internal opencascade code. The libraries exist in the same directory.

Thanks for the help.

Ashkan
  • 1,050
  • 15
  • 32
  • When you link static libraries (which is default in vcpkg on linux), there is no such thing as an internal dependency. You have to make sure that every library that contains a symbol is passed to your linker command. This is usually done by libraries themeselves in a config file, but some libraries don't specify their dependencies, so you have to write required `find_package + target_link_libraries` manually. – Osyotr Jun 29 '22 at 20:14
  • @Osyotr so if libraries are installed system wide I would not see this issue? – Ashkan Jun 30 '22 at 10:16
  • You will still have this issue. You need to pass additional libraries to compiler, an example on how to do it in cmake is above. – Osyotr Jun 30 '22 at 17:49
  • The reason I ask is that I can compile fine when using system-wide installed libraries. It is only when I try to integrate vcpkg that I see this error – Ashkan Jul 01 '22 at 06:54

0 Answers0