a-maze-d

a-maze-d

Narrow down `atomvm.packbeam` warning

Hi,

I’m trying to build an atomvm image with atomvm.packbeam which gives me the following warnings:

Warning: following modules or functions are not available on AtomVM:
* Elixir.Macro:escape/1
* elixir_module:compile/6

I’m using an external library and I would like to track down where those calls are coming from, to understand what they are used for and whether I might run into problems down the row.

A search for those calls didn’t reveal anything. The library does use some macros, but those should (if my understanding is correct) be resolved at compile time. Of course the issue might come from some transient dependencies.

Is there a good way to figure out where those function calls are coming from?

Thanks for any ideas and help

Marked As Solved

a-maze-d

a-maze-d

I could track them both down with a lot of trial and error. Problem solved :slight_smile:

The issues were (in one of the deps):

  • Wrong use of Macro.escape instead of unquote
  • One module was using some Code.loaded?, Code.ensure_loaded?, :code.purge, and :code.delete. Removing that part removed the second warning too.

Regarding the first one:
The code looked like the following:

defmacro __using__(opts) do
  ...
  other = calc_something()
  ast = create_ast()
  quote bind_quoted: [other: other, ast: ast] do
    Macro.escape(ast)
    func(other)
    ...
  end
end

The tricky part is that removing the ast: ast from the bind_quoted and doing an explicit unquote(ast) didn’t work. Only by removing the whole bind_quoted did the trick, i.e. the following worked:

defmacro __using__(opts) do
  ...
  other = calc_something()
  ast = create_ast()
  quote do
    unquote(ast)
    func(unquote(other))
    ...
  end
end

Also Liked

a-maze-d

a-maze-d

I’ll comment on your PR. That’s probably easier

Where Next?

Popular in Questions Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Other popular topics Top

malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement