Issue resolved by setting OMPI_CC=gcc
On Sun, Jun 17, 2018 at 11:18:31AM +0200, Andreas Kusalananda Kähäri wrote:
> Hi,
>
> I'm trying to build a piece of software that uses MPI. On a current
> amd64 OpenBSD system I use the devel/openmpi port for this, but simple
> test programs fail to link properly, complaining about the MPI
> functions:
>
> #include <mpi.h>
>
> int
> main(int argc, char **argv)
> {
> MPI_Init(&argc, &argv);
> MPI_Finalize();
> return 0;
> }
>
>
> Compiling this:
>
> $ mpicc mpitest.c
> /usr/local/lib/libopen-pal.so.0.0: warning: strcat() is almost always
> misused, please use strlcat()
> /usr/local/lib/libmpi.so.0.1: warning: strcpy() is almost always misused,
> please use strlcpy()
> /usr/local/lib/libopen-rte.so.0.0: warning: rand() may return deterministic
> values, is that what you want?
> /usr/local/lib/libopen-rte.so.0.0: warning: sprintf() is often misused,
> please use snprintf()
> /usr/local/lib/libopen-pal.so.0.0: warning: vsprintf() is often misused,
> please use vsnprintf()
> /tmp_mfs/mpitest-e45b73.o: In function `main':
> mpitest.c:(.text+0x3d): undefined reference to `MPI_Init'
> mpitest.c:(.text+0x45): undefined reference to `MPI_Finalize'
> cc: error: linker command failed with exit code 1 (use -v to see invocation)
>
> How do I go about working around this?
>
> I notice that the ordinary MPI functions in libmpi.so.0.1 are marked as
> "local" (they have 't' in the nm output), whereas the profiling version
> of the functions are not. The profiling functions have a 'P' prefix
> (e.g. "PMPI_Init()") and the link properly. Th issue is that I'm trying
> to compile a preexisting piece of software and I don't want it to call
> the profiling routines.
>
> The devel/openmpi port was built from source, but the same error occurs
> with the package version.
>
> --
> Andreas Kusalananda Kähäri,
> National Bioinformatics Infrastructure Sweden (NBIS),
> Uppsala University, Sweden.
>
>
>
>
>
>
>
>
> När du har kontakt med oss på Uppsala universitet med e-post så innebär det
> att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan
> du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/
>
> E-mailing Uppsala University means that we will process your personal data.
> For more information on how this is performed, please read here:
> http://www.uu.se/om-uu/dataskydd-personuppgifter/
>
--
Andreas Kusalananda Kähäri,
National Bioinformatics Infrastructure Sweden (NBIS),
Uppsala University, Sweden.