My general problem is that I need to link my code with the FLEXlm libraries that are on my build machine, but I also need to link with the MPICH libraries on the customer’s machine (because they have weird locations for everything). My goal is to never have source code or non-stripped object code on the customer’s machine, but to deliver a MPI-capable executable. I have just learned about partial linking with the -r option. I suspect that this is what I need to use.
I want to test this locally, so I build each of my source files with:
pgf90 -w -Mpreprocess -Bstatic -DIS_MPI -fast -tp px -c dynamic.f
plus more of the same, and also two that look like this:
gcc -w -I/home/guest/flexlm/v10.1/machind -I/home/guest/flexlm/v10.1/i86_r9 -c license.c
(I guess I could also use pgcc for those.)
I create the relocatable object with:
pgf90 -Mnostdlib -w -Bstatic -r -I/home/guest/flexlm/v10.1/machind -L/home/guest/flexlm/v10.1/i86_r9 -llmgr_nomt -lcrvs -lsb -o reloc.o dynamic.o [....lots more .o files]
And I make the executable with:
mpif90 -w -Bstatic -Wl,--allow-multiple-definition -o runme reloc.o
I use the “–allow-multiple-definition” because the linker complains about multiple “main” and “init” routines. I only have one main. But it segfaults when I “mpirun” it.
I try building with debugging information (-g) , but gdb returns:
Breakpoint 1 at 0x8176d40 Program received signal SIGSEGV, Segmentation fault. 0xbfffe02c in ?? ()
Am I just understanding relocatable objects incorrectly? I couldn’t find any information in the pgiug.pdf manual, and the online “compiling and linking” tutorials don’t seem to address this need.