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

Reply via email to