FedoraForum.org - Fedora Support Forums and Community
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2004
    Location
    Maryland, US
    Posts
    15,344
    Mentioned
    186 Post(s)
    Tagged
    0 Thread(s)

    howto build FFTW on Fedora as a shared object on x86_64

    I needed to build FFTW (Fastest Fourier Transform in the West) at work so we could load it as a shared object. We want to load FFTW via JNI/JNA from Java to speed up our FFT calculations. To use JNI you use its loadLibrary() or JNA its register() or loadLibrary function calls and those only work with shared libraries and also in particular on x86_64 you need to make them Position Independent Code or the "-fPIC" option has to be used (or at least I've never been able to use JNI or JNA without the shared library being PIC-ized to coin a word)

    The problem I had was that it seemed I should run configure as this (I did two because I wanted both
    the single and double precision versions):
    configure --prefix=<path to installation>/fftwsingle --enable-shared --with-pic --enable-single
    configure --prefix=<path to installation>/fftwdbl --enable-shared --with-pic --enable-sse2
    the first configure is for single precision and the second is to make a double precision version and
    to speed up the double case I added sse2 support (not an option with single precision so I didn't use that option there). Also there was no particular option for double precision because double is the default.

    The problem is that I then ran "make" and get this error:

    relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object;
    recompile with -fPIC
    It turned out that I couldn't get the --with-pic to work as expected on x86_64, so I dropped that option
    from both my configure commands and then edited the Makefiles to add "-fPIC" to the CFLAGS option list and ran the 'make' as usual and the make install as usual so my procedure step by step was:

    configure --prefix=<path to installation>/fftwsingle --enable-shared --with-pic --enable-single
    <edit Makefile to add -fPIC to CFLAGS>
    make
    make install
    configure --prefix=<path to installation>/fftwdbl --enable-shared --with-pic --enable-sse2
    <edit Makefile to add -fPIC to CFLAGS>
    make
    make install
    This seems to work. I suppose this particular situation (building FFTW as PIC shared objects on x86_64) doesn't happen much but I suspect this PIC failure will happen with other products and not just FFTW and I think this editing in the -fPIC by hand might help.
    Last edited by marko; 25th October 2009 at 01:16 AM.

  2. #2
    aleph's Avatar
    aleph is offline Banned (for/from) behaving just like everybody else!
    Join Date
    Jul 2007
    Location
    Nanjing, China
    Posts
    1,332
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The Fedora repo has shared libraries of FFTW for both 32-bit and 64-bit systems. Maybe you can try extracting the source RPM and have a look at the build process.

    yumdownloader --source fftw
    Code:
    from rlyeh import cthulhu
    cthulhu.fhtagn()

Similar Threads

  1. Replies: 3
    Last Post: 1st April 2009, 05:54 PM
  2. fedora 9 cannot open shared object file
    By myyou in forum Using Fedora
    Replies: 1
    Last Post: 3rd October 2008, 04:49 AM
  3. Replies: 2
    Last Post: 22nd June 2007, 02:53 PM
  4. Replies: 2
    Last Post: 21st June 2007, 06:00 PM
  5. Replies: 2
    Last Post: 31st December 2005, 10:06 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •