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
Building OpenCV is failed when describing evision in deps of mix.exs of a new mix project #40
Comments
I can reproduce this error on my mac as well. And actually, it was caused by linking to the
However, if you cd to the
It will work as expected (and the
I suspect that some environment variables may be changed when using it as a dependency... I'll look into this. |
Oh, I see. Is this an issue? Yes and no. The No Part (the solution)It's just that you need to copy or merge the config from evision to the top-level project. If you don't have any other config in the top-level project, then you can just copy the whole cp -a deps/evision/config config Otherwise, you can import this config file at the end of existing cp -a deps/evision/config/config.exs config/evision.exs
echo 'import_config "evision.exs"' >> config/config.exs And then it should work.
@zacky1972 the above solution should be able to solve this issue :) The reason is that if there is no corresponding config file in the top-level project, The Yes Part (possible improvement, feel free to ignore this)Perhaps I need to set some default values for this. Although in that way, we cannot let OpenCV's CMake file decide which modules can be enabled on the user's system. defp get_config(false) do
enabled_modules = Application.get_env(:evision, :enabled_modules, [])
disabled_modules = Application.get_env(:evision, :disabled_modules, [])
enabled_img_codecs = Application.get_env(:evision, :enabled_img_codecs, [])
compile_mode = Application.get_env(:evision, :compile_mode, "auto")
{enabled_modules, disabled_modules, enabled_img_codecs, compile_mode}
end Furthermore, some issues in the Makefile contributed to this problem. |
Great! It has been solved by the following command you taught: cp -a deps/evision/config config Thank you a lot. |
Excuse me, I tested a new mix project importing That is, we must do the setting of I felt this is very troublesome. How do you think? |
I understand what you mean while I was trying to reproduce the error you described. Elixir projects are organised in the form of a, well, project, and the top-level project has control over all its dependencies. Although we can set if you want to test Therefore, in Elixir, you do have to have duplicated configuration files. But only the ones that are in the top-level project's I think it should be enough if the mix new top_level
cd top_level edit the defmodule TopLevel.MixProject do
use Mix.Project
def project do
[
app: :top_level,
version: "0.1.0",
elixir: "~> 1.13",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end
def application do
[
extra_applications: [:logger]
]
end
defp deps do
[
{:nx_evison, github: "zeam-vm/nx_evision"},
{:evision, "~> 0.1.0-dev", github: "cocoa-xu/evision", branch: "main"}
]
end
end mix deps.get
cp -a deps/evision/config ./config
mix compile |
One of the trade-offs that I can think of is: as long as you have the desired configuration for a certain library in the top-level project, you don't need to worry about whether one of your dependencies configures that library with parameters you don't want. |
I see. Then, I'll revise README of |
I received another issue #41 and it was basically the same problem here. I pushed a fix (5e8d1b5) for it. In simple words, 5e8d1b5 makes it more like what we would expect, or how CMake handles default configuration for projects. In that fix, the default config ( |
The fix should be good for most users and cases. But it's worth noting that the default configuration will build everything that evision supports in OpenCV. This will increase the build time and the footprint of the library. I'll close this issue for now, but please feel free to reopen/link to it if relevant errors happen in the future! |
Hi,
I did the following steps:
mix new evision_test cd evision_test
Then, I added evision to
mix.exs
as follows:Then, I did the following steps:
Then, I got the following error:
Then, I did the following steps:
Then, I got the following fatal error:
My environment is as follows:
Thank you.
The text was updated successfully, but these errors were encountered: