Hi,
I've acquired the libmdb tools from the Gitorious page. I've got it to compile (with some warnings, see below) but it throws an error when I try and run mdb_stat on the mdb directory:
Compilation yields the following:
[root@birch libmdb]# ./make.sh gcc -pthread -O2 -g -DMDB_DSYNC=O_SYNC -W -Wall -Wno-unused-parameter -Wbad-function-cast -std=c99 -pedantic -fPIC -c mdb.c mdb.c:433: warning: extra semicolon in struct or union specified mdb.c:796: warning: implicit declaration of function ‘fdatasync’ mdb.c:1388: warning: implicit declaration of function ‘pwrite’ mdb.c:1699: warning: implicit declaration of function ‘ftruncate’ mdb.c:1885: warning: implicit declaration of function ‘strdup’ mdb.c:1885: warning: assignment makes pointer from integer without a cast mdb.c:4079: warning: assignment makes pointer from integer without a cast gcc -pthread -O2 -g -DMDB_DSYNC=O_SYNC -W -Wall -Wno-unused-parameter -Wbad-function-cast -std=c99 -pedantic -fPIC -c midl.c ar rs libmdb.a mdb.o midl.o ar: creating libmdb.a gcc -shared -o libmdb.so mdb.o midl.o gcc -pthread -O2 -g -DMDB_DSYNC=O_SYNC -W -Wall -Wno-unused-parameter -Wbad-function-cast -std=c99 -pedantic -c mdb_stat.c gcc -pthread -O2 -g -DMDB_DSYNC=O_SYNC -W -Wall -Wno-unused-parameter -Wbad-function-cast -std=c99 -pedantic mdb_stat.o libmdb.a -o mdb_stat gcc -pthread -O2 -g -DMDB_DSYNC=O_SYNC -W -Wall -Wno-unused-parameter -Wbad-function-cast -std=c99 -pedantic -c mtest.c gcc -pthread -O2 -g -DMDB_DSYNC=O_SYNC -W -Wall -Wno-unused-parameter -Wbad-function-cast -std=c99 -pedantic mtest.o libmdb.a -o mtest gcc -pthread -O2 -g -DMDB_DSYNC=O_SYNC -W -Wall -Wno-unused-parameter -Wbad-function-cast -std=c99 -pedantic -c mtest2.c gcc -pthread -O2 -g -DMDB_DSYNC=O_SYNC -W -Wall -Wno-unused-parameter -Wbad-function-cast -std=c99 -pedantic mtest2.o libmdb.a -o mtest2 gcc -pthread -O2 -g -DMDB_DSYNC=O_SYNC -W -Wall -Wno-unused-parameter -Wbad-function-cast -std=c99 -pedantic -c mtest3.c gcc -pthread -O2 -g -DMDB_DSYNC=O_SYNC -W -Wall -Wno-unused-parameter -Wbad-function-cast -std=c99 -pedantic mtest3.o libmdb.a -o mtest3
Running the command gives the following:
[root@birch tmp]# ./mdb_stat /usr/local/authz/var/openldap-data/authorise-test mdb_env_open failed, error 22
Running this through strace looks like:
[root@birch tmp]# strace ./mdb_stat /usr/local/authz/var/openldap-data/authorise-test execve("./mdb_stat", ["./mdb_stat", "/usr/local/authz/var/openldap-da"...], [/* 29 vars */]) = 0 brk(0) = 0x200f000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb138ef5000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=66956, ...}) = 0 mmap(NULL, 66956, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb138ee4000 close(3) = 0 open("/lib64/libpthread.so.0", O_RDONLY) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\\340\2401\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=145720, ...}) = 0 mmap(0x31a0e00000, 2212768, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x31a0e00000 mprotect(0x31a0e17000, 2097152, PROT_NONE) = 0 mmap(0x31a1017000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x31a1017000 mmap(0x31a1019000, 13216, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x31a1019000 close(3) = 0 open("/lib64/libc.so.6", O_RDONLY) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\355a\2401\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1922112, ...}) = 0 mmap(0x31a0600000, 3745960, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x31a0600000 mprotect(0x31a0789000, 2097152, PROT_NONE) = 0 mmap(0x31a0989000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x189000) = 0x31a0989000 mmap(0x31a098e000, 18600, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x31a098e000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb138ee3000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb138ee2000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb138ee1000 arch_prctl(ARCH_SET_FS, 0x7fb138ee2700) = 0 mprotect(0x31a0989000, 16384, PROT_READ) = 0 mprotect(0x31a1017000, 4096, PROT_READ) = 0 mprotect(0x31a041f000, 4096, PROT_READ) = 0 munmap(0x7fb138ee4000, 66956) = 0 set_tid_address(0x7fb138ee29d0) = 13054 set_robust_list(0x7fb138ee29e0, 0x18) = 0 futex(0x7fff78256ffc, FUTEX_WAKE_PRIVATE, 1) = 0 futex(0x7fff78256ffc, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, 7fb138ee2700) = -1 EAGAIN (Resource temporarily unavailable) rt_sigaction(SIGRTMIN, {0x31a0e05ae0, [], SA_RESTORER|SA_SIGINFO, 0x31a0e0f500}, NULL, 8) = 0 rt_sigaction(SIGRT_1, {0x31a0e05b70, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x31a0e0f500}, NULL, 8) = 0 rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0 getrlimit(RLIMIT_STACK, {rlim_cur=10240*1024, rlim_max=RLIM_INFINITY}) = 0 mmap(NULL, 2101248, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb138ce0000 brk(0) = 0x200f000 brk(0x2030000) = 0x2030000 open("/usr/local/authz/var/openldap-data/authorise-test/lock.mdb", O_RDWR|O_CREAT, 0) = 3 fcntl(3, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=1}) = -1 EAGAIN (Resource temporarily unavailable) fcntl(3, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=1}) = 0 lseek(3, 0, SEEK_END) = 6272 mmap(NULL, 6272, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = 0x7fb138ef3000 open("/usr/local/authz/var/openldap-data/authorise-test/data.mdb", O_RDONLY) = 4 read(4, "\0\0\0\0\0\0\0\0\0\0\10\0\0\0\0\0\336\300\357\276\1\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096 close(4) = 0 close(3) = 0 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb138ef2000 write(1, "mdb_env_open failed, error 22\n", 30mdb_env_open failed, error 22 ) = 30 exit_group(1) = ? [root@birch tmp]# [root@birch tmp]# [root@birch tmp]# [root@birch tmp]# ./mdb_stat /usr/local/authz/var/openldap-data/authorise-test mdb_env_open failed, error 22 [root@birch tmp]# strace ./mdb_stat /usr/local/authz/var/openldap-data/authorise-test execve("./mdb_stat", ["./mdb_stat", "/usr/local/authz/var/openldap-da"...], [/* 29 vars */]) = 0 brk(0) = 0x1946000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb3f6a65000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=66956, ...}) = 0 mmap(NULL, 66956, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb3f6a54000 close(3) = 0 open("/lib64/libpthread.so.0", O_RDONLY) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\\340\2401\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=145720, ...}) = 0 mmap(0x31a0e00000, 2212768, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x31a0e00000 mprotect(0x31a0e17000, 2097152, PROT_NONE) = 0 mmap(0x31a1017000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x31a1017000 mmap(0x31a1019000, 13216, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x31a1019000 close(3) = 0 open("/lib64/libc.so.6", O_RDONLY) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\355a\2401\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1922112, ...}) = 0 mmap(0x31a0600000, 3745960, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x31a0600000 mprotect(0x31a0789000, 2097152, PROT_NONE) = 0 mmap(0x31a0989000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x189000) = 0x31a0989000 mmap(0x31a098e000, 18600, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x31a098e000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb3f6a53000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb3f6a52000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb3f6a51000 arch_prctl(ARCH_SET_FS, 0x7fb3f6a52700) = 0 mprotect(0x31a0989000, 16384, PROT_READ) = 0 mprotect(0x31a1017000, 4096, PROT_READ) = 0 mprotect(0x31a041f000, 4096, PROT_READ) = 0 munmap(0x7fb3f6a54000, 66956) = 0 set_tid_address(0x7fb3f6a529d0) = 13069 set_robust_list(0x7fb3f6a529e0, 0x18) = 0 futex(0x7fffb15785cc, FUTEX_WAKE_PRIVATE, 1) = 0 futex(0x7fffb15785cc, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, 7fb3f6a52700) = -1 EAGAIN (Resource temporarily unavailable) rt_sigaction(SIGRTMIN, {0x31a0e05ae0, [], SA_RESTORER|SA_SIGINFO, 0x31a0e0f500}, NULL, 8) = 0 rt_sigaction(SIGRT_1, {0x31a0e05b70, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x31a0e0f500}, NULL, 8) = 0 rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0 getrlimit(RLIMIT_STACK, {rlim_cur=10240*1024, rlim_max=RLIM_INFINITY}) = 0 mmap(NULL, 2101248, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb3f6850000 brk(0) = 0x1946000 brk(0x1967000) = 0x1967000 open("/usr/local/authz/var/openldap-data/authorise-test/lock.mdb", O_RDWR|O_CREAT, 0) = 3 fcntl(3, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=1}) = -1 EAGAIN (Resource temporarily unavailable) fcntl(3, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=1}) = 0 lseek(3, 0, SEEK_END) = 6272 mmap(NULL, 6272, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = 0x7fb3f6a63000 open("/usr/local/authz/var/openldap-data/authorise-test/data.mdb", O_RDONLY) = 4 read(4, "\0\0\0\0\0\0\0\0\0\0\10\0\0\0\0\0\336\300\357\276\1\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096 close(4) = 0 close(3) = 0 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb3f6a62000 write(1, "mdb_env_open failed, error 22\n", 30mdb_env_open failed, error 22 ) = 30 exit_group(1) = ? [root@birch tmp]#
Any ideas and apologies if this isn't the appropriate place to ask about this.
/****************************
Mark R Cairney ITI UNIX Section Information Services
Tel: 0131 650 6565 Email: Mark.Cairney@ed.ac.uk
****************************/
Mark Cairney wrote:
Hi,
I've acquired the libmdb tools from the Gitorious page. I've got it to
compile (with some warnings, see below) but it throws an error when I try and run mdb_stat on the mdb directory:
Your first mistake was not actually reading the gitorious page. Go read it again.
The OpenLDAP source tree already includes the MDB source code.
On 27/11/2012 19:29, Howard Chu wrote:
Your first mistake was not actually reading the gitorious page. Go read it again.
The OpenLDAP source tree already includes the MDB source code.
D'oh! Indeed sitting in my openldap source directory there is a libraries/libmdb directory with a Makefile in it.
Can't believe I missed that the first time round. Anyway that's mdb_stat now up and running.
openldap-technical@openldap.org