Fix psolver m4
Description
TLDR: This MR solves the issue in the psolver m4 by using a test program that calls the pkernel_init
in the old API test program. This ensures that if the supplied psolver is of the new API, the compiler fails with an error at the compilation stage rather than the linking stage. This addresses the bug detected when compiling the bigdftsuite with dynamic libraries in a test Spack toolchain.
Detailed description:
The psolver m4 is supposed to detect both old (1.8.3) and new versions (1.9.2) of Psolver.
The current version of the psolver m4, first runs a test that calls the function pkernel_set
if that fails,
then tests for the new api in calling the function pkernel_init
.
The problem with this is that, pkernel_set
works for both new and old api of psolver which means that,
in the current scheme, even the new psolver (1.9.2) compiles the first test program fine
(as pkernel_set
call works in both) and reports itself as the old api.
This then means that the HAVE_PSOLVER_NEW_API
is not set and the compilation breaks due to type mismatch ( as only the old code path is used).
This was not detected in the previous MR for psolver as the compilation of the first test program on spack based new psolver failed due to a missing link to atlab library: https://www.octopus-code.org/buildbot/#/builders/139/builds/39/steps/5/logs/config_log
configure:16760: checking for PSolver
configure:16817: gfortran -o conftest -I /opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/bigdft-psolver-1.9.2-5gelzg4rv7soixvfvhzwlqknrywc3rim/include -Wall -Wno-maybe-uninitialized -Wno-surprising -O3 -march=native -fbacktrace -funroll-loops -fopenmp -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/perl-yaml-1.27-7m7almvr6f2r5esjjivx5lzun5pb2z4m/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/dftbplus-21.2-xpfbgmaw5oavgqfuehnrjzmuf5oheknn/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/bigdft-psolver-1.9.2-5gelzg4rv7soixvfvhzwlqknrywc3rim/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/bigdft-atlab-1.9.2-qj2zmdpgtvndlmyezmdsyuhilgbycpew/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/bigdft-futile-1.9.2-kwo7r2n6a6pky53if5lk245vbp3odka7/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/py-pyyaml-6.0-fv4yvjoveo7mu25xgajnzxs3dkgt4urg/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/libyaml-0.2.5-tmah4brb5iwbtzpr5yisiruy4dsf76vm/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/etsf-io-1.0.4-okkhzs2niabbiimuvkjpn6sfnapx77zd/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/netcdf-fortran-4.6.0-ktabcqaizkwwkd6cpxxu6tzbntd4yjrw/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/netcdf-c-4.9.0-iz6emcqvmxrktpwyiwbw6sbowdqvi2we/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/cgal-5.0.3-u3xfskgbkegoa2yvv4ldtsjxd7peh6bk/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/mpfr-4.1.0-kmyc6mjzrb7jsw7rjb55jlfmunhjhdp5/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/gmp-6.2.1-vlh35cwddzmvg7oqbb7puwh4kf6k5fu4/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/b
oost-1.80.0-2v35at7wlyzp5kyqlsjrv2xrl3je5hki/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/berkeleygw-2.1-7xljng4c5b5mnskbn6e4t4zxlnppyiuf/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/hdf5-1.12.2-zdllkwv54zx5bnyd2bkb3qerziw55l46/lib -Wl,-r
path=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/pkgconf-1.8.0-sta2z7usqtetiirwphuv6qgchpyowd4b/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/nfft-3.2.4-yko6pa4rxev4rdrjr74swxnm66hxnahe/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/libvdwxc-0.4.0-u2qtn4pbnk6vn5bsfg56jg4x7ijy672h/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/libgd-2.2.4-mmfczfyen5c5gv3celtjcc4rsnuxcf4a/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/libtiff-4.4.0-txnovsfnoxfnnavjtk3gcxknejwu3if3/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/libjpeg-turbo-2.1.3-6r5yyrycjj2qpdeef7vyrxtbccwzrwpr/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/fontconfig-2.13.94-xyi3zn7r5trivribzgaaxmd4fei6j6yv/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/freetype-2.11.1-spou4zclzmyhd4j5skkoxehvdnh5nryw/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/libpng-1.6.37-7twleyi5zap3vazswvy6t3drsb7vl2ut/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/font-util-1.3.2-hkcajmigi3xgoj2bxlkxrspdttt66fpd/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/nlopt-2.7.0-vb7t3x3vk2ne4cdbhrymg2v2vombdhvk/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/pcre-8.45-ydudoahzskcaytnb5suoi36uimonsxnc/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/py-numpy-1.23.4-5cojlw5fxxznqum7ogsw5qryhbkdw66p/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/py-setuptools-59.4.0-232ry6l6vm4ikcydx4mgzme4ajupz5ld/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/python-3.9.5-gxpc35buoioi6zcita3taatixuz3rb7b/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/util-linux-uuid-2.38.1-aankkqlqpx6u63fj7ebb72o3em7lwha5/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/sqlite-3.39.4-zjmvithdt3tqqzd67s5cygnt757qantg/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/libffi-3.4.2-232nk5rzmum5m54kjwlwkrni2ifkod4d/lib64 -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/libffi-3.4.2-232nk5rzmum5m54kjwlwkrni2ifkod4d/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/expat-2.4.8-wrtda6kmuz7couv4qkg5dgnyfjgnn2io/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/libbsd-0.11.5-hl2s4gvgblf6cj4aq56ankh7vlqdcrne/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/libmd-1.0.4-iulgx7l7kydt6o4wyyqipafqaco2ph2l/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/sparskit-develop-np3gvunmprfszkk6phg567or67gv3f3j/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/gsl-2.7.1-zp2gnohs5lxnujobwrbr3gicz2vdc5jj/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/libxc-5.2.3-y773nwtisxez7xtazgeoaszuzjbx4qst/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/libtool-2.4.7-ztm2wtmskzkslwmjswipwa34wvdjhkuc/lib -Wl,-
rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/perl-5.36.0-tv77hmxbppbl3ztusx5w3liyiaqfrdp7/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/gdbm-1.23-juoiiqzk3esklh7ccra6sjynzb44nnzm/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/readline-8.1.2-ukkcyczwgy4vigifnhfqbwhrfft7yt6r/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/berkeley-db-18.1.40-pbfksjroupqccyurpe5xrkum3bwjfxce/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/libsigsegv-2.13-a7mtmzymja6pwccj6tgkqagtoarchliv/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/openblas-0.3.20-yre2piwvwhekexfcoxzxmxlgvutgrsxu/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/fftw-3.3.10-susnnr2vitgjh6nqajmr7vfu7afumeti/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/binutils-2.38-n7v5pzd4bru52abuw3uo7cfbzmwdyv6x/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/gettext-0.21.1-ybar4vbbyn322ki6ann7vz7ar7ank5lb/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/zstd-1.5.2-ere6pux7lo62xlveg4mfgoxr4df7cvdo/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/libxml2-2.10.1-6baq52prwu2gbk4spbqzfefnr6rtjtzl/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/xz-5.2.7-dng6ghgtnutks3i4ushbp6uhpnb5vxxl/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/libiconv-1.16-kvx6gwtwnbw3r7z7iiuiuepfx6edb2mk/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/bzip2-1.0.8-xp5cmhj6tci4gdvh5obr5bj5sf3rwmq2/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/openssl-1.1.1s-twnyaplk2vju6yy6q4vl2txqy6fbxpeq/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/zlib-1.2.13-w2msr35kqthktxqfqygbfflmuyrbikga/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/ncurses-6.3-yhcw4f4wdc6utrxeful3pwijls4ohwwj/lib -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-x86_64_v2/gcc-10.2.1/gcc-11.3.0-5uyv23o3gjfskdf4xyx7uem35j6meh2n/lib64 -Wl,-rpath=/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-x86_64_v2/gcc-10.2.1/gcc-11.3.0-5uyv23o3gjfskdf4xyx7uem35j6meh2n/lib conftest.f90 -L/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/bigdft-psolver-1.9.2-5gelzg4rv7soixvfvhzwlqknrywc3rim/lib -lPSolver-1 -L/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/bigdft-futile-1.9.2-kwo7r2n6a6pky53if5lk245vbp3odka7/lib -lfutile-1 -lyaml -L/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/openblas-0.3.20-yre2piwvwhekexfcoxzxmxlgvutgrsxu/lib -lopenblas >&5
/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/binutils-2.38-n7v5pzd4bru52abuw3uo7cfbzmwdyv6x/bin/ld: /opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/bigdft-psolver-1.9.2-5gelzg4rv7soixvfvhzwlqknrywc3rim/lib/libPSolver-1.a(Poisson_Solver.o): in function `__poisson_solver_MOD_pkernel_set':
Poisson_Solver.f90:(.text+0x5386): undefined reference to `__at_domain_MOD_domain_geocode'
/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/binutils-2.38-n7v5pzd4bru52abuw3uo7cfbzmwdy
v6x/bin/ld: /opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/bigdft-psolver-1.9.2-5gelzg4rv7soixvfvhzwlqknrywc3rim/lib/libPSolver-1.a(Poisson_Solver.o): in function `__poisson_solver_MOD_ps_dump_coulomb_operator':
Poisson_Solver.f90:(.text+0xd5b4): undefined reference to `__iobox_MOD_dump_field'
/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/binutils-2.38-n7v5pzd4bru52abuw3uo7cfbzmwdyv6x/bin/ld: Poisson_Solver.f90:(.text+0xd699): undefined reference to `__iobox_MOD_dump_field'
..............
Build_Kernel.f90:(.text+0x764d): undefined reference to `__at_domain_MOD_square'
/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/binutils-2.38-n7v5pzd4bru52abuw3uo7cfbzmwdyv6x/bin/ld: /opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/bigdft-psolver-1.9.2-5gelzg4rv7soixvfvhzwlqknrywc3rim/lib/libPSolver-1.a(scaling_function.o): in function `scaling_function_':
scaling_function.f90:(.text+0x7139): undefined reference to `get_isf_family_'
/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/binutils-2.38-n7v5pzd4bru52abuw3uo7cfbzmwdyv6x/bin/ld: scaling_function.f90:(.text+0x72e4): undefined reference to `back_trans_'
/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/binutils-2.38-n7v5pzd4bru52abuw3uo7cfbzmwdyv6x/bin/ld: /opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/bigdft-psolver-1.9.2-5gelzg4rv7soixvfvhzwlqknrywc3rim/lib/libPSolver-1.a(PSolver_Base_new.o): in function `g_poissonsolver_':
PSolver_Base_new.f90:(.text+0x4bf): undefined reference to `__at_domain_MOD_domain_geocode'
/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/binutils-2.38-n7v5pzd4bru52abuw3uo7cfbzmwdyv6x/bin/ld: PSolver_Base_new.f90:(.text+0x556): undefined reference to `__at_domain_MOD_domain_periodic_dims'
/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/binutils-2.38-n7v5pzd4bru52abuw3uo7cfbzmwdyv6x/bin/ld: /opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/bigdft-psolver-1.9.2-5gelzg4rv7soixvfvhzwlqknrywc3rim/lib/libPSolver-1.a(PSolver_Base_new.o): in function `internal_loop.0':
PSolver_Base_new.f90:(.text+0x4ead): undefined reference to `__at_domain_MOD_square'
collect2: error: ld returned 1 exit status
configure:16817: $? = 1
configure: failed program was:
| program main
|
| use Poisson_Solver
|
| implicit none
| type(coulomb_operator) :: pkernel
| real(dp) :: eps(1,1,1)
|
| call pkernel_set(pkernel,eps=eps)
|
| call pkernel_free(pkernel)
|
| end
configure:16824: result: no (-I /opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/bigdft-psolver-1.9.2-5gelzg4rv7soixvfvhzwlqknrywc3rim/include -L/opt_mpsd/linux-debian11/23b/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/bigdft-psolver-1.9.2-5gelzg4rv7soixvfvhzwlqknrywc3rim/lib -lPSolver-1)
But rather it didnt fail due to compiler error. This bug in the psolver m4 was detected when the bigdftsuite was comiled with dynamic libraries in a test spack toolchain. The first test program compiled as dynamic libraries load its dependencies dynamically, so the failing test which hinged on the test failing due to the "required but missing" library didn't work anymore.
This MR solves this issue by using a test program which calls the pkernel_init
in the old api, this way if the supplied is of new api, the compiler fails with an error at compilation stage and not at the linking stage.