meshadaptation / pragmatic

Anisotropic mesh adaptation library
Other
55 stars 18 forks source link

clang linking error #22

Closed cmaurini closed 9 years ago

cmaurini commented 9 years ago

I get the following error at linking time when using clangon macosx

[ 90%] Building CXX object CMakeFiles/pragmatic.dir/src/mpi_tools.cpp.o
warning: unknown warning option '-Wno-literal-suffix'; did you mean '-Wno-literal-range'? [-Wunknown-warning-option]
1 warning generated.
[100%] Building CXX object CMakeFiles/pragmatic.dir/src/ticker.cpp.o
warning: unknown warning option '-Wno-literal-suffix'; did you mean '-Wno-literal-range'? [-Wunknown-warning-option]
1 warning generated.
Linking CXX shared library lib/libpragmatic.dylib
Undefined symbols for architecture x86_64:
  "vtkIntArray::New()", referenced from:
      vtkSmartPointer<vtkIntArray>::New() in cpragmatic.cpp.o
  "vtkDataArray::GetTuple1(long long)", referenced from:
      VTKTools<double>::import_vtu(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in cpragmatic.cpp.o
  "vtkDataArray::SetTuple1(long long, double)", referenced from:
      VTKTools<double>::export_vtu(char const*, Mesh<double> const*, double const*) in cpragmatic.cpp.o
  "vtkDataArray::SetTuple3(long long, double, double, double)", referenced from:
      VTKTools<double>::export_vtu(char const*, Mesh<double> const*, double const*) in cpragmatic.cpp.o
  "vtkDataArray::SetTuple4(long long, double, double, double, double)", referenced from:
      VTKTools<double>::export_vtu(char const*, Mesh<double> const*, double const*) in cpragmatic.cpp.o
  "vtkDataArray::SetTuple9(long long, double, double, double, double, double, double, double, double, double)", referenced from:
      VTKTools<double>::export_vtu(char const*, Mesh<double> const*, double const*) in cpragmatic.cpp.o
  "vtkFieldData::AddArray(vtkAbstractArray*)", referenced from:
      VTKTools<double>::export_vtu(char const*, Mesh<double> const*, double const*) in cpragmatic.cpp.o
  "vtkFieldData::GetArray(char const*, int&)", referenced from:
      vtkFieldData::GetArray(char const*) in cpragmatic.cpp.o
  "vtkXMLWriter::Write()", referenced from:
      VTKTools<double>::export_vtu(char const*, Mesh<double> const*, double const*) in cpragmatic.cpp.o
  "vtkXMLWriter::SetInput(vtkDataObject*)", referenced from:
      VTKTools<double>::export_vtu(char const*, Mesh<double> const*, double const*) in cpragmatic.cpp.o
  "vtkDoubleArray::New()", referenced from:
      vtkSmartPointer<vtkDoubleArray>::New() in cpragmatic.cpp.o
  "vtkIdTypeArray::New()", referenced from:
      vtkSmartPointer<vtkIdTypeArray>::New() in cpragmatic.cpp.o
  "vtkSmartPointerBase::vtkSmartPointerBase(vtkObjectBase*)", referenced from:
      vtkSmartPointer<vtkDoubleArray>::vtkSmartPointer(vtkDoubleArray*) in cpragmatic.cpp.o
  "vtkSmartPointerBase::vtkSmartPointerBase(vtkObjectBase*, vtkSmartPointerBase::NoReference const&)", referenced from:
      vtkSmartPointer<vtkXMLUnstructuredGridReader>::vtkSmartPointer(vtkXMLUnstructuredGridReader*, vtkSmartPointerBase::NoReference const&) in cpragmatic.cpp.o
      vtkSmartPointer<vtkXMLPUnstructuredGridReader>::vtkSmartPointer(vtkXMLPUnstructuredGridReader*, vtkSmartPointerBase::NoReference const&) in cpragmatic.cpp.o
      vtkSmartPointer<vtkUnstructuredGrid>::vtkSmartPointer(vtkUnstructuredGrid*, vtkSmartPointerBase::NoReference const&) in cpragmatic.cpp.o
      vtkSmartPointer<vtkXMLPUnstructuredGridWriter>::vtkSmartPointer(vtkXMLPUnstructuredGridWriter*, vtkSmartPointerBase::NoReference const&) in cpragmatic.cpp.o
      vtkSmartPointer<vtkIdTypeArray>::vtkSmartPointer(vtkIdTypeArray*, vtkSmartPointerBase::NoReference const&) in cpragmatic.cpp.o
      vtkSmartPointer<vtkUnsignedCharArray>::vtkSmartPointer(vtkUnsignedCharArray*, vtkSmartPointerBase::NoReference const&) in cpragmatic.cpp.o
      vtkSmartPointer<vtkXMLUnstructuredGridWriter>::vtkSmartPointer(vtkXMLUnstructuredGridWriter*, vtkSmartPointerBase::NoReference const&) in cpragmatic.cpp.o
      ...
  "vtkSmartPointerBase::~vtkSmartPointerBase()", referenced from:
      vtkSmartPointer<vtkUnstructuredGrid>::~vtkSmartPointer() in cpragmatic.cpp.o
      vtkSmartPointer<vtkXMLUnstructuredGridReader>::~vtkSmartPointer() in cpragmatic.cpp.o
      vtkSmartPointer<vtkXMLPUnstructuredGridReader>::~vtkSmartPointer() in cpragmatic.cpp.o
      vtkSmartPointer<vtkPoints>::~vtkSmartPointer() in cpragmatic.cpp.o
      vtkSmartPointer<vtkIntArray>::~vtkSmartPointer() in cpragmatic.cpp.o
      vtkSmartPointer<vtkUnsignedCharArray>::~vtkSmartPointer() in cpragmatic.cpp.o
      vtkSmartPointer<vtkIdTypeArray>::~vtkSmartPointer() in cpragmatic.cpp.o
      ...
  "vtkSmartPointerBase::operator=(vtkSmartPointerBase const&)", referenced from:
      vtkSmartPointer<vtkDoubleArray>::operator=(vtkSmartPointer<vtkDoubleArray>&&) in cpragmatic.cpp.o
  "vtkUnstructuredGrid::InsertNextCell(int, long long, long long*)", referenced from:
      VTKTools<double>::export_vtu(char const*, Mesh<double> const*, double const*) in cpragmatic.cpp.o
  "vtkUnstructuredGrid::New()", referenced from:
      vtkSmartPointer<vtkUnstructuredGrid>::New() in cpragmatic.cpp.o
  "vtkDataSetAttributes::SetGlobalIds(vtkDataArray*)", referenced from:
      VTKTools<double>::export_vtu(char const*, Mesh<double> const*, double const*) in cpragmatic.cpp.o
  "vtkUnsignedCharArray::New()", referenced from:
      vtkSmartPointer<vtkUnsignedCharArray>::New() in cpragmatic.cpp.o
  "vtkXMLUnstructuredGridReader::New()", referenced from:
      vtkSmartPointer<vtkXMLUnstructuredGridReader>::New() in cpragmatic.cpp.o
  "vtkXMLUnstructuredGridReader::GetOutput()", referenced from:
      VTKTools<double>::import_vtu(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in cpragmatic.cpp.o
  "vtkXMLUnstructuredGridWriter::New()", referenced from:
      vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New() in cpragmatic.cpp.o
  "vtkXMLPUnstructuredGridReader::New()", referenced from:
      vtkSmartPointer<vtkXMLPUnstructuredGridReader>::New() in cpragmatic.cpp.o
  "vtkXMLPUnstructuredGridReader::GetOutput()", referenced from:
      VTKTools<double>::import_vtu(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in cpragmatic.cpp.o
  "vtkXMLPUnstructuredGridWriter::New()", referenced from:
      vtkSmartPointer<vtkXMLPUnstructuredGridWriter>::New() in cpragmatic.cpp.o
  "vtkPoints::New()", referenced from:
      vtkSmartPointer<vtkPoints>::New() in cpragmatic.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libpragmatic.dylib] Error 1
make[1]: *** [CMakeFiles/pragmatic.dir/all] Error 2
make: *** [all] Error 2

This is the output of cmake configure step:

CMs-MacBook-Pro:pragmatic maurini$ cmake .
-- Found VTK: /usr/local/lib/cmake/vtk-6.1 (found version "6.1.0")
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Found MPI_C: /usr/local/Cellar/open-mpi/1.8.4/lib/libmpi.dylib  
-- Found MPI_CXX: /usr/local/Cellar/open-mpi/1.8.4/lib/libmpi_cxx.dylib;/usr/local/Cellar/open-mpi/1.8.4/lib/libmpi.dylib  
-- Try OpenMP C flag = [ ]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [/openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-Qopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-xopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [+Oopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-qsmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP C flag = [-mp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [ ]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [/openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-Qopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-xopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [+Oopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-qsmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-mp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Could NOT find OpenMP (missing:  OpenMP_C_FLAGS OpenMP_CXX_FLAGS) 
-- /usr/local/include
CMake Warning (dev) at tests/CMakeLists.txt:4 (add_custom_target):
  Policy CMP0037 is not set: Target names should not be reserved and should
  match a validity pattern.  Run "cmake --help-policy CMP0037" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  The target name "test" is reserved or not valid for certain CMake features,
  such as generator expressions, and may result in undefined behavior.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- str_cite /Users/maurini/Documents/MyDoc/WIP/codes/pragmatic/src/generate_Steiner_ellipse_3d.cpp;/Users/maurini/Documents/MyDoc/WIP/codes/pragmatic/src/mpi_tools.cpp;/Users/maurini/Documents/MyDoc/WIP/codes/pragmatic/src/ticker.cpp
-- Configuring done
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   pragmatic

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /Users/maurini/Documents/MyDoc/WIP/codes/pragmatic

I also suggest to add lines as the following to cmake for the different modules, so as it is easier to debug.

message(STATUS "Found VTK: ${VTK_DIR} (found version \"${VTK_VERSION}\")")
ggorman commented 9 years ago

Just pushed your suggested patch.

Those linking errors you are seeing - I believed that I had already resolved those. Can you pull, rm CMakeCache.txt and try again please?

cmaurini commented 9 years ago

I did it, but I still have the same error. Do I need to compile VTK with special options? I tried adding c++11, but nothing change. After compiling with -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON this is the compiler call giving the error:

dhcp34-208:pragmatic maurini$ /usr/local/bin/mpicxx    -std=c++11 -Wno-literal-suffix -Wno-deprecated -dynamiclib -Wl,-headerpad_max_install_names   -o lib/libpragmatic.dylib -install_name /Users/maurini/Documents/MyDoc/WIP/codes/pragmatic/lib/libpragmatic.dylib CMakeFiles/pragmatic.dir/src/cpragmatic.cpp.o CMakeFiles/pragmatic.dir/src/generate_Steiner_ellipse_3d.cpp.o CMakeFiles/pragmatic.dir/src/mpi_tools.cpp.o CMakeFiles/pragmatic.dir/src/ticker.cpp.o -lmetis 
Undefined symbols for architecture x86_64:
  "vtkIntArray::New()", referenced from:
      vtkSmartPointer<vtkIntArray>::New() in cpragmatic.cpp.o
  "vtkDataArray::GetTuple1(long long)", referenced from:
      VTKTools<double>::import_vtu(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in cpragmatic.cpp.o
  "vtkDataArray::SetTuple1(long long, double)", referenced from:
      VTKTools<double>::export_vtu(char const*, Mesh<double> const*, double const*) in cpragmatic.cpp.o
  "vtkDataArray::SetTuple3(long long, double, double, double)", referenced from:
      VTKTools<double>::export_vtu(char const*, Mesh<double> const*, double const*) in cpragmatic.cpp.o
  "vtkDataArray::SetTuple4(long long, double, double, double, double)", referenced from:
      VTKTools<double>::export_vtu(char const*, Mesh<double> const*, double const*) in cpragmatic.cpp.o
  "vtkDataArray::SetTuple9(long long, double, double, double, double, double, double, double, double, double)", referenced from:
      VTKTools<double>::export_vtu(char const*, Mesh<double> const*, double const*) in cpragmatic.cpp.o
  "vtkFieldData::AddArray(vtkAbstractArray*)", referenced from:
      VTKTools<double>::export_vtu(char const*, Mesh<double> const*, double const*) in cpragmatic.cpp.o
  "vtkFieldData::GetArray(char const*, int&)", referenced from:
      vtkFieldData::GetArray(char const*) in cpragmatic.cpp.o
  "vtkXMLWriter::SetInputData(vtkDataObject*)", referenced from:
      VTKTools<double>::export_vtu(char const*, Mesh<double> const*, double const*) in cpragmatic.cpp.o
  "vtkXMLWriter::Write()", referenced from:
      VTKTools<double>::export_vtu(char const*, Mesh<double> const*, double const*) in cpragmatic.cpp.o
  "vtkDoubleArray::New()", referenced from:
      vtkSmartPointer<vtkDoubleArray>::New() in cpragmatic.cpp.o
  "vtkIdTypeArray::New()", referenced from:
      vtkSmartPointer<vtkIdTypeArray>::New() in cpragmatic.cpp.o
  "vtkSmartPointerBase::vtkSmartPointerBase(vtkObjectBase*)", referenced from:
      vtkSmartPointer<vtkDoubleArray>::vtkSmartPointer(vtkDoubleArray*) in cpragmatic.cpp.o
  "vtkSmartPointerBase::vtkSmartPointerBase(vtkObjectBase*, vtkSmartPointerBase::NoReference const&)", referenced from:
      vtkSmartPointer<vtkXMLUnstructuredGridReader>::vtkSmartPointer(vtkXMLUnstructuredGridReader*, vtkSmartPointerBase::NoReference const&) in cpragmatic.cpp.o
      vtkSmartPointer<vtkXMLPUnstructuredGridReader>::vtkSmartPointer(vtkXMLPUnstructuredGridReader*, vtkSmartPointerBase::NoReference const&) in cpragmatic.cpp.o
      vtkSmartPointer<vtkUnstructuredGrid>::vtkSmartPointer(vtkUnstructuredGrid*, vtkSmartPointerBase::NoReference const&) in cpragmatic.cpp.o
      vtkSmartPointer<vtkXMLPUnstructuredGridWriter>::vtkSmartPointer(vtkXMLPUnstructuredGridWriter*, vtkSmartPointerBase::NoReference const&) in cpragmatic.cpp.o
      vtkSmartPointer<vtkIdTypeArray>::vtkSmartPointer(vtkIdTypeArray*, vtkSmartPointerBase::NoReference const&) in cpragmatic.cpp.o
      vtkSmartPointer<vtkUnsignedCharArray>::vtkSmartPointer(vtkUnsignedCharArray*, vtkSmartPointerBase::NoReference const&) in cpragmatic.cpp.o
      vtkSmartPointer<vtkXMLUnstructuredGridWriter>::vtkSmartPointer(vtkXMLUnstructuredGridWriter*, vtkSmartPointerBase::NoReference const&) in cpragmatic.cpp.o
      ...
  "vtkSmartPointerBase::~vtkSmartPointerBase()", referenced from:
      vtkSmartPointer<vtkUnstructuredGrid>::~vtkSmartPointer() in cpragmatic.cpp.o
      vtkSmartPointer<vtkXMLUnstructuredGridReader>::~vtkSmartPointer() in cpragmatic.cpp.o
      vtkSmartPointer<vtkXMLPUnstructuredGridReader>::~vtkSmartPointer() in cpragmatic.cpp.o
      vtkSmartPointer<vtkPoints>::~vtkSmartPointer() in cpragmatic.cpp.o
      vtkSmartPointer<vtkIntArray>::~vtkSmartPointer() in cpragmatic.cpp.o
      vtkSmartPointer<vtkUnsignedCharArray>::~vtkSmartPointer() in cpragmatic.cpp.o
      vtkSmartPointer<vtkIdTypeArray>::~vtkSmartPointer() in cpragmatic.cpp.o
      ...
  "vtkSmartPointerBase::operator=(vtkSmartPointerBase const&)", referenced from:
      vtkSmartPointer<vtkDoubleArray>::operator=(vtkSmartPointer<vtkDoubleArray>&&) in cpragmatic.cpp.o
  "vtkUnstructuredGrid::New()", referenced from:
      vtkSmartPointer<vtkUnstructuredGrid>::New() in cpragmatic.cpp.o
  "vtkDataSetAttributes::SetGlobalIds(vtkDataArray*)", referenced from:
      VTKTools<double>::export_vtu(char const*, Mesh<double> const*, double const*) in cpragmatic.cpp.o
  "vtkUnsignedCharArray::New()", referenced from:
      vtkSmartPointer<vtkUnsignedCharArray>::New() in cpragmatic.cpp.o
  "vtkXMLUnstructuredGridReader::New()", referenced from:
      vtkSmartPointer<vtkXMLUnstructuredGridReader>::New() in cpragmatic.cpp.o
  "vtkXMLUnstructuredGridReader::GetOutput()", referenced from:
      VTKTools<double>::import_vtu(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in cpragmatic.cpp.o
  "vtkXMLUnstructuredGridWriter::New()", referenced from:
      vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New() in cpragmatic.cpp.o
  "vtkXMLPUnstructuredGridReader::New()", referenced from:
      vtkSmartPointer<vtkXMLPUnstructuredGridReader>::New() in cpragmatic.cpp.o
  "vtkXMLPUnstructuredGridReader::GetOutput()", referenced from:
      VTKTools<double>::import_vtu(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in cpragmatic.cpp.o
  "vtkXMLPUnstructuredGridWriter::New()", referenced from:
      vtkSmartPointer<vtkXMLPUnstructuredGridWriter>::New() in cpragmatic.cpp.o
  "vtkPoints::New()", referenced from:
      vtkSmartPointer<vtkPoints>::New() in cpragmatic.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ggorman commented 9 years ago

Fixed