On Mon, Jan 14, 2019 at 07:38:34AM +0100, Andreas Kusalananda Kähäri wrote:
> On Sun, Jan 13, 2019 at 04:37:23PM +0100, Thomas L. wrote:
> > Hi,
> > 
> > I tried compiling a MPI example program 
> > (https://raw.githubusercontent.com/wesleykendall/mpitutorial/gh-pages/tutorials/mpi-hello-world/code/mpi_hello_world.c)
> >  with openmpi on -current and it fails linking:
> > $ mpicc -v Downloads/mpi_hello_world.c                     
> > OpenBSD clang version 6.0.0 (tags/RELEASE_600/final) (based on LLVM 6.0.0)
> > Target: amd64-unknown-openbsd6.4
> > Thread model: posix
> > InstalledDir: /usr/bin
> >  "/usr/bin/cc" -cc1 -triple amd64-unknown-openbsd6.4 -emit-obj -mrelax-all 
> > -disable-free -disable-llvm-verifier -discard-value-names -main-file-name 
> > mpi_hello_world.c -mrelocation-model pic -pic-level 1 -pic-is-pie 
> > -mthread-model posix -mdisable-fp-elim -relaxed-aliasing -masm-verbose 
> > -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info 
> > -debugger-tuning=gdb -v -resource-dir /usr/lib/clang/6.0.0 -I 
> > /usr/local/include -fdebug-compilation-dir /home/tom -ferror-limit 19 
> > -fmessage-length 224 -femulated-tls -fwrapv -pthread -stack-protector 2 
> > -D_RET_PROTECTOR -ret-protector -fobjc-runtime=gnustep 
> > -fdiagnostics-show-option -fno-builtin-malloc -fno-builtin-calloc 
> > -fno-builtin-realloc -fno-builtin-valloc -fno-builtin-free 
> > -fno-builtin-strdup -fno-builtin-strndup -o /tmp/mpi_hello_world-a9e376.o 
> > -x c Downloads/mpi_hello_world.c
> > clang -cc1 version 6.0.0 based upon LLVM 6.0.0 default target 
> > amd64-unknown-openbsd6.4
> > #include "..." search starts here:
> > #include <...> search starts here:
> >  /usr/local/include
> >  /usr/lib/clang/6.0.0/include
> >  /usr/include
> > End of search list.
> >  "/usr/bin/ld" -e __start --eh-frame-hdr -Bdynamic -dynamic-linker 
> > /usr/libexec/ld.so -o a.out /usr/bin/../lib/crt0.o 
> > /usr/bin/../lib/crtbegin.o -L/usr/local/lib -L/usr/bin/../lib -L/usr/lib 
> > /tmp/mpi_hello_world-a9e376.o -lmpi -lopen-rte -lopen-pal -E -lutil -lm 
> > -lcompiler_rt -lpthread -lc -lcompiler_rt /usr/bin/../lib/crtend.o
> > /usr/bin/ld: error: undefined symbol: MPI_Init
> > >>> referenced by mpi_hello_world.c
> > >>>               /tmp/mpi_hello_world-a9e376.o:(main)
> > 
> > /usr/bin/ld: error: undefined symbol: MPI_Comm_size
> > >>> referenced by mpi_hello_world.c
> > >>>               /tmp/mpi_hello_world-a9e376.o:(main)
> > 
> > /usr/bin/ld: error: undefined symbol: MPI_Comm_rank
> > >>> referenced by mpi_hello_world.c
> > >>>               /tmp/mpi_hello_world-a9e376.o:(main)
> > 
> > /usr/bin/ld: error: undefined symbol: MPI_Get_processor_name
> > >>> referenced by mpi_hello_world.c
> > >>>               /tmp/mpi_hello_world-a9e376.o:(main)
> > 
> > /usr/bin/ld: error: undefined symbol: MPI_Finalize
> > >>> referenced by mpi_hello_world.c
> > >>>               /tmp/mpi_hello_world-a9e376.o:(main)
> > cc: error: linker command failed with exit code 1 (use -v to see invocation)
> > 
> > The reason seems to be, that the relevant symbols in libmpi.so.0.1 are 
> > local:
> > $ nm /usr/local/lib/libmpi.so.0.1  | grep MPI_Init
> > 00070330 t MPI_Init
> > 000704f0 t MPI_Init_thread
> > 000706b0 t MPI_Initialized
> > 00070330 T PMPI_Init
> > 000704f0 T PMPI_Init_thread
> > 000706b0 T PMPI_Initialized
> > 
> > Unfortunately, I have no idea why this happens.
> > 
> > Kind regards,
> > 
> > Thomas
> 
> Yes, I also noticed this in June last year [1].  Only the profiling
> version of each API function is non-local.  Unfortunately, I was in a
> hurry to get something working so I simply moved my development and
> testing to another operating system rather than digging into why this
> was so.  I might try to look into this later if time permits.
> 
> [1] https://marc.info/?l=openbsd-ports&m=152929789302360&w=2
> 
> 
> Regards,
> 
> -- 
> Andreas Kusalananda Kähäri,
> National Bioinformatics Infrastructure Sweden (NBIS),
> Uppsala University, Sweden.


Ok, so it seems OpenMPI has to be configured with --disable-visibility.
This would make the symbols show up as "W" ("weak") instead of as local.
A simple test program compiles.

A patch for the devel/openmpi port is attached, although the port we
have is marked as "ancient" on the OpenMPI web pages [1], and the latest
release is 4.0.0.

[1] https://www.open-mpi.org/

Regards,

-- 
Andreas Kusalananda Kähäri,
National Bioinformatics Infrastructure Sweden (NBIS),
Uppsala University, Sweden.
Index: Makefile
===================================================================
RCS file: /extra/cvs/ports/devel/openmpi/Makefile,v
retrieving revision 1.25
diff -u -p -r1.25 Makefile
--- Makefile    24 Oct 2018 14:28:00 -0000      1.25
+++ Makefile    14 Jan 2019 08:35:11 -0000
@@ -7,7 +7,7 @@ COMMENT =               open source MPI-2 implementat
 
 V=                     1.4.1
 DISTNAME =             openmpi-$V
-REVISION =             7
+REVISION =             8
 
 SHARED_LIBS =          mca_common_sm 1.0 \
                        mpi 0.1 \
@@ -39,6 +39,7 @@ USE_LIBTOOL =         No
 FAKE_FLAGS =           sysconfdir=${PREFIX}/share/examples/openmpi/
 CONFIGURE_STYLE =      gnu
 CONFIGURE_ENV =                F77=${MODFORTRAN_COMPILER}
+CONFIGURE_ARGS =       --disable-visibility
 
 # openmpi's otfinfo conflicts with the one from texlive
 post-install:

Reply via email to