apps can't be linked against libdl in 12.04

Bug #1002672 reported by lvd
This bug affects 1 person
Affects Status Importance Assigned to Milestone
eglibc (Ubuntu)

Bug Description

An example program:

#include <stdio.h>
#include <dlfcn.h>

 dlopen("/lib/", RTLD_NOW);


and its compilation gives:

lvd@ubuserv1204:~/tmp/dltest$ gcc -c dltest.c
lvd@ubuserv1204:~/tmp/dltest$ gcc -ldl -o dltest dltest.o
dltest.o: In function `main':
dltest.c:(.text+0xf): undefined reference to `dlopen'
collect2: ld returned 1 exit status

This bug exists in i386, pure amd64 and in multilib (both with -m32 option to gcc and without).

Please ask me for additional info.

Revision history for this message
lvd (lvd-mhm) wrote :

my info about eglibc is wrong:

lvd@ubuserv1204:~$ dpkg --search libdl
libc6: /lib/x86_64-linux-gnu/
libc6-dev: /usr/lib/x86_64-linux-gnu/
libc6-dev: /usr/lib/x86_64-linux-gnu/libdl.a
libc6: /lib/x86_64-linux-gnu/

so libc6 is probably the cause.

lvd@ubuserv1204:~$ gcc

Revision history for this message
Jason Conti (jconti) wrote :

You need to specify the libraries after the code that reference them. So the correct method is:

gcc -o dltest dltest.o -ldl

The command line above would work anyways prior to oneiric, but from oneiric onward the linker is more strict. See

Marking as invalid.

Changed in eglibc (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers