6 Replies Latest reply on Jun 27, 2012 8:36 AM by yurtesen

    Compiling shared libraries for PETSc

    yurtesen

      I am trying to build PETSc with shared libraries. I have given --sharedLibraryFlags="-fPIC -shared" option yet I am getting the error below. Is it possible that open64 is accidentally using libopen64rt.a instead of libopen64rt_shared.a ? (I am not sure at what point PETSc is passing -fPIC -shared options. This compiles fine on GCC. Any ideas?

       

       

      Completed building libraries

      =========================================

      making shared libraries in /export/tmp/petsc-3.2-p7/arch-linux2-c-opt/lib

      building libpetsc.so

      /usr/bin/ld:

      /export/modules/compilers/amd/x86_open64/4.5.1/lib/gcc-lib/x86_64-open64-linux/4.5.1/libopen64rt.a(cacheinfo.o):

      relocation R_X86_64_32S against `.rodata'

      a shared object; recompile with -fPIC

      /export/modules/compilers/amd/x86_open64/4.5.1/lib/gcc-lib/x86_64-open64-linux/4.5.1/libopen64rt.a:

      could not read symbols: Bad value 

      collect2: ld returned 1 exit status

      =========================================

      Now to install the libraries do:

      make PETSC_DIR=/export/tmp/petsc-3.2-p7 PETSC_ARCH=arch-linux2-c-opt

      install

      =========================================

        • Re: Compiling shared libraries for PETSc
          santosh.zanjurne

          Open64 compiler correctly selects the libopen64rt_shared.a when you specify -shared flag, you can verify this with small test program.  However PETSc applications  build system incorrectly selects libopen64rt.a while selecting dependancies and then explicitly passes this file to the linker.  It looks while checking dependancies PETSc doesnt pass -shared flag.

           

          I manually changed the configuration files to use libopen64rt_shared.a and the build/test completed successfully.

           

          Regards,

          Santosh

          1 of 1 people found this helpful