-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
mix deps.compile can't find reference to a struct from an already compiled dep #12913
Comments
Update. It's not just a struct:
Note that in the attempt to compile earmark and markdown I got an error that HtmlEntities.decode is undefined, but when I compiled that dependency at the same time the problem with that also went away. So it seems that compiling dependencies doesn't accurately load the symbols from dependencies compiled in a separate pass. That sounds pretty scary. |
|
Are you saying that it is expected that if bar depends on foo, I can't do I just did another test. I modified the link_preview code and then invoked a deps.compile for just that module. It worked fine, now that I got through getting everything to compile once. So it seems that my problem only occurs while doing the first round of compilation. So that suggests to me that there is something in the process that is only done once all the dependencies have been compiled once. I don't have any knowledge of compilation so I don't know what that would be, but it seems wrong to me. |
You can do it in parts but you need to compile foo before bar if bar depends on foo. |
Look back in the first problem description, but the second part showing mogrify and link_preview. I compiled it specifying both, and the compiler skipped mogrify because it was already compiled, then hit the error about not recognizing the struct from Mogrify. When I told it to force compile both I didn't get that error. So it wasn't sufficient to have mogrify compiled first. But again, this seems to be confirmed to only happen if I haven't yet completed a full deps.compile because of stopping errors in the middle (i.e. between foo and bar). |
Thank you @Sinc63. The issue may be related somehow to optional dependencies. I am trying to reproduce it. |
@Sinc63 I have tried to reproduce this in several different ways, using the same OTP and Elixir versions, and failed. I tried with optional dependencies, non-optional dependencies, etc. Unfortunately I will need a mechanism to reproduce this issue to move forward. Thanks! |
@Sinc63 ping :) |
I have somehow stumbled upon what appears to be exactly the same situation, with the same library |
@josevalim pong.
cat .tool-versions
console:
1.14.5-otp-25 does not appear to exhibit the same problem. |
Here is the bug: https://github.com/E-MetroTel/link_preview/blob/upgrade_floki/mix.exs#L54
|
@thbar it is the same issue on Phoenix Markdown, I will submit a PR there. |
In both cases, you should most likely be getting warnings for this in previous Elixir versions, which were on purpose supporting broken behaviour, but we wanted to easy migration. :) The issue is that, in past cases, if you kept the warning on, you would find out only when there was a release. |
Getting this on
|
Same issue: https://github.com/mgwidmann/scrivener_html/blob/master/mix.exs#L32 It should be extra_applications and it seems there were warnings back to Elixir v1.11 :) |
Thanks @josevalim, this does the trick! Submitted a PR. |
Elixir and Erlang/OTP versions
Erlang/OTP 25 [erts-13.2.2.2] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [jit:ns]
Elixir 1.15.5 (compiled with Erlang/OTP 25)
Operating system
Linux 4.18.0-372.9.1.el8.x86_64 #1 SMP Wed May 11 19:58:59 PDT 2022 x86_64 x86_64 x86_64 GNU/Linux
Current behavior
I'm working on updating our environment from Elixir 1.13 to Elixir 1.15. As such I'm in a process of trying to get all our dependencies to compile, which is a stepwise process.
I first encountered an error compiling phoenix_markdown:
earmark had been compiled in my first pass, this was my second.
Now I have this pair of results, which shows to me that for some reason while compiling a dependency that uses a struct from another dependency, the compiler is somehow unable to find and refer to the struct from the previously compiled dependency.
The struct from mogrify should be available to link_preview even though mogrify was compiled in a previous pass of deps.compile.
Expected behavior
Two related dependencies should not need to be compiled in the same pass of deps.compile for the second app to refer to a struct from the first app. As long as the app containing the struct is already compiled it's structs should be available to other apps when compiled separately.
The text was updated successfully, but these errors were encountered: