How to run Compile from command line outside REPL ?

109 views
Skip to first unread message

Jason Vas Dias

unread,
Dec 7, 2020, 2:30:48 PM12/7/20
to clojure-clr

Good day -
  I am new to Windows and Clojure but not to Common Lisp (SBCL) and Linux C/C++  -
 
  I am trying to Compile some clojure on the command line, but I cannot seem
  to get Clojure to honor $CLOJURE_LOAD_PATH or   
  %CLOJURE_LOAD_PATH% in either a Cygwin bash shell
  or in CMD.EXE . 

  When I am outside $CLOJURE_HOME (which is
   C:\Program Files\ClojureCLR Release 4.0\
  ), where I copied the 'Release 4.0' directory from the
 clojure-clr-1.9.0-Release 4.0.zip file I downloaded ,
 I try to compile the file 'celsius.clj' copied from
 the $CLJ_HOME/clojure/samples/ directory, with the diff:
-(System.Reflection.Assembly/Load "System.Windows.Forms,Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
+(System.Reflection.Assembly/LoadWithPartialName "System.Windows.Forms")
in my ${HOME}/src/ directory:
       export CLJHOME="/c/Program Files/ClojureCLR Release 4.0"
       export PATH="${PATH}:$CLJHOME"
       export CLOJURE_LOAD_PATH=".:$CLJHOME"
       export CLOJURE_COMPILE_PATH="${PWD}/classes"
       export CLOJURE_HOME="$CLJHOME"
       export CLJ_HOME="$CLJHOME"
$ Clojure.Compile.exe celsius.clj

Unhandled Exception: System.TypeInitializationException: The type initializer for 'clojure.lang.RT' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Users\JVD\src\clojure.spec.alpha.dll' or one of its dependencies. The system cannot find the file specified.
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at clojure.lang.RT.DoInit() in d:\work\clojure-clr\Clojure\Clojure\Lib\RT.cs:line 640
   at clojure.lang.RT..cctor() in d:\work\clojure-clr\Clojure\Clojure\Lib\RT.cs:line 613
   --- End of inner exception stack trace ---
   at BootstrapCompile.Compile.Main(String[] args) in d:\work\clojure-clr\Clojure\Clojure.Compile\Compile.cs:line 31

$ cd $CLJHOME
JVD@JVDSWIN MINGW64 /c/Program Files/ClojureCLR Release 4.0
$ Clojure.Compile.exe ${HOME}/src/celsius.clj
Compiling C:/Users/JVD/src/celsius.clj to C:/Users/JVD/src/classesSystem.IO.FileNotFoundException: Could not locate Users.JVD.src.celsius.clj.cljc.dll or Users/JVD/src/celsius/clj.cljc on load path.
   at clojure.lang.RT.load(String relativePath, Boolean failIfNotFound) in d:\work\clojure-clr\Clojure\Clojure\Lib\RT.cs:line 3553
   at clojure/core$loadfn__24109__24113.invoke()
   at clojure/core$load__24116.invokeStatic(ISeq )
   at clojure/core$load_one__23985.invokeStatic(Object , Object , Object )
   at clojure/core$compilefn__24123__24127.invoke()
   at clojure/core$compile__24130.invokeStatic(Object )
   at BootstrapCompile.Compile.Main(String[] args) in d:\work\clojure-clr\Clojure\Clojure.Compile\Compile.cs:line 69

JVD@JVDSWIN MINGW64 /c/Program Files/ClojureCLR Release 4.0


So I cannot compile when outside $CLJHOME directory - incidentally, could someone please tell me what the correct *HOME environment variable name is ?
- and when in the $CLHOME directory, I cannot compile your example celsius.clj program .  Please advise how to set up for building from any directory and how to get celsius.clj compiling and running under latest Windows 10 & Visual Studio 19
x86_64 installation .  I really need urgently to write some scripts for work which need invoke GUI forms and respond to their edits & buttons - SBCL would be my
preferred scripting language, but I need integration with C# programs and good GUI form support.

Any help advice on how to get my ClojureCLR setup issues resolved and how to
get celsius.clj to build would be much appreciated.

Thanks in Advance, Best Regards,
Jason
Reply all
Reply to author
Forward
0 new messages