I've identified the difference between the platform that does link libutil
and the one that does not.

1) libutil is linked (as an OMPI dependency) only on the working system:

Working system:
$ grep 'checking for .* LIBS' configure.out
checking for OPAL LIBS... -lm -lpciaccess -ldl
checking for ORTE LIBS... -lm -lpciaccess -ldl -ltorque
checking for OMPI LIBS... -lm -lpciaccess -ldl -ltorque -lrt -lnsl -lutil

NON-working system:
$ grep 'checking for .* LIBS' configure.out
checking for OPAL LIBS... -lm -ldl
checking for ORTE LIBS... -lm -ldl -ltorque
checking for OMPI LIBS... -lm -ldl -ltorque

So, the working system that does link libutil is doing so as an OMPI
dependency.
However it is also needed for opal (only caller of openpty is
opal/util/open_pty.c).

2) Only the working system is building ROMIO:

Comparing the 'checking if * can compile' lines of configure output shows
only ONE difference:

 checking if MCA component fs:ufs can compile... yes
 checking if MCA component fs:pvfs2 can compile... no
 checking if MCA component io:ompio can compile... yes
-checking if MCA component io:romio can compile... no
+checking if MCA component io:romio can compile... yes
 checking if MCA component mpool:grdma can compile... yes
 checking if MCA component mpool:sm can compile... yes
 checking if MCA component mpool:udreg can compile... no

So, it appears that *if* ROMIO is configured in, then "-lutil" gets added
to OMPI_WRAPPER_EXTRA_LIBS.
This masks the fact that it is missing from OPAL_WRAPPER_EXTRA_LIBS.


I have confirmed that I can reproduce the static linking failure by adding
--disable-io-romio to the configure options of the system that worked
previously.

So, I update my report (and the email subject line) to:
   Static linking fails on Linux when not building ROMIO

-Paul



On Sun, Aug 3, 2014 at 6:22 PM, Paul Hargrove <phhargr...@lbl.gov> wrote:

> Hmm,
>
> On a different Linux/x86-64 host things work as expected with '-lutil'
> linked explicitly:
>
> $ ./INST/bin/mpicc -showme BLD/examples/hello_c.c
> pgcc BLD/examples/hello_c.c
> -I/scratch/scratchdirs/hargrove/OMPI/openmpi-1.8.2rc3-linux-x86_64-pgi-14.1/INST/include
> -L/opt/torque/4.2.7.h1/lib -Wl,-rpath -Wl,/opt/torque/4.2.7.h1/lib
> -Wl,-rpath -Wl,/opt/torque/4.2.7.h1/lib -Wl,-rpath
> -Wl,/opt/torque/4.2.7.h1/lib -Wl,-rpath -Wl,/opt/torque/4.2.7.h1/lib
> -Wl,-rpath
> -Wl,/scratch/scratchdirs/hargrove/OMPI/openmpi-1.8.2rc3-linux-x86_64-pgi-14.1/INST/lib
> -L/scratch/scratchdirs/hargrove/OMPI/openmpi-1.8.2rc3-linux-x86_64-pgi-14.1/INST/lib
> -lmpi -lopen-rte -lopen-pal -lm -lpciaccess -ldl -ltorque -lrt -lnsl -lutil
>
> Searching for relevant differences now...
>
> -Paul
>
>
> On Sun, Aug 3, 2014 at 4:58 PM, Paul Hargrove <phhargr...@lbl.gov> wrote:
>
>>
>> I've configured the 1.8.2rc3 tarball with "--enable-static
>> --disable-shared" on a fairly standard Linux/x86-64 platform.  While there
>> are no problems on the same platform w/o these configure flags, with them I
>> cannot link any application codes.
>>
>> $ mpicc -g    hello_c.c   -o hello_c
>> /global/homes/h/hargrove/GSCRATCH/OMPI/openmpi-1.8.2rc3-linux-x86_64-static/INST/lib/libopen-pal.a(opal_pty.o):
>> In function `opal_openpty':
>> opal_pty.c:(.text+0x1): undefined reference to `openpty'
>>
>> I checked "make openpty" and the manpage says to link with '-lutil'.
>> The '-showme' does not show libutil:
>>
>> $ mpicc -showme hello_c.c
>> gcc hello_c.c
>> -I/global/homes/h/hargrove/GSCRATCH/OMPI/openmpi-1.8.2rc3-linux-x86_64-static/INST/include
>> -pthread -L/usr/syscom/opt/torque/4.1.4/lib -Wl,-rpath
>> -Wl,/usr/syscom/opt/torque/4.1.4/lib -Wl,-rpath
>> -Wl,/usr/syscom/opt/torque/4.1.4/lib -Wl,-rpath
>> -Wl,/usr/syscom/opt/torque/4.1.4/lib -Wl,-rpath
>> -Wl,/usr/syscom/opt/torque/4.1.4/lib -Wl,-rpath
>> -Wl,/global/homes/h/hargrove/GSCRATCH/OMPI/openmpi-1.8.2rc3-linux-x86_64-static/INST/lib
>> -Wl,--enable-new-dtags
>> -L/global/homes/h/hargrove/GSCRATCH/OMPI/openmpi-1.8.2rc3-linux-x86_64-static/INST/lib
>> -lmpi -lopen-rte -lopen-pal -lm -ldl -ltorque -libverbs -lrdmacm
>>
>>
>> It looks like configure is doing the right thing on some level, but
>> failing to add '-lutil' to the appropriate list of libs
>> (OPAL_WRAPPER_EXTRA_LIBS?):
>>
>>
>> ============================================================================
>> == Library and Function tests
>>
>> ============================================================================
>> checking if we need -lutil for openpty... yes
>> checking for openpty... yes
>>
>>
>> -Paul
>>
>> --
>> Paul H. Hargrove                          phhargr...@lbl.gov
>> Future Technologies Group
>> Computer and Data Sciences Department     Tel: +1-510-495-2352
>> Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900
>>
>
>
>
> --
> Paul H. Hargrove                          phhargr...@lbl.gov
> Future Technologies Group
> Computer and Data Sciences Department     Tel: +1-510-495-2352
> Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900
>



-- 
Paul H. Hargrove                          phhargr...@lbl.gov
Future Technologies Group
Computer and Data Sciences Department     Tel: +1-510-495-2352
Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900

Reply via email to