I am trying to implement a POSIX wrapper and so I need to DllImport
libc.so.  Whenever I run my code[1] mono outputs the following:

** (process:18635): WARNING **: Failed to load library libc.so (libc.so)

I've tried setting MONO_PATH and LD_LIBRARY_PATH to /usr/lib but I am
still unable to load libc.so.  Copying libc.so to the working directory
doesn't seem to help either.

I've attached[2] strace output of running mono.  Any idea what's going
on here?  It looks like it fails to load ./libc.so and then tries
/usr/lib/libc.so, successfully opens the file but then fails on calls to
access(2).

[1] http://trmk.org/~adam/mono/Posix.cs
[2] Full trace output at http://trmk.org/~adam/mono/strace.out

Thanks,
-- 
AKK~
http://trmk.org/~adam/blog
open("PosixTest.exe", O_RDONLY|O_LARGEFILE) = 6
brk(0x8230000)                          = 0x8230000
fstat64(6, {st_mode=S_IFREG|0644, st_size=2048, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x40016000
read(6, "MZ\0\0\4\0\0\0\4\0\0\0\377\377\0\0\270\0\0\0\0\0\0\0@\0"..., 4096) = 2048
mmap2(NULL, 4096, PROT_READ, MAP_PRIVATE, 6, 0) = 0x40017000
mmap2(NULL, 4096, PROT_READ, MAP_PRIVATE, 6, 0) = 0x40018000
_llseek(6, 0, [0], SEEK_SET)            = 0
read(6, "MZ\0\0\4\0\0\0\4\0\0\0\377\377\0\0\270\0\0\0\0\0\0\0@\0"..., 4096) = 2048
mmap2(NULL, 4096, PROT_READ, MAP_PRIVATE, 6, 0) = 0x40019000
open("./Posix.dll", O_RDONLY|O_LARGEFILE) = 7
brk(0x8231000)                          = 0x8231000
fstat64(7, {st_mode=S_IFREG|0644, st_size=2048, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x4001a000
read(7, "MZ\0\0\4\0\0\0\4\0\0\0\377\377\0\0\270\0\0\0\0\0\0\0@\0"..., 4096) = 2048
mmap2(NULL, 4096, PROT_READ, MAP_PRIVATE, 7, 0) = 0x4001b000
mmap2(NULL, 4096, PROT_READ, MAP_PRIVATE, 7, 0) = 0x4001c000
_llseek(7, 0, [0], SEEK_SET)            = 0
read(7, "MZ\0\0\4\0\0\0\4\0\0\0\377\377\0\0\270\0\0\0\0\0\0\0@\0"..., 4096) = 2048
mmap2(NULL, 4096, PROT_READ, MAP_PRIVATE, 7, 0) = 0x4001d000
open("./libc.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
brk(0x8234000)                          = 0x8234000
getpid()                                = 18635
access("libc.so", F_OK)                 = -1 ENOENT (No such file or directory)
stat64("libc.so", 0xbffff4e8)           = -1 ENOENT (No such file or directory)
access("libc.so.so", F_OK)              = -1 ENOENT (No such file or directory)
stat64("libc.so.so", 0xbffff4d8)        = -1 ENOENT (No such file or directory)
access("libc.so.la", F_OK)              = -1 ENOENT (No such file or directory)
stat64("libc.so.la", 0xbffff4d8)        = -1 ENOENT (No such file or directory)
open("/usr/lib/libc.so", O_RDONLY)      = 8
read(8, "/* GNU ld script\n   Use the shar"..., 1024) = 178
close(8)                                = 0
access("libc.so", F_OK)                 = -1 ENOENT (No such file or directory)
stat64("libc.so", 0xbffff4e8)           = -1 ENOENT (No such file or directory)
access("libc.so.so", F_OK)              = -1 ENOENT (No such file or directory)
stat64("libc.so.so", 0xbffff4d8)        = -1 ENOENT (No such file or directory)
access("libc.so.la", F_OK)              = -1 ENOENT (No such file or directory)
stat64("libc.so.la", 0xbffff4d8)        = -1 ENOENT (No such file or directory)
open("/usr/lib/libc.so", O_RDONLY)      = 8
read(8, "/* GNU ld script\n   Use the shar"..., 1024) = 178
close(8)                                = 0
getpid()                                = 18635
brk(0x823c000)                          = 0x823c000
write(2, "\n** (process:18635): WARNING **:"..., 74) = 74

Reply via email to