--enable-all-static configure flag breaks examples

Issue #44 new
Jason Sarich created an issue

configuring with --enable-all-static puts -all-static into LDFLAGS. This is fine for building the MOAB libraries with libtool, but when used to build applications, as in the examples directory, it causes an error.

dnl Before configuring libtool check for --enable-all-static option                                                                              
AC_ARG_ENABLE(all-static,
  AS_HELP_STRING([--enable-all-static],
                 [Build completely static (standalone) binaries.]),
  [
    if ( test "x$enable_static" != "xno" ); then
      if ( test "$enableval" = "yes" ); then
        LDFLAGS="-all-static $LDFLAGS"
      fi
    else
      AC_MSG_WARN([ Static linking disabled. Ignoring --enable-all-static option. Please add --enable-static also. ])
    fi
])

Comments (2)

  1. Iulian Grindeanu

    I think that -all-static is supported fully on gnu compilers. Even on gnu compilers, its use can give errors, if we use it on different platforms than the dependent libraries were built.

    Case in point: most moab dependencies were built on gnep, ubuntu 12 at the time. Using --enable-all-static on compute001, an ubuntu 14 machine, will prevent correct linking, with errors like

    /homes/fathom/3rdparty/hdf5/1.8.12/mpich-3.1/gnu/lib/libhdf5.a(H5PL.o): In function `H5PL_load':
    H5PL.c:(.text+0x39c): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /homes/iulian/lib/parallel/cgmfacet/lib/libcgm.a(CubitFileUtil.o): In function `CubitFileUtil::find_home_path(CubitString const&)':
    /homes/iulian/source/CGMfacet/src/util/../../../CGMsource/src/util/CubitFileUtil.cpp:138: warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/lib/x86_64-linux-gnu/libcurl-gnutls.a(libcurl_gnutls_la-netrc.o): In function `Curl_parsenetrc':
    (.text+0x362): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/lib/x86_64-linux-gnu/libcurl-gnutls.a(libcurl_gnutls_la-curl_addrinfo.o): In function `Curl_getaddrinfo_ex':
    (.text+0x70): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /homes/fathom/3rdparty/mpich/3.1/gnu2/lib/libmpich.a(tcp_init.o): In function `GetSockInterfaceAddr':
    /homes/fathom/3rdparty/mpich/sources/mpich-3.1/src/mpid/ch3/channels/nemesis/netmod/tcp/tcp_init.c:373: warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/lib/x86_64-linux-gnu/libcurl-gnutls.a(libcurl_gnutls_la-url.o): In function `Curl_disconnect':
    (.text+0x4e3c): undefined reference to `idn_free'
    /usr/lib/x86_64-linux-gnu/libcurl-gnutls.a(libcurl_gnutls_la-url.o): In function `Curl_disconnect':
    (.text+0x4e4d): undefined reference to `idn_free'
    /usr/lib/x86_64-linux-gnu/libcurl-gnutls.a(libcurl_gnutls_la-url.o): In function `fix_hostname':
    (.text.unlikely+0x1e7): undefined reference to `stringprep_check_version'
    

    We added this option for BG/Q, but I think it should be disabled for other platforms. It will try to link statically everything.

  2. Vijay M

    --all-static is not on by default. Yes this will cause issues when dependencies don't have a static version of the library available in the system. And so I think the behavior is expected.

    As Iulian mentions, we introduced this specifically for BG/Q where adding this configure option was necessary to force the compilers to pick only the static libraries during linking.

  3. Log in to comment