[petsc-users] linking PETSC with SSL

Lukas van de Wiel lukas.drinkt.thee at gmail.com
Wed Nov 8 08:36:28 CST 2017


Good day,

during an upgrade of PETSc (from 3.4.2 to 3.7.7) and some changes
needed to use MUMPs I ran into a problem with SSL that I could not
really figure out.

********************************************************
I have configured PETSc 3.7.7 using: (explicitly note the option --with-ssl=0  )


./configure  \
COPTFLAGS='-O3 -march=native -mtune=native' \
CXXOPTFLAGS='-O3 -march=native -mtune=native' \
FOPTFLAGS='-O3 -march=native -mtune=native' \
--with-debugging=0 \
--with-x=0 \
--with-ssl=0 \
--with-shared-libraries=0 \
--download-metis \
--download-parmetis \
--download-fblaslapack \
--download-scalapack \
--download-openmpi \
--download-mumps \
--download-hypre \
--download-ptscotch


********************************************************
Next I have a tiny Fortran program to illustrate the problem:


program sslhuh
implicit none
#include "petsc/finclude/petscsys.h"
write(*,*) "Hello World"
end program



********************************************************
I compile it using makefile:


petscDir = /net/home/gtecton/sw_dev/petsc-3.7.7

all: compile link

compile: sslhuh.F
    $(petscDir)/linux-gnu-x86_64/bin/mpif90 \
    -c \
    -o sslhuh.o \
    -std=f2008 \
    -ffree-form \
    -I$(petscDir)/include \
    -I$(petscDir)/include/petsc/finclude \
    sslhuh.F

link: sslhuh.o
    $(petscDir)/linux-gnu-x86_64/bin/mpif90 \
    -o sslhuh \
    sslhuh.o \
    $(petscDir)/linux-gnu-x86_64/lib/libpetsc.a \
    $(petscDir)/linux-gnu-x86_64/lib/libHYPRE.a \
    $(petscDir)/linux-gnu-x86_64/lib/libzmumps.a \
    $(petscDir)/linux-gnu-x86_64/lib/libsmumps.a \
    $(petscDir)/linux-gnu-x86_64/lib/libdmumps.a \
    $(petscDir)/linux-gnu-x86_64/lib/libcmumps.a \
    $(petscDir)/linux-gnu-x86_64/lib/libmumps_common.a \
    $(petscDir)/linux-gnu-x86_64/lib/libesmumps.a \
    $(petscDir)/linux-gnu-x86_64/lib/libparmetis.a \
    $(petscDir)/linux-gnu-x86_64/lib/libmetis.a \
    $(petscDir)/linux-gnu-x86_64/lib/libpord.a \
    $(petscDir)/linux-gnu-x86_64/lib/libscalapack.a \
    $(petscDir)/linux-gnu-x86_64/lib/libflapack.a \
    $(petscDir)/linux-gnu-x86_64/lib/libfblas.a \
    $(petscDir)/linux-gnu-x86_64/lib/libptscotch.a \
    $(petscDir)/linux-gnu-x86_64/lib/libptscotcherr.a \
    $(petscDir)/linux-gnu-x86_64/lib/libptscotcherrexit.a \
    $(petscDir)/linux-gnu-x86_64/lib/libptscotchparmetis.a \
    $(petscDir)/linux-gnu-x86_64/lib/libscotch.a \
    $(petscDir)/linux-gnu-x86_64/lib/libscotcherr.a \
    $(petscDir)/linux-gnu-x86_64/lib/libscotcherrexit.a \
    $(petscDir)/linux-gnu-x86_64/lib/libscotchmetis.a \
    -ldl


********************************************************
Compiling works fine.
Linking gives me the error:


/net/home/gtecton/sw_dev/petsc-3.7.7/linux-gnu-x86_64/lib/libpetsc.a(client.o):
In function `PetscSSLInitializeContext':
client.c:(.text+0x3b): undefined reference to `SSLv23_method'
client.c:(.text+0x43): undefined reference to `SSL_CTX_new'
client.c:(.text+0x5a): undefined reference to `SSL_CTX_ctrl'
client.c:(.text+0x79): undefined reference to `SSL_library_init'
client.c:(.text+0x7e): undefined reference to `SSL_load_error_strings'
client.c:(.text+0x8c): undefined reference to `BIO_new_fp'
/net/home/gtecton/sw_dev/petsc-3.7.7/linux-gnu-x86_64/lib/libpetsc.a(client.o):
In function `PetscSSLDestroyContext':
client.c:(.text+0xa5): undefined reference to `SSL_CTX_free'
/net/home/gtecton/sw_dev/petsc-3.7.7/linux-gnu-x86_64/lib/libpetsc.a(client.o):
In function `PetscHTTPSRequest':
client.c:(.text+0xa9e): undefined reference to `SSL_write'
client.c:(.text+0xaab): undefined reference to `SSL_get_error'
client.c:(.text+0xb40): undefined reference to `SSL_read'
client.c:(.text+0xb50): undefined reference to `SSL_get_error'
client.c:(.text+0xbde): undefined reference to `SSL_free'
client.c:(.text+0xc74): undefined reference to `SSL_shutdown'
/net/home/gtecton/sw_dev/petsc-3.7.7/linux-gnu-x86_64/lib/libpetsc.a(client.o):
In function `PetscHTTPSConnect':
client.c:(.text+0x105c): undefined reference to `SSL_new'
client.c:(.text+0x106a): undefined reference to `BIO_new_socket'
client.c:(.text+0x1079): undefined reference to `SSL_set_bio'
client.c:(.text+0x1082): undefined reference to `SSL_connect'
collect2: ld returned 1 exit status
make: *** [link] Error 1


******************************************************

>From what I see, the SSL functionality is in client.o, which is part
of libpetsc.a, which is included in the linking.

There is no difference in whether I turn --with-ssl on or off...

Does anybody have an idea what I am doing wrong?

Best wishes and thank you for your time!

Lukas


More information about the petsc-users mailing list