# \#compiling

**URL:** https://forum.elixirforum.com/tag/compiling/36.md

[Latest](https://forum.elixirforum.com/latest.md) · [Categories](https://forum.elixirforum.com/categories.md) · [Tags](https://forum.elixirforum.com/tags.md)

---

## [Missing compilations on 1.20.0 rc.3](https://forum.elixirforum.com/t/missing-compilations-on-1-20-0-rc-3/74747)

<div class="topic-metadata">

**Author:** [@tjchambers](https://forum.elixirforum.com/u/tjchambers)\
**Replies:** 8\
**Last updated:** [March 23, 2026, 7:35am UTC](https://forum.elixirforum.com/t/missing-compilations-on-1-20-0-rc-3/74747 "2026-03-23T07:35:36Z")

</div>

Erlang OTP 28 Elixir 1.20.0-rc.3 (9b80ab5) (compiled with Erlang/OTP 28) I am having a difficult to fathom issue with developing on 1.20.0-rc.3. Yesterday I switched from 1.19.4 to developing on that version and all se…

---

## [How to conditionally compile a module with 3rd party macros](https://forum.elixirforum.com/t/how-to-conditionally-compile-a-module-with-3rd-party-macros/74444)

<div class="topic-metadata">

**Author:** [@fellipessanha](https://forum.elixirforum.com/u/fellipessanha)\
**Replies:** 0\
**Last updated:** [February 26, 2026, 6:29pm UTC](https://forum.elixirforum.com/t/how-to-conditionally-compile-a-module-with-3rd-party-macros/74444 "2026-02-26T18:29:21Z")

</div>

I’ve been working on a wrapper library for a brazillian Open Finance api, and I incurred into a fun error whilst trying to conditionally compile a module with 3rd party macros. I wrote a short text about this on medium, …

---

## [Homex from hex not building on Nerves due to Quicer](https://forum.elixirforum.com/t/homex-from-hex-not-building-on-nerves-due-to-quicer/73557)

<div class="topic-metadata">

**Author:** [@lawik](https://forum.elixirforum.com/u/lawik)\
**Replies:** 1\
**Last updated:** [December 5, 2025, 8:04am UTC](https://forum.elixirforum.com/t/homex-from-hex-not-building-on-nerves-due-to-quicer/73557 "2025-12-05T08:04:42Z")

</div>

The quicer library in homex fails to build under a freshly generated project and the rpi3: install ./include/openssl/opensslconf.h -\> /home/lawik/projects/radio/najs/deps/quicer/c\_build/\_deps/opensslquic-build/openssl/i…

---

## [Compiling files with many function heads is very slow(OTP 26 issue?)](https://forum.elixirforum.com/t/compiling-files-with-many-function-heads-is-very-slow-otp-26-issue/57105)

<div class="topic-metadata">

**Author:** [@pejrich](https://forum.elixirforum.com/u/pejrich)\
**Replies:** 69\
**Last updated:** [October 3, 2025, 1:31pm UTC](https://forum.elixirforum.com/t/compiling-files-with-many-function-heads-is-very-slow-otp-26-issue/57105 "2025-10-03T13:31:25Z")

</div>

I have quite a few files in my project that have many function heads(100s to 1000s). I don’t think these can easily be replaced with another way of doing it. For example, transliterating Japanese into Latin characters. R…

---

## ["The Inspect protocol has already been consolidated" for Ecto schema with redacted field](https://forum.elixirforum.com/t/the-inspect-protocol-has-already-been-consolidated-for-ecto-schema-with-redacted-field/34992)

<div class="topic-metadata">

**Author:** [@belaustegui](https://forum.elixirforum.com/u/belaustegui)\
**Replies:** 21\
**Last updated:** [October 3, 2025, 12:18pm UTC](https://forum.elixirforum.com/t/the-inspect-protocol-has-already-been-consolidated-for-ecto-schema-with-redacted-field/34992 "2025-10-03T12:18:16Z")

</div>

I’ve recently started a new Phoenix project using Elixir 1.11, Phoenix 1.5 and Ecto 3.5. Everything runs smoothly but there is a recurrent warning in ElixirLS which I can not fix. The warning says: the Inspect protoco…

---

## [Module compilation taking more than 10s](https://forum.elixirforum.com/t/module-compilation-taking-more-than-10s/10908)

<div class="topic-metadata">

**Author:** [@belaustegui](https://forum.elixirforum.com/u/belaustegui)\
**Replies:** 15\
**Last updated:** [July 31, 2025, 6:46pm UTC](https://forum.elixirforum.com/t/module-compilation-taking-more-than-10s/10908 "2025-07-31T18:46:40Z")

</div>

When I compile my application, I see a lot of messages like: Compiling some/module/file.ex (it’s taking more than 10s) I understand that this message is appearing because the compilation of those modules is slow, but…

---

## [NIF - Any way to set LD\_LIBRARY\_PATH during compilation?](https://forum.elixirforum.com/t/nif-any-way-to-set-ld-library-path-during-compilation/12483)

<div class="topic-metadata">

**Author:** [@jordan0day](https://forum.elixirforum.com/u/jordan0day)\
**Replies:** 8\
**Last updated:** [February 12, 2025, 2:21pm UTC](https://forum.elixirforum.com/t/nif-any-way-to-set-ld-library-path-during-compilation/12483 "2025-02-12T14:21:44Z")

</div>

I’m in the process of writing a NIF library application which in turn depends on a vendor’s shared lib (which has it’s own set of dependencies as well). My hope is to just keep all the various .so’s contained in /priv. I…

---

## [Module Phoenix.Component is not loaded and could not be found](https://forum.elixirforum.com/t/module-phoenix-component-is-not-loaded-and-could-not-be-found/66627)

<div class="topic-metadata">

**Author:** [@canelle20214](https://forum.elixirforum.com/u/canelle20214)\
**Replies:** 4\
**Last updated:** [February 9, 2025, 12:39am UTC](https://forum.elixirforum.com/t/module-phoenix-component-is-not-loaded-and-could-not-be-found/66627 "2025-02-09T00:39:40Z")

</div>

I went from Phoenix 1.5 to 1.7 and I’m still facing an error when compiling the project. elixir 1.17.3-otp-27 erlang 27.1 Here is the compilation error: error: module Phoenix.Controller is not loaded and could no…

---

## [No escape hatch for typing error](https://forum.elixirforum.com/t/no-escape-hatch-for-typing-error/68946)

<div class="topic-metadata">

**Author:** [@VictorGaiva](https://forum.elixirforum.com/u/VictorGaiva)\
**Replies:** 3\
**Last updated:** [January 23, 2025, 3:36pm UTC](https://forum.elixirforum.com/t/no-escape-hatch-for-typing-error/68946 "2025-01-23T15:36:20Z")

</div>

I’m currently migrating my codebase to Elixir 1.18.2. I was able to solve all the typing issues, except for one. The following code: defmodule Run do def test do try do Code.compile\_string("a + ") rescue…

---

## [Avoiding re-compiling via build\_per\_environment: false](https://forum.elixirforum.com/t/avoiding-re-compiling-via-build-per-environment-false/68782)

<div class="topic-metadata">

**Author:** [@fireproofsocks](https://forum.elixirforum.com/u/fireproofsocks)\
**Replies:** 1\
**Last updated:** [January 17, 2025, 9:43am UTC](https://forum.elixirforum.com/t/avoiding-re-compiling-via-build-per-environment-false/68782 "2025-01-17T09:43:06Z")

</div>

I had a question about using build\_per\_environment: false in my mix.exs… I have a simple app that doesn’t have any compile-time configuration, so I thought I could use build\_per\_environment: false so I wouldn’t have to c…

---

## [Get a struct definition from \`\_\_before\_compile\_\_/2\` callback](https://forum.elixirforum.com/t/get-a-struct-definition-from-before-compile-2-callback/68056)

<div class="topic-metadata">

**Author:** [@mudasobwa](https://forum.elixirforum.com/u/mudasobwa)\
**Replies:** 7\
**Last updated:** [December 12, 2024, 12:17pm UTC](https://forum.elixirforum.com/t/get-a-struct-definition-from-before-compile-2-callback/68056 "2024-12-12T12:17:41Z")

</div>

Prior to v1.18.0 I used the following vode to reach the struct definition in a module from \_\_before\_compile\_\_/2 callback. defp fields(module) do module |\> Module.get\_attribute(:\_\_struct\_\_, %{}) |\> …

---

## [Dynamically setting a plug in the Phoenix router](https://forum.elixirforum.com/t/dynamically-setting-a-plug-in-the-phoenix-router/67707)

<div class="topic-metadata">

**Author:** [@brucepomeroy](https://forum.elixirforum.com/u/brucepomeroy)\
**Replies:** 2\
**Last updated:** [November 27, 2024, 3:16am UTC](https://forum.elixirforum.com/t/dynamically-setting-a-plug-in-the-phoenix-router/67707 "2024-11-27T03:16:16Z")

</div>

In the phoenix router I want to define a plug for a pipeline. I want to use a different implementation of the plug module in the test environment so I have defined the plug in compile.exs and overridden it in test.exs. S…

---

## [Any idea why the Tails library may be contributing to longer compile time?](https://forum.elixirforum.com/t/any-idea-why-the-tails-library-may-be-contributing-to-longer-compile-time/67458)

<div class="topic-metadata">

**Author:** [@firesidewing](https://forum.elixirforum.com/u/firesidewing)\
**Replies:** 9\
**Last updated:** [November 14, 2024, 7:41pm UTC](https://forum.elixirforum.com/t/any-idea-why-the-tails-library-may-be-contributing-to-longer-compile-time/67458 "2024-11-14T19:41:33Z")

</div>

I’ve been using the SaladUI library a bit and one of the things that I’ve noticed is that compiling depencies has significantly slowed down. Just based on watching the console logs I can tell that the Tails library is li…

---

## [Compiling happens a second time on initial request](https://forum.elixirforum.com/t/compiling-happens-a-second-time-on-initial-request/66669)

<div class="topic-metadata">

**Author:** [@lardcanoe](https://forum.elixirforum.com/u/lardcanoe)\
**Replies:** 1\
**Last updated:** [October 11, 2024, 10:44pm UTC](https://forum.elixirforum.com/t/compiling-happens-a-second-time-on-initial-request/66669 "2024-10-11T22:44:04Z")

</div>

In my local dev, when I start the server, it ALWAYS compiles. Even if I have not changed any code. This is annoying, and hopefully someones knows why. My main question is even after this compile, when I make the first r…

---

## [Compilation fails on 1.17.0-dev because of lack of “version” meta key](https://forum.elixirforum.com/t/compilation-fails-on-1-17-0-dev-because-of-lack-of-version-meta-key/63732)

<div class="topic-metadata">

**Author:** [@mudasobwa](https://forum.elixirforum.com/u/mudasobwa)\
**Replies:** 5\
**Last updated:** [May 23, 2024, 12:09pm UTC](https://forum.elixirforum.com/t/compilation-fails-on-1-17-0-dev-because-of-lack-of-version-meta-key/63732 "2024-05-23T12:09:46Z")

</div>

During the upgrade of one of my libraries to 1.17.0, I got the following error message led the compilation to failing. == Compilation error in file lib/md/parser/engine.ex == \*\* (MatchError) no match of right hand side …

---

## [Compilation error if the user does not own the code files](https://forum.elixirforum.com/t/compilation-error-if-the-user-does-not-own-the-code-files/62250)

<div class="topic-metadata">

**Author:** [@txssu](https://forum.elixirforum.com/u/txssu)\
**Replies:** 3\
**Last updated:** [March 12, 2024, 3:58pm UTC](https://forum.elixirforum.com/t/compilation-error-if-the-user-does-not-own-the-code-files/62250 "2024-03-12T15:58:14Z")

</div>

Hi, Found this line in the compiler. The comment says: # For each changed file, mark it as changed. # If compilation fails mid-cycle, they will be picked next time around. If I understand correctly, some files may cha…

---

## [Module Does Not Recompile When Referenced Module Changes](https://forum.elixirforum.com/t/module-does-not-recompile-when-referenced-module-changes/62117)

<div class="topic-metadata">

**Author:** [@mjlorenzo](https://forum.elixirforum.com/u/mjlorenzo)\
**Replies:** 14\
**Last updated:** [March 6, 2024, 4:04pm UTC](https://forum.elixirforum.com/t/module-does-not-recompile-when-referenced-module-changes/62117 "2024-03-06T16:04:13Z")

</div>

Hi folks, got a question about how Elixir determines when to recompile a module. The documentation says a module will recompile when one of its dependencies changes, but that doesn’t seem to be the case here and I’m not …

---

## [Help understanding compile-time dependencies when referencing aliases in module attributes](https://forum.elixirforum.com/t/help-understanding-compile-time-dependencies-when-referencing-aliases-in-module-attributes/60232)

<div class="topic-metadata">

**Author:** [@lurodrigo](https://forum.elixirforum.com/u/lurodrigo)\
**Replies:** 4\
**Last updated:** [December 20, 2023, 8:11pm UTC](https://forum.elixirforum.com/t/help-understanding-compile-time-dependencies-when-referencing-aliases-in-module-attributes/60232 "2023-12-20T20:11:50Z")

</div>

I’m refactoring some parts of a codebase that do some compile-time magic, in order to reduce the number of compile-time dependencies between modules. One thing I don’t fully get is when nominal references to other module…

---

## [Mix command works in terminal but doesn't compile with "mix new my\_project"](https://forum.elixirforum.com/t/mix-command-works-in-terminal-but-doesnt-compile-with-mix-new-my-project/60221)

<div class="topic-metadata">

**Author:** [@Codename-404](https://forum.elixirforum.com/u/Codename-404)\
**Replies:** 8\
**Last updated:** [December 9, 2023, 4:09am UTC](https://forum.elixirforum.com/t/mix-command-works-in-terminal-but-doesnt-compile-with-mix-new-my-project/60221 "2023-12-09T04:09:23Z")

</div>

Hi, I am new to elixir, tried several ways to install elixir on my Mac M1. Everything works on terminal or if I just create a test.exs file. But when I want to add Phoenix or even with a “mix new my\_project”, it always…

---

## [SayCheezEx - capture the environment at build time](https://forum.elixirforum.com/t/saycheezex-capture-the-environment-at-build-time/54688)

<div class="topic-metadata">

**Author:** [@l3nz](https://forum.elixirforum.com/u/l3nz)\
**Replies:** 4\
**Last updated:** [September 2, 2023, 8:42am UTC](https://forum.elixirforum.com/t/saycheezex-capture-the-environment-at-build-time/54688 "2023-09-02T08:42:19Z")

</div>

I am releasing SayCheezEx, a library to capture the build time environment in a very simple and concise way. When I deploy a release, I always want it to embed its own version, Git sha revision, when it was built… all t…

---

## [Persistent Builds Issue: Dependencies Recompiling Every Time](https://forum.elixirforum.com/t/persistent-builds-issue-dependencies-recompiling-every-time/57487)

<div class="topic-metadata">

**Author:** [@ukashazia](https://forum.elixirforum.com/u/ukashazia)\
**Replies:** 8\
**Last updated:** [August 10, 2023, 10:48am UTC](https://forum.elixirforum.com/t/persistent-builds-issue-dependencies-recompiling-every-time/57487 "2023-08-10T10:48:03Z")

</div>

I’m currently working on an Elixir project using Visual Studio Code (VSCode) as my development environment. Unfortunately, I’ve encountered an issue with persistent builds and dependency compilation. When I run mix comm…

---

## [Specifying paths for static library assets used in macro (compile vs runtime && \`/app/\_build/prod/lib/\` vs \`/app/lib\`)](https://forum.elixirforum.com/t/specifying-paths-for-static-library-assets-used-in-macro-compile-vs-runtime-app-build-prod-lib-vs-app-lib/56253)

<div class="topic-metadata">

**Author:** [@david](https://forum.elixirforum.com/u/david)\
**Replies:** 1\
**Last updated:** [June 1, 2023, 7:25pm UTC](https://forum.elixirforum.com/t/specifying-paths-for-static-library-assets-used-in-macro-compile-vs-runtime-app-build-prod-lib-vs-app-lib/56253 "2023-06-01T19:25:05Z")

</div>

TL;DR: How to ensure that file paths specified in a library when compiled in a macro reflect correct paths at release. /app/\_build/prod/lib/library\_name/priv/ when compiled vs /app/lib/library\_name-version/priv/ when rel…

---

## [@external\_resource for folder / how does embed\_templates do it?](https://forum.elixirforum.com/t/external-resource-for-folder-how-does-embed-templates-do-it/55823)

<div class="topic-metadata">

**Author:** [@Sebb](https://forum.elixirforum.com/u/Sebb)\
**Replies:** 1\
**Last updated:** [May 11, 2023, 7:02pm UTC](https://forum.elixirforum.com/t/external-resource-for-folder-how-does-embed-templates-do-it/55823 "2023-05-11T19:02:47Z")

</div>

I try to do sth like @external\_resrouce "foo/bar/\*\*" # recompile when folder-contents change which does not work. @external\_resource takes a single file. I can do defmodule Foo do for f \<- Path.wildcard("foo/bar/\*\*…

---

## [Get types from struct in compilation time](https://forum.elixirforum.com/t/get-types-from-struct-in-compilation-time/55475)

<div class="topic-metadata">

**Author:** [@ntd23](https://forum.elixirforum.com/u/ntd23)\
**Replies:** 2\
**Last updated:** [April 24, 2023, 2:26pm UTC](https://forum.elixirforum.com/t/get-types-from-struct-in-compilation-time/55475 "2023-04-24T14:26:29Z")

</div>

Is there way to get the types from struct defined as bellow, and generate functions based on your types; like binary(), integer()? Can I get the keys of a struct that is marked as “enforced”? So I have a struct c…

---

## [Why are compile-time dependencies between modules transitive?](https://forum.elixirforum.com/t/why-are-compile-time-dependencies-between-modules-transitive/54899)

<div class="topic-metadata">

**Author:** [@japhib](https://forum.elixirforum.com/u/japhib)\
**Replies:** 15\
**Last updated:** [April 4, 2023, 10:42pm UTC](https://forum.elixirforum.com/t/why-are-compile-time-dependencies-between-modules-transitive/54899 "2023-04-04T22:42:01Z")

</div>

I use Elixir at work, on a pretty massive monolithic backend project – it’s about 750k lines of Elixir code, spread across a few dozen apps, all within one big umbrella app. It seems like this is fairly uncommon, as most…

---

## [Understanding a spike in app compilation time](https://forum.elixirforum.com/t/understanding-a-spike-in-app-compilation-time/53598)

<div class="topic-metadata">

**Author:** [@gmile](https://forum.elixirforum.com/u/gmile)\
**Replies:** 14\
**Last updated:** [February 4, 2023, 2:36am UTC](https://forum.elixirforum.com/t/understanding-a-spike-in-app-compilation-time/53598 "2023-02-04T02:36:35Z")

</div>

I’m investigating a spike in app compilation times, and would appreciate ideas / validation of the paths I am exploring. I have a huge app at hand, consisting of hundreds of .ex files. Recently, our team noticed that ch…

---

## [How to support multiple versions of a package with moved functions?](https://forum.elixirforum.com/t/how-to-support-multiple-versions-of-a-package-with-moved-functions/51200)

<div class="topic-metadata">

**Author:** [@aiko](https://forum.elixirforum.com/u/aiko)\
**Replies:** 4\
**Last updated:** [October 20, 2022, 12:58pm UTC](https://forum.elixirforum.com/t/how-to-support-multiple-versions-of-a-package-with-moved-functions/51200 "2022-10-20T12:58:55Z")

</div>

I am just playing around with Phoenix 1.18-dev and an upcoming change is the following: Phoenix.LiveView.assign/3 moved to Phoenix.Component.assign/3 This is a breaking change (which is fine). When compiling my update…

---

## [Compilation and how to check the final executable code - beam file (inline, dead code, optimization)](https://forum.elixirforum.com/t/compilation-and-how-to-check-the-final-executable-code-beam-file-inline-dead-code-optimization/50669)

<div class="topic-metadata">

**Author:** [@trashyEx](https://forum.elixirforum.com/u/trashyEx)\
**Replies:** 8\
**Last updated:** [September 30, 2022, 7:38pm UTC](https://forum.elixirforum.com/t/compilation-and-how-to-check-the-final-executable-code-beam-file-inline-dead-code-optimization/50669 "2022-09-30T19:38:23Z")

</div>

Hello! I would like to inspect the final code that is executed, and I don’t know how to do it. Question 1: Coming from C, what could be the nearest thing to inspect the assembly code generated by -O0 or -O2, for instan…

---

## [Why is not compilation aborted when an undefined module attribute is found?](https://forum.elixirforum.com/t/why-is-not-compilation-aborted-when-an-undefined-module-attribute-is-found/49314)

<div class="topic-metadata">

**Author:** [@Exadra37](https://forum.elixirforum.com/u/Exadra37)\
**Replies:** 14\
**Last updated:** [September 4, 2022, 8:59pm UTC](https://forum.elixirforum.com/t/why-is-not-compilation-aborted-when-an-undefined-module-attribute-is-found/49314 "2022-09-04T20:59:30Z")

</div>

A bug going into production without any need: warning: undefined module attribute @seconds, please remove access to @seconds or explicitly set it before access lib/api\_baas/accounts\_admins/admin\_user\_token.ex:120: Api…

---

## [How to profile long compile-times?](https://forum.elixirforum.com/t/how-to-profile-long-compile-times/47900)

<div class="topic-metadata">

**Author:** [@Qqwy](https://forum.elixirforum.com/u/Qqwy)\
**Replies:** 1\
**Last updated:** [May 21, 2022, 10:35am UTC](https://forum.elixirforum.com/t/how-to-profile-long-compile-times/47900 "2022-05-21T10:35:47Z")

</div>

When writing macros or other code that does something at compile-time, it certainly sometimes happens that compile times suddenly increase drastically. What tools and approaches are there available to profile or otherwi…

[Next page](https://forum.elixirforum.com/tag/compiling/36.md?match_all_tags=true&page=1&tags%5B%5D=compiling)
