[Mono-list] ICodeCompiler.CompileAssemblyFromSourceBatch failure

Carl Cerecke carl.cerecke at telogis.com
Tue Jun 17 23:38:18 EDT 2008


Some more info on this. Specifically, a couple of relevant stack traces:

Unhandled Exception: System.DllNotFoundException: libc
  at (wrapper managed-to-native)
System.CodeDom.Compiler.TempFileCollection:mkdir (string,uint)
  at System.CodeDom.Compiler.TempFileCollection.GetOwnTempDir () [0x00000]
  at System.CodeDom.Compiler.TempFileCollection.get_BasePath () [0x00000]
  at System.CodeDom.Compiler.TempFileCollection.AddExtension
(System.String fileExtension, Boolean keepFile) [0x00000]
  at System.CodeDom.Compiler.TempFileCollection.AddExtension
(System.String fileExtension) [0x00000]
  at Mono.CSharp.CSharpCodeCompiler.GetTempFileNameWithExtension
(System.CodeDom.Compiler.TempFileCollection temp_files, System.String
extension) [0x00000]
  at Mono.CSharp.CSharpCodeCompiler.CompileFromSourceBatch
(System.CodeDom.Compiler.CompilerParameters options, System.String[]
sources) [0x00000]
  at Mono.CSharp.CSharpCodeCompiler.CompileAssemblyFromSourceBatch
(System.CodeDom.Compiler.CompilerParameters options, System.String[]
sources) [0x00000]
  at Foo.App.Main (System.String[] args) [0x00000]

Unhandled Exception: System.IO.DirectoryNotFoundException: Directory
'/tmp/74ff0843' not found.
  at System.IO.Directory.GetFileSystemEntries (System.String path,
System.String pattern, FileAttributes mask, FileAttributes attrs)
[0x00000]
  at System.IO.Directory.GetDirectories (System.String path,
System.String pattern) [0x00000]
  at System.IO.Directory.GetDirectories (System.String path) [0x00000]
  at System.IO.Directory.RecursiveDelete (System.String path) [0x00000]
  at System.IO.Directory.Delete (System.String path, Boolean recurse) [0x00000]
  at System.CodeDom.Compiler.TempFileCollection.Delete () [0x00000]
  at Mono.CSharp.CSharpCodeCompiler.CompileAssemblyFromSourceBatch
(System.CodeDom.Compiler.CompilerParameters options, System.String[]
sources) [0x00000]
  at Foo.App.Main (System.String[] args) [0x00000]


No idea why libc isn't found. If it was really not there I'd have
other problems to worry about.

On Wed, Jun 18, 2008 at 1:40 PM, Carl Cerecke <carl.cerecke at telogis.com> wrote:
> Hi,
>
> I have an unusual failure when calling
> ICodeCompiler.CompileAssemblyFromSourceBatch. The compile works
> correctly when called from a mono .exe, but does not when the same
> .exe is called via the mono embedded calls.
>
> This works on the command-line:
>> mono mtest.exe
>
> This code (using mono embedded libs) fails (never gets to printf):
> int main(int argc, char *argv[]) {
>
>    domain = mono_jit_init("mtest.exe");
>    assembly = mono_domain_assembly_open (domain, "mtest.exe");
>    mono_jit_exec(domain, assembly, argc, argv);
>    printf("Ran mtest.exe\n");
>
> The error message is:
> Directory '/tmp/178d00f6' not found.
>
> The successful CLI execution yeilds the strace (different run,
> different tmpfile):
> ...
> stat64("/tmp/437a94b0", 0xbf84c06c)     = -1 ENOENT (No such file or directory)
> lstat64("/tmp/437a94b0", 0xbf84c06c)    = -1 ENOENT (No such file or directory)
> access("/tmp", F_OK)                    = 0
> mkdir("/tmp/437a94b0", 0700)            = 0
> stat64("/tmp/437a94b0/4f5bba7d.tmp", 0xbf84bfc4) = -1 ENOENT (No such
> file or directory)
> lstat64("/tmp/437a94b0/4f5bba7d.tmp", 0xbf84bfc4) = -1 ENOENT (No such
> file or directory)
> access("/tmp/437a94b0", F_OK)           = 0
> stat64("/tmp/437a94b0", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
> lstat64("/tmp/437a94b0", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
> stat64("/tmp/437a94b0/4f5bba7d.tmp", 0xbf84bfb0) = -1 ENOENT (No such
> file or directory)
> lstat64("/tmp/437a94b0/4f5bba7d.tmp", 0xbf84bfb0) = -1 ENOENT (No such
> file or directory)
> access("/tmp/437a94b0", F_OK)           = 0
> open("/tmp/437a94b0/4f5bba7d.tmp", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0644) = 16
> ...
>
> but the strace from running the failed code never does anything with
> /tmp after the access() sycall.
>
> The code that does the CompileAssemblyFromSourceBatch() is in a .dll
> that mtest.exe loads.
>
> What am I missing in the init of mono that prevents it from compiling
> source on the fly? Everything else that I've tried with embedded mono
> seems to work OK.
>
> Cheers,
> Carl
> --
> Carl Cerecke, PhD
> Senior Software Engineer
>
> Telogis, Intelligent Location Technology
> Level 2, Building 2
> 1 Show Place
> Addington
> CHRISTCHURCH
> New Zealand
>
> Phone: +64 03 339 2825 ext 208
> Fax: +64 03 339 4537
> Email: carl.cerecke at telogis.com
>
> This message (including any attachments) contains confidential
> information intended for a specific individual and purpose, and is
> protected by law. If you are not the intended recipient, you should
> delete this message and are hereby notified that any disclosure,
> copying, or distribution of this message, or the taking of any action
> based on it, is strictly prohibited.
>



-- 
Carl Cerecke, PhD
Senior Software Engineer

Telogis, Intelligent Location Technology
Level 2, Building 2
1 Show Place
Addington
CHRISTCHURCH
New Zealand

Phone: +64 03 339 2825 ext 208
Fax: +64 03 339 4537
Email: carl.cerecke at telogis.com

This message (including any attachments) contains confidential
information intended for a specific individual and purpose, and is
protected by law. If you are not the intended recipient, you should
delete this message and are hereby notified that any disclosure,
copying, or distribution of this message, or the taking of any action
based on it, is strictly prohibited.


More information about the Mono-list mailing list