Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lein-clr broken with any ClojureCLR greater than 1.7.0 #16

Open
dotemacs opened this issue May 22, 2019 · 1 comment
Open

lein-clr broken with any ClojureCLR greater than 1.7.0 #16

dotemacs opened this issue May 22, 2019 · 1 comment

Comments

@dotemacs
Copy link

This is how to reproduce it:

$ lein new lein-clr bar
$ cd bar
$ lein clr test

Which outputs:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   453  100   453    0     0    595      0 --:--:-- --:--:-- --:--:--   595
100   367  100   367    0     0    230      0  0:00:01  0:00:01 --:--:--  1638
100 2350k  100 2350k    0     0   381k      0  0:00:06  0:00:06 --:--:--  516k
Archive:  clojure-clr-1.9.0-Release 4.0.zip
   creating: ../clj/Release 4.0/
   creating: ../clj/Release 4.0/clojure/
  inflating: ../clj/Release 4.0/clojure.clr.io.clj.dll
  inflating: ../clj/Release 4.0/clojure.clr.shell.clj.dll
  inflating: ../clj/Release 4.0/Clojure.Compile.exe
  inflating: ../clj/Release 4.0/Clojure.Compile.pdb
  inflating: ../clj/Release 4.0/clojure.core.clj.dll
  inflating: ../clj/Release 4.0/clojure.core.protocols.clj.dll
  inflating: ../clj/Release 4.0/clojure.core.reducers.clj.dll
  inflating: ../clj/Release 4.0/clojure.core.server.clj.dll
  inflating: ../clj/Release 4.0/clojure.core.specs.alpha.dll
  inflating: ../clj/Release 4.0/clojure.core_clr.clj.dll
  inflating: ../clj/Release 4.0/clojure.core_deftype.clj.dll
  inflating: ../clj/Release 4.0/clojure.core_print.clj.dll
  inflating: ../clj/Release 4.0/clojure.core_proxy.clj.dll
  inflating: ../clj/Release 4.0/clojure.data.clj.dll
  inflating: ../clj/Release 4.0/clojure.data.generators.dll
  inflating: ../clj/Release 4.0/Clojure.dll
  inflating: ../clj/Release 4.0/Clojure.dll.config
  inflating: ../clj/Release 4.0/clojure.edn.clj.dll
  inflating: ../clj/Release 4.0/clojure.genclass.clj.dll
  inflating: ../clj/Release 4.0/clojure.gvec.clj.dll
  inflating: ../clj/Release 4.0/clojure.instant.clj.dll
  inflating: ../clj/Release 4.0/clojure.main.clj.dll
  inflating: ../clj/Release 4.0/Clojure.Main.exe
  inflating: ../clj/Release 4.0/Clojure.Main.pdb
  inflating: ../clj/Release 4.0/Clojure.pdb
  inflating: ../clj/Release 4.0/clojure.pprint.clj.dll
  inflating: ../clj/Release 4.0/clojure.pprint.cl_format.clj.dll
  inflating: ../clj/Release 4.0/clojure.pprint.column_writer.clj.dll
  inflating: ../clj/Release 4.0/clojure.pprint.dispatch.clj.dll
  inflating: ../clj/Release 4.0/clojure.pprint.pprint_base.clj.dll
  inflating: ../clj/Release 4.0/clojure.pprint.pretty_writer.clj.dll
  inflating: ../clj/Release 4.0/clojure.pprint.print_table.clj.dll
  inflating: ../clj/Release 4.0/clojure.pprint.utilities.clj.dll
  inflating: ../clj/Release 4.0/clojure.reflect.clj.dll
  inflating: ../clj/Release 4.0/clojure.reflect.clr.clj.dll
  inflating: ../clj/Release 4.0/clojure.repl.clj.dll
  inflating: ../clj/Release 4.0/clojure.set.clj.dll
  inflating: ../clj/Release 4.0/clojure.spec.alpha.dll
  inflating: ../clj/Release 4.0/clojure.stacktrace.clj.dll
  inflating: ../clj/Release 4.0/clojure.string.clj.dll
  inflating: ../clj/Release 4.0/clojure.template.clj.dll
  inflating: ../clj/Release 4.0/clojure.test.check.dll
  inflating: ../clj/Release 4.0/clojure.test.clj.dll
  inflating: ../clj/Release 4.0/clojure.test.generative.dll
  inflating: ../clj/Release 4.0/clojure.test.junit.clj.dll
  inflating: ../clj/Release 4.0/clojure.test.tap.clj.dll
  inflating: ../clj/Release 4.0/clojure.test_clojure.attributes.clj.dll
  inflating: ../clj/Release 4.0/clojure.test_clojure.compilation.examples.clj.dll
  inflating: ../clj/Release 4.0/clojure.test_clojure.compilation.line_number_examples.clj.dll
  inflating: ../clj/Release 4.0/clojure.test_clojure.compilation.load_ns.clj.dll
  inflating: ../clj/Release 4.0/clojure.test_clojure.genclass.examples.clj.dll
  inflating: ../clj/Release 4.0/clojure.test_clojure.genclass.examples.ExampleClass.dll
  inflating: ../clj/Release 4.0/clojure.test_clojure.protocols.examples.clj.dll
  inflating: ../clj/Release 4.0/clojure.tools.namespace.dll
  inflating: ../clj/Release 4.0/clojure.uuid.clj.dll
  inflating: ../clj/Release 4.0/clojure.walk.clj.dll
  inflating: ../clj/Release 4.0/clojure.zip.clj.dll
   creating: ../clj/Release 4.0/clojure/clr/
  inflating: ../clj/Release 4.0/clojure/clr/io.clj
  inflating: ../clj/Release 4.0/clojure/clr/shell.clj
   creating: ../clj/Release 4.0/clojure/core/
  inflating: ../clj/Release 4.0/clojure/core.clj
  inflating: ../clj/Release 4.0/clojure/core/protocols.clj
  inflating: ../clj/Release 4.0/clojure/core/reducers.clj
  inflating: ../clj/Release 4.0/clojure/core/server.clj
  inflating: ../clj/Release 4.0/clojure/core_clr.clj
  inflating: ../clj/Release 4.0/clojure/core_deftype.clj
  inflating: ../clj/Release 4.0/clojure/core_print.clj
  inflating: ../clj/Release 4.0/clojure/core_proxy.clj
  inflating: ../clj/Release 4.0/clojure/data.clj
  inflating: ../clj/Release 4.0/clojure/dm-test.clj
  inflating: ../clj/Release 4.0/clojure/edn.clj
  inflating: ../clj/Release 4.0/clojure/genclass.clj
  inflating: ../clj/Release 4.0/clojure/gvec.clj
  inflating: ../clj/Release 4.0/clojure/instant.clj
  inflating: ../clj/Release 4.0/clojure/main.clj
   creating: ../clj/Release 4.0/clojure/pprint/
  inflating: ../clj/Release 4.0/clojure/pprint.clj
  inflating: ../clj/Release 4.0/clojure/pprint/cl_format.clj
  inflating: ../clj/Release 4.0/clojure/pprint/column_writer.clj
  inflating: ../clj/Release 4.0/clojure/pprint/dispatch.clj
  inflating: ../clj/Release 4.0/clojure/pprint/pprint_base.clj
  inflating: ../clj/Release 4.0/clojure/pprint/pretty_writer.clj
  inflating: ../clj/Release 4.0/clojure/pprint/print_table.clj
  inflating: ../clj/Release 4.0/clojure/pprint/utilities.clj
   creating: ../clj/Release 4.0/clojure/reflect/
  inflating: ../clj/Release 4.0/clojure/reflect.clj
  inflating: ../clj/Release 4.0/clojure/reflect/clr.clj
  inflating: ../clj/Release 4.0/clojure/repl.clj
  inflating: ../clj/Release 4.0/clojure/run_test.clj
  inflating: ../clj/Release 4.0/clojure/run_test_generative.clj
  inflating: ../clj/Release 4.0/clojure/run_test_generative_i.clj
  inflating: ../clj/Release 4.0/clojure/run_test_i.clj
   creating: ../clj/Release 4.0/clojure/samples/
  inflating: ../clj/Release 4.0/clojure/samples/ants.clj
   creating: ../clj/Release 4.0/clojure/samples/attributes/
  inflating: ../clj/Release 4.0/clojure/samples/attributes/testattribute.clj
  inflating: ../clj/Release 4.0/clojure/samples/await-test.clj
  inflating: ../clj/Release 4.0/clojure/samples/celsius.clj
  inflating: ../clj/Release 4.0/clojure/samples/counter.clj
   creating: ../clj/Release 4.0/clojure/samples/deftype/
  inflating: ../clj/Release 4.0/clojure/samples/deftype/testdeftype.clj
 extracting: ../clj/Release 4.0/clojure/samples/deftype/testprotocol.clj
   creating: ../clj/Release 4.0/clojure/samples/genclass/
  inflating: ../clj/Release 4.0/clojure/samples/genclass/testgenclass.clj
  inflating: ../clj/Release 4.0/clojure/samples/genclass/testgenclass2.clj
  inflating: ../clj/Release 4.0/clojure/samples/genclass/testgenclass3.clj
  inflating: ../clj/Release 4.0/clojure/samples/genclass/testmvc.clj
   creating: ../clj/Release 4.0/clojure/samples/interop/
  inflating: ../clj/Release 4.0/clojure/samples/interop/testinterop.clj
   creating: ../clj/Release 4.0/clojure/samples/proxy/
  inflating: ../clj/Release 4.0/clojure/samples/proxy/testproxy.clj
   creating: ../clj/Release 4.0/clojure/samples/stm/
  inflating: ../clj/Release 4.0/clojure/samples/stm/teststm.clj
  inflating: ../clj/Release 4.0/clojure/set.clj
  inflating: ../clj/Release 4.0/clojure/stacktrace.clj
  inflating: ../clj/Release 4.0/clojure/string.clj
  inflating: ../clj/Release 4.0/clojure/template.clj
   creating: ../clj/Release 4.0/clojure/test/
  inflating: ../clj/Release 4.0/clojure/test.clj
  inflating: ../clj/Release 4.0/clojure/test/junit.clj
  inflating: ../clj/Release 4.0/clojure/test/tap.clj
  inflating: ../clj/Release 4.0/clojure/test_helper.clj
  inflating: ../clj/Release 4.0/clojure/uuid.clj
  inflating: ../clj/Release 4.0/clojure/walk.clj
  inflating: ../clj/Release 4.0/clojure/zip.clj
  inflating: ../clj/Release 4.0/Microsoft.Dynamic.dll
  inflating: ../clj/Release 4.0/Microsoft.Dynamic.xml
  inflating: ../clj/Release 4.0/Microsoft.Scripting.AspNet.dll
  inflating: ../clj/Release 4.0/Microsoft.Scripting.AspNet.xml
  inflating: ../clj/Release 4.0/Microsoft.Scripting.dll
  inflating: ../clj/Release 4.0/Microsoft.Scripting.Metadata.dll
  inflating: ../clj/Release 4.0/Microsoft.Scripting.Metadata.xml
  inflating: ../clj/Release 4.0/Microsoft.Scripting.xml
Running ClojureCLR tests

Unhandled Exception:
System.TypeInitializationException: The type initializer for 'Clojure.CljMain' threw an exception. ---> System.TypeInitializationException: The type initializer for 'clojure.lang.RT' threw an exception. ---> System.IO.FileNotFoundException: Invalid Image
  at (wrapper managed-to-native) System.Reflection.Assembly.LoadFrom(string,bool)
  at System.Reflection.Assembly.LoadFrom (System.String assemblyFile) [0x00000] in <fcbcc99210424b63b9d0b88bd11ce160>:0
  at clojure.lang.RT.DoInit () [0x0000a] in <bc287354039b49358cea1d137b3bee30>:0
  at clojure.lang.RT..cctor () [0x02100] in <bc287354039b49358cea1d137b3bee30>:0
   --- End of inner exception stack trace ---
  at Clojure.CljMain..cctor () [0x0000f] in <f5aa122c398747a0aa41452d219b2965>:0
   --- End of inner exception stack trace ---
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'Clojure.CljMain' threw an exception. ---> System.TypeInitializationException: The type initializer for 'clojure.lang.RT' threw an exception. ---> System.IO.FileNotFoundException: Invalid Image
  at (wrapper managed-to-native) System.Reflection.Assembly.LoadFrom(string,bool)
  at System.Reflection.Assembly.LoadFrom (System.String assemblyFile) [0x00000] in <fcbcc99210424b63b9d0b88bd11ce160>:0
  at clojure.lang.RT.DoInit () [0x0000a] in <bc287354039b49358cea1d137b3bee30>:0
  at clojure.lang.RT..cctor () [0x02100] in <bc287354039b49358cea1d137b3bee30>:0
   --- End of inner exception stack trace ---
  at Clojure.CljMain..cctor () [0x0000f] in <f5aa122c398747a0aa41452d219b2965>:0
   --- End of inner exception stack trace ---
1

If I then:

$ cd target/clr/clj/Release 4.0

I can invoke ClojureCLR just fine and get the REPL:

$ mono Clojure.Main.exe
Clojure 1.9.0
user=>

This is how my project.clj looks like:

(defproject bar "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies []
  :warn-on-reflection true
  :min-lein-version "2.0.0"
  :plugins [[lein-clr "0.2.2"]]
  :clr {:cmd-templates  {:clj-exe   [[?PATH "mono"] [CLJCLR19_40 %1]]
                         :clj-dep [[?PATH "mono"] ["target/clr/clj/Release 4.0" %1]]
                         :clj-url "https://sourceforge.net/projects/clojureclr/files/clojure-clr-1.9.0-Release%204.0.zip/download"
                         :clj-zip   "clojure-clr-1.9.0-Release 4.0.zip"
                         :curl      ["curl" "--insecure" "-f" "-L" "-o" %1 %2]
                         :nuget-ver [[?PATH "mono"] [*PATH "nuget"] "install" %1 "-Version" %2]
                         :nuget-any [[?PATH "mono"] [*PATH "nuget"] "install" %1]
                         :unzip     ["unzip" "-d" %1 %2]
                         :wget      ["wget" "--no-check-certificate" "--no-clobber" "-O" %1 %2]}
        ;; for automatic download/unzip of ClojureCLR,
        ;; 1. make sure you have curl or wget installed and on PATH,
        ;; 2. uncomment deps in :deps-cmds, and
        ;; 3. use :clj-dep instead of :clj-exe in :main-cmd and :compile-cmd
        :deps-cmds      [[:curl :clj-zip :clj-url]
                         [:unzip "../clj" :clj-zip]]
        :main-cmd      [:clj-dep "Clojure.Main.exe"]
        :compile-cmd   [:clj-dep "Clojure.Compile.exe"]})

lein-clr works with the default ClojureCLR 1.4.0 and if you upgrade to 1.5.0 it still works. But going to any release above that, the plugin fails like the above.

I can see that something is not being picked up by the way Clojure.Main.exe is being invoked, but I'm unsure as to what exactly.

My environment:

$ mono -V
Mono JIT compiler version 5.20.1.19 (tarball Thu Apr 18 12:10:53 BST 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug
	Interpreter:   yes
	LLVM:          supported, not enabled.
	Suspend:       hybrid
	GC:            sgen (concurrent by default)

OS: macOS 10.14.4

@dotemacs
Copy link
Author

After further poking around, it looks like it works up to ClojureCLR 1.7.0.

These parameters in the project.clj get it going:

:clj-url   "https://sourceforge.net/projects/clojureclr/files/clojure-clr-1.7.0-Release-4.0.zip/download"
:clj-zip   "clojure-clr-1.7.0-Release-4.0.zip"

but using these:

:clj-url "https://sourceforge.net/projects/clojureclr/files/clojure-clr-1.8.0-Release%204.0.zip/download"
:clj-zip "clojure-clr-1.8.0-Release 4.0.zip"

or these

:clj-url   "https://sourceforge.net/projects/clojureclr/files/clojure-clr-1.9.0-Release%204.0.zip/download"
:clj-zip "clojure-clr-1.9.0-Release 4.0.zip"

and the REPL bombs out.

@dotemacs dotemacs changed the title lein-clr broken with any ClojureCLR greater than 1.5.0 lein-clr broken with any ClojureCLR greater than 1.7.0 May 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant