构建软件包时

时间:2019-01-10 19:14:10

标签: clang

当前正在尝试构建软件包Neper。我已经浏览了许多错误,但是目前涉及到此错误。

在终端机(mac)中,当我使用make命令进行构建时,得到以下输出:

[  2%] Built target muparser
[  7%] Built target ut
[ 13%] Built target orilib
[ 42%] Built target neut
[ 53%] Built target neper_v
[ 69%] Built target neper_m
[100%] Built target neper_t
[100%] Linking CXX executable neper
Undefined symbols for architecture x86_64:
  "___kmpc_critical", referenced from:
      _.omp_outlined. in libneper_m.a(nem_meshing_2D1.c.o)
      _.omp_outlined. in libneper_m.a(nem_meshing_3D1.c.o)
      _nem_meshing_2D_face in libneper_m.a(nem_meshing_2D2.c.o)
      _nem_mesh_2d_gmsh in libneper_m.a(nem_mesh_gmsh1.c.o)
      _nem_meshing_2D_face_algo in libneper_m.a(nem_meshing_2D3.c.o)
      net_polycomp_cells_updatecell(POLY, SEEDSET, nanoflann::KDTreeSingleIndexDynamicAdaptor<nanoflann::L2_Simple_Adaptor<double, NFCLOUD, double>, NFCLOUD, 3, unsigned long>**, int*, int, POLY**, TDYN*) in libneper_t.a(net_polycomp3.cpp.o)
      net_polycomp_poly(POLY, SEEDSET, nanoflann::KDTreeSingleIndexDynamicAdaptor<nanoflann::L2_Simple_Adaptor<double, NFCLOUD, double>, NFCLOUD, 3, unsigned long>**, int*, int, POLY*, TDYN*) in libneper_t.a(net_polycomp_poly1.cpp.o)
      ...
  "___kmpc_dispatch_init_4", referenced from:
      _.omp_outlined. in libneper_t.a(net_utils1.c.o)
      _.omp_outlined. in libneper_m.a(nem_meshing_2D1.c.o)
      _.omp_outlined..4 in libneper_m.a(nem_meshing_2D1.c.o)
      _.omp_outlined. in libneper_m.a(nem_meshing_3D1.c.o)
      _.omp_outlined. in libneper_t.a(net_polycomp2.cpp.o)
      _.omp_outlined..2 in libneper_t.a(net_polycomp2.cpp.o)
      _.omp_outlined..3 in libneper_t.a(net_polycomp2.cpp.o)
      ...
  "___kmpc_dispatch_init_4u", referenced from:
      _.omp_outlined..1 in libneper_t.a(net_ori_uniform4.cpp.o)
  "___kmpc_dispatch_next_4", referenced from:
      _.omp_outlined. in libneper_t.a(net_utils1.c.o)
      _.omp_outlined. in libneper_m.a(nem_meshing_2D1.c.o)
      _.omp_outlined..4 in libneper_m.a(nem_meshing_2D1.c.o)
      _.omp_outlined. in libneper_m.a(nem_meshing_3D1.c.o)
      _.omp_outlined. in libneper_t.a(net_polycomp2.cpp.o)
      _.omp_outlined..2 in libneper_t.a(net_polycomp2.cpp.o)
      _.omp_outlined..3 in libneper_t.a(net_polycomp2.cpp.o)
      ...
  "___kmpc_dispatch_next_4u", referenced from:
      _.omp_outlined..1 in libneper_t.a(net_ori_uniform4.cpp.o)
  "___kmpc_end_critical", referenced from:
      _.omp_outlined. in libneper_m.a(nem_meshing_2D1.c.o)
      _.omp_outlined. in libneper_m.a(nem_meshing_3D1.c.o)
      _nem_meshing_2D_face in libneper_m.a(nem_meshing_2D2.c.o)
      _nem_mesh_2d_gmsh in libneper_m.a(nem_mesh_gmsh1.c.o)
      _nem_meshing_2D_face_algo in libneper_m.a(nem_meshing_2D3.c.o)
      net_polycomp_cells_updatecell(POLY, SEEDSET, nanoflann::KDTreeSingleIndexDynamicAdaptor<nanoflann::L2_Simple_Adaptor<double, NFCLOUD, double>, NFCLOUD, 3, unsigned long>**, int*, int, POLY**, TDYN*) in libneper_t.a(net_polycomp3.cpp.o)
      net_polycomp_poly(POLY, SEEDSET, nanoflann::KDTreeSingleIndexDynamicAdaptor<nanoflann::L2_Simple_Adaptor<double, NFCLOUD, double>, NFCLOUD, 3, unsigned long>**, int*, int, POLY*, TDYN*) in libneper_t.a(net_polycomp_poly1.cpp.o)
      ...
  "___kmpc_for_static_fini", referenced from:
      _.omp_outlined. in libneut.a(neut_tesr_op1.c.o)
      _.omp_outlined. in libneper_v.a(nev_data_utils1.c.o)
      _.omp_outlined..51 in libneper_v.a(nev_data_utils1.c.o)
      _.omp_outlined. in libneper_v.a(nev_print_tesr1.c.o)
      _.omp_outlined..2 in libneper_v.a(nev_print_tesr1.c.o)
      _.omp_outlined..3 in libneper_v.a(nev_print_tesr1.c.o)
      _.omp_outlined..4 in libneper_v.a(nev_print_tesr1.c.o)
      ...
  "___kmpc_for_static_init_4", referenced from:
      _.omp_outlined. in libneut.a(neut_tesr_op1.c.o)
      _.omp_outlined. in libneper_v.a(nev_data_utils1.c.o)
      _.omp_outlined..51 in libneper_v.a(nev_data_utils1.c.o)
      _.omp_outlined. in libneper_v.a(nev_print_tesr1.c.o)
      _.omp_outlined..2 in libneper_v.a(nev_print_tesr1.c.o)
      _.omp_outlined..3 in libneper_v.a(nev_print_tesr1.c.o)
      _.omp_outlined..4 in libneper_v.a(nev_print_tesr1.c.o)
      ...
  "___kmpc_for_static_init_4u", referenced from:
      _.omp_outlined. in libneper_t.a(net_ori_uniform3.cpp.o)
      _.omp_outlined..1 in libneper_t.a(net_ori_uniform3.cpp.o)
      _.omp_outlined..2 in libneper_t.a(net_ori_uniform3.cpp.o)
      _.omp_outlined. in libneper_t.a(net_ori_uniform4.cpp.o)
      _.omp_outlined..3 in libneper_t.a(net_ori_uniform4.cpp.o)
      _.omp_outlined..4 in libneper_t.a(net_ori_uniform4.cpp.o)
  "___kmpc_fork_call", referenced from:
      _main in neper.c.o
      _neper_head in neper.c.o
      _net_tess_tesr in libneper_t.a(net_utils1.c.o)
      _neut_tesr_rotate in libneut.a(neut_tesr_op1.c.o)
      _nem_meshing_2D in libneper_m.a(nem_meshing_2D1.c.o)
      _nem_meshing_3D in libneper_m.a(nem_meshing_3D1.c.o)
      _nev_data_id_colour in libneper_v.a(nev_data_utils1.c.o)
      ...
  "___kmpc_global_thread_num", referenced from:
      _nem_meshing_2D_face in libneper_m.a(nem_meshing_2D2.c.o)
      _.omp_outlined. in libneper_t.a(net_polycomp2.cpp.o)
      _.omp_outlined..2 in libneper_t.a(net_polycomp2.cpp.o)
      _.omp_outlined..3 in libneper_t.a(net_polycomp2.cpp.o)
      _.omp_outlined..4 in libneper_t.a(net_polycomp2.cpp.o)
      _.omp_outlined..5 in libneper_t.a(net_polycomp2.cpp.o)
      _.omp_outlined..6 in libneper_t.a(net_polycomp2.cpp.o)
      ...
  "_omp_get_num_threads", referenced from:
      _.omp_outlined. in neper.c.o
  "_omp_get_thread_num", referenced from:
      _.omp_outlined. in neper.c.o
      _nem_mesh_2d_gmsh in libneper_m.a(nem_mesh_gmsh1.c.o)
      _nem_mesh_3d_gmsh in libneper_m.a(nem_mesh_gmsh1.c.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]: *** [neper] Error 1
make[1]: *** [CMakeFiles/neper.dir/all] Error 2
make: *** [all] Error 2

它似乎一直都在构建,但是与这些kmpc符号有些不匹配。从我阅读的内容来看,这似乎在编译器方面是一个问题(可能是错误的),但是我还没有找到任何解决方案。关于如何解决此错误的任何想法?

2 个答案:

答案 0 :(得分:0)

这看起来与此intel question类似。

我怀疑您需要与libomp链接(但这只是一个猜测)

答案 1 :(得分:0)

检查您是否有 gcc-x,其中 x 是一个数字。我看到了几个使用 gcc-8 的示例,但它不会像我使用的 gcc-10 那样工作。

我所做的是去终端,写下 gcc-,然后tab 显示我的选项。使用 gcc-10 时,我可以毫无问题地运行 openMP

我做了 brew install gccbrew install libomp

干杯