Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-8196

avoid linker's stripping of dead code from interfering with configure's library name resolution

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 2.0.0-alpha
    • None
    • native
    • None

    Description

      The configure script generated by hadoop-common/hadoop-common-project/hadoop-common/src/main/native/configure.ac uses the AC_COMPUTE_NEEDED_DSO m4 macro to generate a small probe program in C which it then compiles and links, and then scans the resultant binary to find the names of certain libraries: currently this is used for Zlib and Snappy.

      I was unable to compile with -Pnative on my Ubuntu Linux install because configure could not find libz and libsnappy. This turned out to be because the linker is removing the dependencies on libz and libsnappy at link-time because the libraries in question are not used in the simple probe code generated by the AC_COMPUTE_NEEDED_DSO m4 macro.

      So my fix is modify the AC_COMPUTE_NEEDED_DSO to take another parameter that copies the given argument's text into the C program. Then, in the call to AC_COMPUTE_NEEDED_DSO, we can use this additional parameter, to include, in the generated C code, an actual library function call for each library. This prevents the linker from removing the linkage to the desired libraries.

      My gcc and ldd version information are given below:

      eugene@latitude:~/hadoop-common$ gcc --version
      gcc (Ubuntu/Linaro 4.6.3-1ubuntu3) 4.6.3
      Copyright (C) 2011 Free Software Foundation, Inc.
      This is free software; see the source for copying conditions.  There is NO
      warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
      
      eugene@latitude:~/hadoop-common$ ld --version
      GNU ld (GNU Binutils for Ubuntu) 2.22
      Copyright 2011 Free Software Foundation, Inc.
      This program is free software; you may redistribute it under the terms of
      the GNU General Public License version 3 or (at your option) a later version.
      This program has absolutely no warranty.
      
      

      Attachments

        1. HADOOP-8196.patch
          2 kB
          Eugene Joseph Koontz

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ekoontz Eugene Joseph Koontz
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: