I’m trying to use this library (a Mix compile-time wrapper around Erlang’s asn1ct) to read and write CMS-formatted files, among other things.
I added the library to the dependencies and compilers: [:asn1] ++ Mix.compilers
to the project-list, ran mix deps.get
, then tried to compile it, but I’m getting a fatal error claiming that the KeyUsage
field isn’t being exported:
iex -S mix
==> asn1ex
Compiling 1 file (.ex)
warning: :asn1ct.compile/2 defined in application :asn1 is used by the current application but the current application does not depend on :asn1. To fix this, you must do one of:
1. If :asn1 is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs
2. If :asn1 is a dependency, make sure it is listed under "def deps" in your mix.exs
3. In case you don't want to add a requirement to :asn1, you may optionally skip this warning by adding [xref: [exclude: [:asn1ct]]] to your "def project" in mix.exs
lib/mix/tasks/compile.asn1.ex:55: Mix.Tasks.Compile.Asn1.run/1
Generated asn1ex app
AlgorithmInformation-2009:10: 'KeyUsage' is not exported from PKIX1Implicit-2009
AlgorithmInformation-2009:95: 'KeyUsage' is not exported from PKIX1Implicit-2009
** (CaseClauseError) no case clause matching: {{:error, [{:structured_error, {:"AlgorithmInformation-2009", 10}, :asn1ct_check, {:undefined_import, :KeyUsage, :"PKIX1Implicit-2009"}}, {:structured_error, {:"AlgorithmInformation-2009", 95}, :asn1ct_check, {:undefined_import, :KeyUsage, :"PKIX1Implicit-2009"}}]}, "rfc5911"}
(asn1ex 0.0.1) lib/mix/tasks/compile.asn1.ex:173: Mix.Tasks.Compile.Asn1.interpret_result/2
(asn1ex 0.0.1) lib/mix/tasks/compile.asn1.ex:157: anonymous fn/3 in Mix.Tasks.Compile.Asn1.compile/3
(elixir 1.13.4) lib/enum.ex:2396: Enum."-reduce/3-lists^foldl/2-0-"/3
(asn1ex 0.0.1) lib/mix/tasks/compile.asn1.ex:156: Mix.Tasks.Compile.Asn1.compile/3
(mix 1.13.4) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
(mix 1.13.4) lib/mix/tasks/compile.all.ex:92: Mix.Tasks.Compile.All.run_compiler/2
(mix 1.13.4) lib/mix/tasks/compile.all.ex:72: Mix.Tasks.Compile.All.compile/4
(mix 1.13.4) lib/mix/tasks/compile.all.ex:59: Mix.Tasks.Compile.All.with_logger_app/2
The source code is available here.
As you can see on line 4542 of rfc5912.asn1
, even adding an EXPORTS ALL
statement to the modue didn’t fix this. I am stumped. It clearly seems like that bit should be exported, and it’s not a circular-dependency issue in the spec, either, because asn1ct
is now OK with those:
Earlier versions of the ASN.1 compiler required that modules that were imported from had to be compiled before the module that imported. This caused problems when ASN.1 modules had circular dependencies.
Has anyone got tips for troubleshooting ASN.1 in Elixir, or is able to spot the breakdown in this?