用-fPIC重新编译 [英] Recompiling with -fPIC
问题描述
我的计算机上安装了 MPICH 3.0.4 (Ubuntu 12.04).我正在尝试安装一个名为 Qthreads 的库,该库我之前已经使用并成功安装了(除非已安装MPICH2软件包).配置工作正常:
I have MPICH 3.0.4 installed on my machine (Ubuntu 12.04). I am trying to install a library called Qthreads which I have worked with and successfully installed before (except with the MPICH2 package installed). The configuration works fine:
./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
时,出现以下错误:
When I try and run make
, I get the following error:
...
...
...
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
我环顾四周,这似乎很明显(并且仅可能)解决方案是按照编译器的说明进行操作:使用-fPIC
重新编译.但是,我很犹豫要遍历和编辑Qthreads的任何Makefile,因为它们很长很复杂.有没有一种简单的方法可以用-fPIC
重新编译?
I have looked around and it seems the obvious (and possible only) solution is to do what the compiler says: recompile with -fPIC
. However, I'm hesitant to go through and edit any Makefiles for Qthreads, as they are long and complicated. Is there an easy way to recompile with -fPIC
?
请告知.感谢您的投入.
Please advise. I appreciate any input.
推荐答案
在所有讨论之后,我完全重新安装了MPICH 3.0.4,其中--enable-shared
是给出的唯一配置选项.由于某种原因,尽管之前没有这样做,但它编译和构建成功.完成此操作后,无需任何其他选项即可成功配置和构建Qthreads.
After all of the discussion, I did a completely fresh install of MPICH 3.0.4, with --enable-shared
being the only configure option given. For some reason it compiled and built successfully, despite not doing so before. After this was accomplished, Qthreads was configured and built successfully without requiring any extra options.
这篇关于用-fPIC重新编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!