Fedora Linux Support Community & Resources Center
  #1  
Old 24th October 2009, 10:27 PM
marko Offline
Registered User
 
Join Date: Jun 2004
Location: Laurel, MD USA
Posts: 6,031
linuxfedorafirefox
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):
Quote:
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:

Quote:
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:

Quote:
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.
Reply With Quote
  #2  
Old 25th October 2009, 03:29 AM
aleph Offline
Banned (for/from) behaving just like everybody else!
 
Join Date: Jul 2007
Location: Nanjing, China
Posts: 1,332
linuxfedorafirefox
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()
Reply With Quote
Reply

Tags
build, fedora, fftw, howto, object, shared, x8664

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: error while loading shared libraries: libssl.so.4: cannot open shared object Darker Using Fedora 3 1st April 2009 05:54 PM
fedora 9 cannot open shared object file myyou Using Fedora 1 3rd October 2008 04:49 AM
error while loading shared libraries: libXp.so.6: cannot open shared object file kootharaas Using Fedora 2 22nd June 2007 02:53 PM
error while loading shared libraries: libXp.so.6: cannot open shared object file kootharaas Using Fedora 2 21st June 2007 06:00 PM
error while loading shared libraries: libssl.so.5: cannot open shared object file frold Servers & Networking 2 31st December 2005 09:06 AM


Current GMT-time: 00:19 (Sunday, 31-08-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat