makefile - 使用 -fPIC 重新编译

标签 makefile mpi configure relocation

我有 MPICH 3.0.4安装在我的机器上(Ubuntu 12.04)。我正在尝试安装一个名为 Qthreads 的库我之前使用过并成功安装过它(除了安装了 MPICH2 包)。配置工作正常:
./configure --prefix=/usr/local/qthreads --enable-multinode --with-multinode-runtime=mpi --with-portals4=/usr/local/portals4 --with-hwloc=/usr/local/hwloc :

...
...
...
System Characteristics:
       Target Style: unix
         Multi-node: yes, mpi
       Topology API: hwloc
        Qtimer type: clock_gettime
     Aligned_t size: 8 (aligned on 8 byte boundaries)
 Default Stack size: 4kB

Safety/Debugging:
   Sanity assert()s: no
    Check alignment: no
          Profiling: none
   Debugging Output: no
        Guard Pages: no

Speed:
          Scheduler: sherwood (multiworker shepherds)
         Sinc Style: donecount
      Barrier Style: feb
   Dictionary Style: simple
    Lazy Thread IDs: yes
       Pools/caches: memory, spawns
            RCRTool: no
Increments/CAS/FEBs: Compiler Builtin (both), lock-based hash

当我尝试运行时 make ,我收到以下错误:
  ...
  ...
  ...
  CCLD     libqthread.la
/usr/bin/ld: /usr/local/lib/libmpich.a(barrier.o): relocation R_X86_64_32 against `MPIR_ThreadInfo' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libmpich.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [libqthread.la] Error 1
make[2]: Leaving directory `/home/alex/Downloads/qthread-1.9/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/alex/Downloads/qthread-1.9/src'
make: *** [all-recursive] Error 1

我有 looked around似乎显而易见的(也是唯一可能的)解决方案是按照编译器所说的去做:用 -fPIC 重新编译.但是,我对检查和编辑 Qthreads 的任何 Makefile 犹豫不决,因为它们又长又复杂。是否有一种简单的方法可以使用 -fPIC 重新编译?

请指教。我感谢任何输入。

最佳答案

在所有讨论之后,我用 --enable-shared 全新安装了 MPICH 3.0.4。是唯一给出的配置选项。出于某种原因,它成功编译和构建,尽管之前没有这样做。完成此操作后,无需任何额外选项即可成功配置和构建 Qthreads。

关于makefile - 使用 -fPIC 重新编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18387247/

相关文章:

c - 如何将 gcc 优化级别传递给 cmake 目标?

c - 如何使用 MPI 散布二维数组?

c - 并行矩阵相乘的问题

c - MPI 笛卡尔拓扑 - MPI_Gather 等效吗?

linux - 将 autogen.sh 与 ExternalProject_Add 结合使用

c++ - 链接后的大型 C++ 静态库文件

python - CMake libifport.so.5 : cannot open shared object file: No such file or directory

c++ - CMake 没有正确找到 CUDA 库

symfony - 奏鸣曲管理员通过显示链接更改编辑链接

linux - 使用 ptxdist 交叉编译 snort 导致 INADDR_NONE 配置错误