[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#584607: libc6: autoconf configure scripts hang at "checking whether a statically linked program can dlopen itself"



On 6/4/10, Clint Adams <schizo@debian.org> wrote:
> On Fri, Jun 04, 2010 at 10:08:06PM -0300, Nicolás Alvarez wrote:
>> I'm using a Debian testing/unstable mix. Most packages are from testing
>> (squeeze). Today, I upgraded to libc from 2.10.2-9 to the version from
>> unstable (2.11.1-2). After the upgrade, autoconf-generated configure
>> scripts stopped working. They hang on this step:
>>
>> [...]
>> checking whether a program can dlopen itself... yes
>> checking whether a statically linked program can dlopen itself...
>
> I cannot reproduce this.  Could you be more specific about which configure
> script is involved?

Attached is the conftest.c that is being compiled by configure (after
manually replacing the #include "confdefs.h" with the contents of that
file). Compiler flags used:

gcc -o conftest -g -O2  -DHAVE_DLFCN_H  -Wl,--export-dynamic -static
conftest.c -ldl

-- 
Nicolas
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_DLFCN_H 1
#define LT_OBJDIR ".libs/"

#if HAVE_DLFCN_H
#include <dlfcn.h>
#endif

#include <stdio.h>

#ifdef RTLD_GLOBAL
#  define LT_DLGLOBAL		RTLD_GLOBAL
#else
#  ifdef DL_GLOBAL
#    define LT_DLGLOBAL		DL_GLOBAL
#  else
#    define LT_DLGLOBAL		0
#  endif
#endif

/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
   find out it does not work in some platform. */
#ifndef LT_DLLAZY_OR_NOW
#  ifdef RTLD_LAZY
#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
#  else
#    ifdef DL_LAZY
#      define LT_DLLAZY_OR_NOW		DL_LAZY
#    else
#      ifdef RTLD_NOW
#        define LT_DLLAZY_OR_NOW	RTLD_NOW
#      else
#        ifdef DL_NOW
#          define LT_DLLAZY_OR_NOW	DL_NOW
#        else
#          define LT_DLLAZY_OR_NOW	0
#        endif
#      endif
#    endif
#  endif
#endif

void fnord() { int i=42;}
int main ()
{
  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
  int status = 0;

  if (self)
    {
      if (dlsym (self,"fnord"))       status = 1;
      else if (dlsym( self,"_fnord")) status = 2;
      /* dlclose (self); */
    }
  else
    puts (dlerror ());

  return status;
}

Reply to: