使用-fPIC重新编译

Ale*_*oks 5 makefile configure mpi 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
Run Code Online (Sandbox Code Playgroud)

当我尝试运行时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
Run Code Online (Sandbox Code Playgroud)

环顾四周,似乎显而易见(也可能是唯一的)解决方案是执行编译器所说的:重新编译-fPIC.但是,我很犹豫是否要编辑Qthreads的任何Makefile,因为它们很长很复杂.有一种简单的方法可以重新编译-fPIC吗?

请指教.我很感激任何意见.

Ale*_*oks 3

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