[Trilinos-Users] Building with -fPIC flag
Perschbacher, Brent M
bmpersc at sandia.gov
Fri Jul 29 12:46:12 MDT 2011
What Bill said is true, turning on shared libraries will force the
libraries to be built with position independent code. I have a feeling that
this is more along the lines of what matlab is expecting too, ie using
dlopen to load the correct libraries.
However, what you did should work too, at least for building static libs
with position independent code. I just did a test on my machine and adding
-fPIC to the compile flags worked. Why your aztecoo libraries didn't built
with it I couldn't say without more information. If you you really want to
stay with static libraries I would suggest you run "make clean" in your
build dir, delete your CMakeCache.txt file and CMakeFiles directory and then
try configuring and building again. If you don't require static libraries
then enabling shared libraries is the easiest way to go.
On 7/29/11 12:27 PM, "Bill Spotz" <wfspotz at sandia.gov> wrote:
> Position independent code is associate with shared libraries. I believe that
> if you configure with
> -D BUILD_SHARED_LIBS:BOOL=ON
> then all of the libraries should be compiled properly for you.
> On Jul 29, 2011, at 11:14 AM, Christopher Parmer wrote:
>> Hi All,
>> I'm linking my trilinos project with matlab and so I (er.. matlab mex files)
>> need the libraries to be 'position independent' or compiled with the -fPIC
>> I tried rebuilding trilinos (via ccmake, make, make install) with -fPIC in
>> CMAKE_CXX_FLAGS, (and later I added it to CMAKE_C_FLAGS,
>> CMAKE_EXE_LINKER_FLAGS), but I get the same error with respect to the
>> libaztecoo and a few other packages. However, my simple examples with Epetra
>> CrsMatrices now work.
>> Am I missing a flag somewhere? Or are some libraries not written to be
>> 'position independent'?
>> Sorry if this is a simple question - I'm very new to linking and building
>> large packages.
>> (802) 343-5897
>> Trilinos-Users mailing list
>> Trilinos-Users at software.sandia.gov
> ** Bill Spotz **
> ** Sandia National Laboratories Voice: (505)845-0170 **
> ** P.O. Box 5800 Fax: (505)284-0154 **
> ** Albuquerque, NM 87185-0370 Email: wfspotz at sandia.gov **
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
More information about the Trilinos-Users