in this case, you should configure OpenMPI with
--disable-shared --enable-static --disable-dlopen

then you can manually run the mpifort link command with --showme,
so you get the fully expanded gfortran link command.
then you can edit this command, and non system libs (e.g. lapack, openmpi,
siesta) with -static, but system libs (e.g. m, ibverbs, ...) with -dynamic
you might have to manually append -ldl, though that should not be needed

Cheers,

Gilles



On Wednesday, September 14, 2016, Mahmood Naderan <mahmood...@gmail.com>
wrote:

> Well I want to omit LD_LIBRARY_PATH. For that reason I am building the
> binary statically.
>
> > note this is not required when Open MPI is configure'd with
> >--enable-mpirun-prefix-by-default
> I really did that. Using Rocks-6, I installed the application and openmpi
> on the shared file system (/export).
> Yes it is possible to add the library paths to LD_LIBRARY_PATH, but I want
> to statically put the required libraries in the binary.
>
>
>
> Regards,
> Mahmood
>
>
>
> On Wed, Sep 14, 2016 at 4:44 PM, Gilles Gouaillardet <
> gilles.gouaillar...@gmail.com
> <javascript:_e(%7B%7D,'cvml','gilles.gouaillar...@gmail.com');>> wrote:
>
>> Mahmood,
>>
>> try to prepend /export/apps/siesta/openmpi-1.8.8/lib to your
>> $LD_LIBRARY_PATH
>>
>>  note this is not required when Open MPI is configure'd with
>> --enable-mpirun-prefix-by-default
>>
>>
>> Cheers,
>>
>> Gilles
>>
>> On Wednesday, September 14, 2016, Mahmood Naderan <mahmood...@gmail.com
>> <javascript:_e(%7B%7D,'cvml','mahmood...@gmail.com');>> wrote:
>>
>>> Hi,
>>> Here is the problem with statically linking an application with a
>>> program.
>>>
>>> by specifying the library names:
>>>
>>> FC=/export/apps/siesta/openmpi-1.8.8/bin/mpifort
>>> FFLAGS=-g -Os
>>> FPPFLAGS= -DMPI -DFC_HAVE_FLUSH -DFC_HAVE_ABORT
>>> LDFLAGS=-static
>>> MPI1=/export/apps/siesta/openmpi-1.8.8/lib/libmpi_mpifh.a
>>> MPI2=/export/apps/siesta/openmpi-1.8.8/lib/libmpi_usempi.a
>>> BLAS_LIBS=../libopenblas.a
>>> SCALAPACK_LIBS=../libscalapack.a
>>> LIBS=$(SCALAPACK_LIBS) $(BLAS_LIBS) $(MPI1) $(MPI2)
>>>
>>>
>>>
>>>
>>> The output of "make" is:
>>>
>>> /export/apps/siesta/openmpi-1.8.8/bin/mpifort -o transiesta \
>>>                -static automatic_cell.o ...<OMITTED LIB NAMES>.....
>>> libmpi_f90.a
>>>               `FoX/FoX-config --libs --wcml` ../libscalapack.a
>>> ../libopenblas.a  /export/apps/siesta/openmpi-1.8.8/lib/libmpi_mpifh.a
>>> /export/apps/siesta/openmpi-1.8.8/lib/libmpi_usempi.a
>>> /export/apps/siesta/openmpi-1.8.8/lib/libopen-pal.a(dl_dlopen_module.o):
>>> In function `dlopen_open':
>>> dl_dlopen_module.c:(.text+0x473): warning: Using 'dlopen' in statically
>>> linked applications requires at runtime the shared libraries from the glibc
>>> version used for linking
>>> /usr/bin/ld: cannot find -libverbs
>>> collect2: ld returned 1 exit status
>>>
>>>
>>>
>>>
>>> If I drop -static, the error is gone... However, ldd command shoes that
>>> binary can not access those two MPI libraries.
>>>
>>>
>>> Regards,
>>> Mahmood
>>>
>>>
>>>
>> _______________________________________________
>> users mailing list
>> users@lists.open-mpi.org
>> <javascript:_e(%7B%7D,'cvml','users@lists.open-mpi.org');>
>> https://rfd.newmexicoconsortium.org/mailman/listinfo/users
>>
>
>
_______________________________________________
users mailing list
users@lists.open-mpi.org
https://rfd.newmexicoconsortium.org/mailman/listinfo/users

Reply via email to