Forums

Executables refuse to run

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Executables refuse to run

Postby _Gold_Fish » Tue Jun 29, 2010 3:55 pm

Hello all,
I'm new to Cobra, and it's installed fine and such. However, I've run into an issue.
I can compile a program anywhere, but when I attempt to run it when it is saved outside of Cobra-2010-04-02\Source\ it displays this:
Code: Select all
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass
embly 'Cobra.Lang, Version=0.8.0.1, Culture=neutral, PublicKeyToken=null' or one
 of its dependencies. The system cannot find the file specified.
File name: 'Cobra.Lang, Version=0.8.0.1, Culture=neutral, PublicKeyToken=null'
   at Hello.Main()
   at MainWrapper.Main()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\M
icrosoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure lo
gging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus
ion!EnableLog].


I'm sure there's an obvious way to fix this, but i haven't been able to find it.
Thanks in advance for any help.
_Gold_Fish
 
Posts: 18

Re: Executables refuse to run

Postby Charles » Tue Jun 29, 2010 8:49 pm

The Cobra.Lang.dll library should have been installed system wide (in the "global assembly cache" or "GAC"), but doesn't seem to be in your case.

Did you set it up using "comp.bat" or "install-from-source"? If you used "install-from-source", can you run it again and post the output here?

Short term workarounds include:

-- Pass "-ert:yes" to cobra.exe as in "cobra -ert:yes myprog.cobra" which will embed the run-time library in your code, thereby removing any external dependency.

-- Copy Cobra.Lang.dll to the same directory as your program.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Executables refuse to run

Postby _Gold_Fish » Wed Jun 30, 2010 9:17 am

Here is the result from install-from-workspace:
Code: Select all
If you are on Windows Vista and you get an error message then
you may need to run with elevated privileges, such as with an
admin account or power user account.

Compiling installation program...

The Cobra Programming Language
Install From Workspace

Working...

==== Verify installation directory

found dir: C:\Cobra

==== Verify running in workspace

Verified.

==== Locate and test Cobra Snapshot compiler

run: Snapshot\cobra.exe -about
   : The Cobra Programming Language 0.8.0 post-release
   : Copyright (C) 2003-2010 by Cobra Language LLC.  All Rights Reserved.
   :
   : On the web:  http://Cobra-Language.com/
   : License:     http://www.opensource.org/licenses/mit-license.php
   : Source:      http://cobra-language.com/source/
   : Support:     http://cobra-language.com/trac/cobra/wiki/UserSupport
   :
   : Usage:       cobra -h

==== Build new Cobra compiler

run: Snapshot\cobra.exe -compile -turbo -ert:yes cobra.cobra -files:files-to-com
pile.text
   : Compilation succeeded

==== Retrieve Cobra base version number

run: cobra.exe -version
   : 0.8.0 post-release

base version: 0.8.0-post

==== Build Cobra standard library

run: cobra.exe -bsl -turbo Cobra.Lang\AssemblyAttrs.cobra -key-file:Cobra.Lang\C
obra.Lang.snk
   : Compilation succeeded

==== Verify newly built Cobra compiler

run: cobra.exe -about
   : The Cobra Programming Language 0.8.0 post-release
   : Copyright (C) 2003-2010 by Cobra Language LLC.  All Rights Reserved.
   :
   : On the web:  http://Cobra-Language.com/
   : License:     http://www.opensource.org/licenses/mit-license.php
   : Source:      http://cobra-language.com/source/
   : Support:     http://cobra-language.com/trac/cobra/wiki/UserSupport
   :
   : Usage:       cobra -h

run: cobra.exe -ert:no hello
   : Hello, world.

run: cobra.exe -ert:yes hello
   : Hello, world.

run: cobra.exe hello
   : Hello, world.

==== Install Cobra standard library to the GAC

Invoking Publish.GacInstall...
Done.

==== Copy files to install directory

found dir: C:\Cobra
del dir  : C:\Cobra\Cobra-0.8.0-post
make dir : C:\Cobra\Cobra-0.8.0-post
run: svn info
svn is not installed or it is not in the PATH.  The system cannot find the file
specified
** WARING: Cannot find version information, svn command line version not install
ed or failed.

copy from: C:\Program Files\Cobra-2010-04-02\HowTo
       to: C:\Cobra\Cobra-0.8.0-post\HowTo
copy from: C:\Program Files\Cobra-2010-04-02\Reusables
       to: C:\Cobra\Cobra-0.8.0-post\Reusables
copy from: C:\Program Files\Cobra-2010-04-02\Samples
       to: C:\Cobra\Cobra-0.8.0-post\Samples
copy from: C:\Program Files\Cobra-2010-04-02\Supplements
       to: C:\Cobra\Cobra-0.8.0-post\Supplements
make dir : C:\Cobra\Cobra-0.8.0-post\bin
copy  bin: C:\Cobra\Cobra-0.8.0-post\bin
copy from: Cobra.Lang
       to: C:\Cobra\Cobra-0.8.0-post\bin\Cobra.Lang
found dir: C:\Cobra\bin
writing  : C:\Cobra\bin\cobra.bat

==== Verify newly installed Cobra compiler

run: C:\Cobra\bin\cobra.bat -about
   : The Cobra Programming Language 0.8.0 post-release
   : Copyright (C) 2003-2010 by Cobra Language LLC.  All Rights Reserved.
   :
   : On the web:  http://Cobra-Language.com/
   : License:     http://www.opensource.org/licenses/mit-license.php
   : Source:      http://cobra-language.com/source/
   : Support:     http://cobra-language.com/trac/cobra/wiki/UserSupport
   :
   : Usage:       cobra -h

run: C:\Cobra\bin\cobra.bat -ert:yes hello
   : Hello, world.

==== Clean up workspace

run: Snapshot\cobra.exe -compile -debug -ert:yes cobra.cobra -files:files-to-com
pile.text
   : Compilation succeeded

run: cobra.exe -bsl -debug
   : Compilation succeeded

==== Install "cobra" into a system path directory


The Cobra compiler is not in your PATH. To remedy you can:
1. Add C:\Cobra\bin to your PATH
2. Copy C:\Cobra\bin\cobra.bat to any directory in your PATH

Success!


Also, if I pass -ert:yes, "all dependencies" does not include having .NET installed, right?
_Gold_Fish
 
Posts: 18

Re: Executables refuse to run

Postby Charles » Wed Jun 30, 2010 12:25 pm

Correct: The -ert:yes only embeds Cobra's run-time, not the .NET run-time which is much larger.

Your install output includes:
Code: Select all
==== Install Cobra standard library to the GAC

Invoking Publish.GacInstall...
Done.

...which looks good, so I'm not sure what the problem is. Maybe on your system, Publish().gacInstall isn't functional. Two different things you can try:

(1) Open up InstallFromWorkspace.cobra and around line 465, before "Publish().gacInstall" add a "throw NotImplementedException()" to force the second technique to run:
print 'Invoking Publish.GacInstall...'
try
throw NotImplementedException() # add this line
Publish().gacInstall('Cobra.Lang.dll')

(2) Install the .NET SDK and try again.

Let us know if either of these work for you.
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 71 guests