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

albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
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
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
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
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
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New

Other popular topics Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
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

We're in Beta

About us Mission Statement