tty
Setting path to deps for Elixir uuid and Erlang uuid
Hello,
Our application uses UUID but one of the Erlang packages has a dependency to Erlang uuid (GitHub - okeuday/uuid: Erlang Native UUID Generation · GitHub). In mix.lock we have the following two lines:
“uuid”: {:git, “GitHub - okeuday/uuid: Erlang Native UUID Generation · GitHub”, “a59624205fe3b6f83b69fc7768bb24068b556c86”, [branch: “master”]}
“elixir_uuid”: {:hex, :uuid, “1.1.8”, “e22fc04499de0de3ed1116b770c7737779f226ceefa0badb3592e64d5cfb4eb9”, [:mix], , “hexpm”}
Deps are pulled properly, the build occurs fine, in the console I can use :uuid.get_v1/1 but can’t use Elixir.UUID
The path to _build/dev/lib/elixir_uuid/ebin is not included when I run the console. I have verified this to be true by manually adding the path to elixir_uuid/ebin in the shell using :code.add_path/1
How can I include the path to _build/dev/lib/elixir_uuid/ebin automatically as part of the build aka ‘mix compile’ ?
Thanks
Most Liked
michalmuskala
As far as I’m aware it’s not possible to have two different applications with the same name on a single BEAM instance.
That’s one of the reasons hex does not have namespaces - it wouldn’t be possible to use the packages at the same time anyway. Manually specifying namespaces (like in this case) only pushes the problem further to the final users.
NobbZ
I guess you mean to rewrite the elixir software (which is owned by the OP) to use the erlang UUID-library?
Yeah, definitively a way to go, but that will break once one uses something from this page:
An ugly workaround, which will break in pretty much the same way as above.
Yeah, the same as above, it will break when you use something that depends on the regular package.
But there is hope: There is a ~20 months old bug:
NobbZ
OTP/BEAM does not care where the files are, both applications have the same application name in their respective configs, its :uuid for the :uuid package from hex.pm (in mix.exs) and it is uuid for the erlang UUID package from github (in src/uuid.app.src).
The addition of :elixir_uuid to the list of :applications does not add anything, but just another problem: Your application might refuse to start, since there is no application :elixir_uuid available.
Besides of that, beginning with elixir 1.4, you really should avoid :applications and use :extra_applications instead (and runtime: false for deps that do not need to be started).
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









