5

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

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

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.

Community
  • 1
  • 1
Alex Brooks
  • 1,151
  • 1
  • 10
  • 39

3 Answers3

3

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.

Alex Brooks
  • 1,151
  • 1
  • 10
  • 39
2

The ultimate answer is going to depend on the makefiles in question but using make CFLAGS=-fPIC might work as might MYCFLAGS or any of a number of other such variables. You'll have to look and see what Qthreads is using to create that archive.

Etan Reisner
  • 77,877
  • 8
  • 106
  • 148
2

It's also possible that this is a symptom and not the problem. Take a look at this answer and see if it helps (how to recompile with -fPIC). As of MPICH 3.0.4, the default is to build with shared libraries instead of static, so you may need to make sure that they're consistent.

Community
  • 1
  • 1
Wesley Bland
  • 8,816
  • 3
  • 44
  • 59
  • Thank you for the reference Wesley. I checked out the solution and tried a few different configurations without any luck. I tried recompiling MPICH with `--enable-shared` only to be met with a similar error (`relocation R_X86_64_32 against '.rodata' can not be used when making a shared object;...`). Then I tried recompiling Qthreads with `--enable-shared` and `--disable-static` also with no luck (same error as in OP). Do you have any suggestions as to how I should recompile either MPICH or Qthreads? – Alex Brooks Aug 22 '13 at 19:29
  • Did you try compiling MPICH with `--enable-static` since that's the non-default case? It probably won't make a difference, but that's the only combination you have left? – Wesley Bland Aug 22 '13 at 19:36
  • I was able to successfully compile and build MPICH with `enable-static`. However I am still unable to make Qthreads, even after trying every combination of `--enable-shared` and `--enable-static`; I continue to receive the same error, regardless of which I use. – Alex Brooks Aug 22 '13 at 20:09
  • Ah, well in that case I'm less sure about what your problem might be. Did you try the suggestion in the other answer (`make CFLAGS=-fPIC`)? – Wesley Bland Aug 22 '13 at 20:50
  • Yup I have added the `-fPIC` option to every `*FLAGS` variable, all with no results. Although, it seems I should be adding the option for compiling MPICH rather than Qthreads, since the error strictly regards `libmpich.a`. I will see what I can do about attempting the option during compiling MPICH – Alex Brooks Aug 22 '13 at 20:53
  • I checked out `configure.ac` for MPICH 3.0.4, and I found something interesting: `LT_INIT([disable-shared])`. Afterwards, a check is done, disabling `rpath` if shared libraries are disabled. Is this a bug? Since you mentioned that --enable-shared is the default for MPICH 3.0.4 – Alex Brooks Aug 23 '13 at 00:30
  • Ah, apparently I was wrong about shared libraries being the default in 3.0.4. That happened just after it was released so they will be the default for 3.1. – Wesley Bland Aug 23 '13 at 13:00