avoid linker's stripping of dead code from interfering with configure's library
name resolution
-----------------------------------------------------------------------------------------------
Key: HADOOP-8196
URL: https://issues.apache.org/jira/browse/HADOOP-8196
Project: Hadoop Common
Issue Type: Bug
Components: native
Reporter: Eugene Koontz
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:
{code}
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.
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira