fredwu / crawler

A high performance web crawler / scraper in Elixir.
945 stars 91 forks source link

How to deal with WX? #37

Closed yujonglee closed 4 months ago

yujonglee commented 4 months ago

When I add crawler as deps and run my app, I got this working:

core-1  | =INFO REPORT==== 22-Jun-2024::14:41:08.600961 ===
core-1  |     application: kernel
core-1  |     exited: {{shutdown,
core-1  |                  {failed_to_start_child,on_load,
core-1  |                      {on_load_function_failed,gl,
core-1  |                          {error,
core-1  |                              {load_failed,
core-1  |                                  "Failed to load NIF library: '/app/lib/wx-2.4.1/priv/erl_gl.so: cannot open shared object file: No such file or directory'"}}}}},
core-1  |              {kernel,start,[normal,[]]}}
core-1  |     type: permanent
core-1  |
core-1  | Kernel pid terminated (application_controller) ("{application_start_failure,kernel,{{shutdown,{failed_to_start_child,on_load,{on_load_function_failed,gl,{error,{load_failed,\"Failed to load NIF library: '/app/lib/wx-2.4.1/priv/erl_gl.so: cannot open shared object file: No such file or directory'\"}}}}},{kernel,start,[normal,[]]}}}")

Digging into this, I found that _build/prod/lib/crawler/ebin/crawler.app has wx inside applications:

{application,crawler,
             [{config_mtime,1719031138},
              {optional_applications,[]},
              {applications,[kernel,stdlib,elixir,logger,runtime_tools,
                             observer,wx,httpoison,floki,opq,retry]},

So it is clear that crawler introduce this problem for me. Am I the only one has this problem in Prod? Any suggestions on how to fix this?

I tried adding :wx in my extra_applications, and install libwxgtk3.0-gtk3-0v5 libwxbase3.0-0v5 erlang-wx in my dockerfile, but it did not solve my issue.

yujonglee commented 4 months ago

Ended up targeting 6866bbe287c760b7e4bba1925e80f2a4494d7af3 in my deps, rather than 1.5.0