FS#13333 - gdbm_compat not linking to gdbm

Attached to Project: Arch Linux
Opened by Damjan Georgievski (damjan) - Tuesday, 17 February 2009, 02:59 GMT
Last edited by Aaron Griffin (phrakture) - Tuesday, 17 February 2009, 03:40 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version None
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Package: gdbm-1.8.3-5

Compiling a simple program (taken from a ./configure script) like this:
// ------
extern char dbm_open();
int main ()
{
dbm_open();
return 0;
}
// ------
with "gcc test.c -lgdbm_compat" fails with several "undefined reference to ..gdbm.." errors.

linking with gdbm_compat and gdbm does succeed. I think the main problem is that gdbm_compat should be linked to gdbm.

$ ldd /usr/lib/libgdbm_compat.so
linux-gate.so.1 => (0xa7f4d000)
libc.so.6 => /lib/libc.so.6 (0xa7dd3000)
/lib/ld-linux.so.2 (0xa7f4e000)
This task depends upon

Closed by  Aaron Griffin (phrakture)
Tuesday, 17 February 2009, 03:40 GMT
Reason for closing:  Not a bug
Comment by Aaron Griffin (phrakture) - Tuesday, 17 February 2009, 03:40 GMT
That is not the way linking works with gcc. See the gdbm man page:

LINKING
This library is accessed by specifying -lgdbm as the last parameter to the compile line, e.g.:

gcc -o prog prog.c -lgdbm

If you wish to use the dbm or ndbm compatibility routines, you must link in the gdbm_compat library as well. For example:

gcc -o prog proc.c -lgdbm -lgdbm_compat

Loading...