[Mono-list] library location problem

Christophe VG mono@baselabs.org
16 Apr 2002 19:37:31 +0200


On Tue, 2002-04-16 at 18:59, Daniel Carrera wrote:
> You are not missing the point. :-)

pfieuw, that's a relief ;-)
 
> There is already a way to solve the above problem.  In addition to the
> current directory and the standard directories, Mono looks in all the
> directries indicated in the LD_LIBRARY_PATH variable.

I thought that too ... then I must be doing something wrong here ...

The setup : a module and a subdir with a test

[ntt@taurus test]$ ls
ExampleModule.cs  t
[ntt@taurus test]$ ls t
test-1.cs

Compiling the module

[ntt@taurus test]$ mcs --target library ExampleModule.cs 
RESULT: 0

Compiling the test with a absolute (just to be sure) reference

[ntt@taurus test]$ pwd 
/tmp/test
[ntt@taurus test]$ mcs -r /tmp/test/ExampleModule.dll t/test-1.cs 
RESULT: 0

Okay, time to run and fail (this is expected)

[ntt@taurus test]$ mono t/test-1.exe 

** (process:21553): WARNING **: Could not find assembly ExampleModule
/usr/lib/ExampleModule.dll
Can not open image t/test-1.exe

Setting the LD_LIBRARY_PATH

[ntt@taurus test]$ export LD_LIBRARY_PATH=/tmp/test/
[ntt@taurus test]$ mono t/test-1.exe 

** (process:21576): WARNING **: Could not find assembly ExampleModule
/usr/lib/ExampleModule.dll
Can not open image t/test-1.exe

still fails ?!

Let's try an strace to see where he actaully goes looking for the lib

(cut off lines for cleaner mail)
...
access("ExampleModule", F_OK)           = -1 ENOENT (No such file or
access("t/ExampleModule", F_OK)         = -1 ENOENT (No such file or
access("t/ExampleModule.dll", F_OK)     = -1 ENOENT (No such file or
access("/usr/lib/ExampleModule", F_OK)  = -1 ENOENT (No such file or
access("/usr/lib/ExampleModule.dll", F_OK) = -1 ENOENT (No such file or
access("/usr/lib//usr/lib/ExampleModule.dll", F_OK) = -1 ENOENT (No such
access("/usr/lib//usr/lib/ExampleModule.dll.dll", F_OK) = -1 ENOENT (No
access("/usr/lib//usr/lib/ExampleModule.dll", F_OK) = -1 ENOENT (No such
brk(0x816a000)                          = 0x816a000
open("/usr/lib//usr/lib/ExampleModule.dll.dll", O_RDONLY|O_LARGEFILE) =
-1 ENOENT (No such file or directory)

What I find remarkable is that everywhere mono looks both for
ExampleModule AND ExmapleModule.dll, but not the first time (cwd). 

I would have expected given the example output above to see a second
line something like this:

access("ExampleModule.dll", F_OK)        = ...

Secondly I don't see any of the LD_LIBRARY_PATH being used for finding
the libary.

> In my case, I *do* want my own library directory.  Thus, I have this line
> in my .bashrc file:
> LD_LIBRARY_PATH=/home/daniel/lib

So what am I missing here, because it seems to work for you ?!!

Thanks
Christophe


-- 
Supporting the Mono project, and helping you...

  http://mono.baselabs.org              http://mono.baselabs.org/CSAM
             ***                                     ***
"First steps" building guides,        CSAM the C Sharp Archived Modules
daily Mono RPMS, C# tutorial,...