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.

Reply via email to