Skip to content
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

Install missing pc dependency for Elixir compatibility #9

Merged
merged 1 commit into from
Mar 22, 2024

Conversation

arturz
Copy link

@arturz arturz commented Mar 19, 2024

Description

Mix Elixir build tool does not support Rebar3 plugins, and pc (port compiler) plugin is required.

Fix

This PR adds pc as a dependency, making eiconv work with Elixir applications.

How to reproduce?

  1. Create a new Elixir application.
  2. Add {:eiconv, "~> 1.0"} to deps.
  3. Run DEBUG=1 mix compile.

Error below is produced:

===> Getting definition for package pc from repo hexpm (#{name => <<"hexpm">>,repo_verify_origin => true,
         repo_name => <<"hexpm">>,repo_url => <<"https://repo.hex.pm">>,
         repo_organization => undefined,api_url => <<"https://hex.pm/api">>,
         repo_verify => true})
===> hex_repo:get_package failed for package <<"pc">>: badarg
===> throw {error,{rebar_app_utils,{missing_package,<<"pc">>,undefined}}} [{rebar_app_utils,
                                                                            update_source,
                                                                            3,
                                                                            [{file,
                                                                              "/rebar3/apps/rebar/src/rebar_app_utils.erl"},
                                                                             {line,
                                                                              335}]},
                                                                           {rebar_prv_install_deps,
                                                                            '-handle_profile_level/7-lc$^0/1-0-',
                                                                            3,
                                                                            [{file,
                                                                              "/rebar3/apps/rebar/src/rebar_prv_install_deps.erl"},
                                                                             {line,
                                                                              178}]},
                                                                           {rebar_prv_install_deps,
                                                                            handle_profile_level,
                                                                            7,
                                                                            [{file,
                                                                              "/rebar3/apps/rebar/src/rebar_prv_install_deps.erl"},
                                                                             {line,
                                                                              179}]},
                                                                           {rebar_plugins,
                                                                            handle_plugin,
                                                                            5,
                                                                            [{file,
                                                                              "/rebar3/apps/rebar/src/rebar_plugins.erl"},
                                                                             {line,
                                                                              121}]},
                                                                           {rebar_plugins,
                                                                            '-handle_plugins/4-fun-0-',
                                                                            5,
                                                                            [{file,
                                                                              "/rebar3/apps/rebar/src/rebar_plugins.erl"},
                                                                             {line,
                                                                              102}]},
                                                                           {lists,
                                                                            foldl,
                                                                            3,
                                                                            [{file,
                                                                              "lists.erl"},
                                                                             {line,
                                                                              1594}]},
                                                                           {rebar_plugins,
                                                                            handle_plugins,
                                                                            4,
                                                                            [{file,
                                                                              "/rebar3/apps/rebar/src/rebar_plugins.erl"},
                                                                             {line,
                                                                              101}]},
                                                                           {lists,
                                                                            foldl,
                                                                            3,
                                                                            [{file,
                                                                              "lists.erl"},
                                                                             {line,
                                                                              1594}]}]
===> Errors loading plugin pc. Run rebar3 with DEBUG=1 set to see errors.
===> Expanded command sequence to be run: []
===> Running provider: do
===> Expanded command sequence to be run: [app_discovery,{bare,compile}]
===> Running provider: app_discovery
===> Found top-level apps: [eiconv]
        using config: [{src_dirs,["src"]},{lib_dirs,["apps/*","lib/*","."]}]
===> Getting definition for package pc from repo hexpm
===> hex_repo:get_package failed for package <<"pc">>: badarg
===> throw {error,{rebar_app_utils,{missing_package,<<"pc">>,undefined}}} [{rebar_app_utils,
                                                                            update_source,
                                                                            3,
                                                                            [{file,
                                                                              "/rebar3/apps/rebar/src/rebar_app_utils.erl"},
                                                                             {line,
                                                                              335}]},
                                                                           {rebar_prv_install_deps,
                                                                            '-handle_profile_level/7-lc$^0/1-0-',
                                                                            3,
                                                                            [{file,
                                                                              "/rebar3/apps/rebar/src/rebar_prv_install_deps.erl"},
                                                                             {line,
                                                                              178}]},
                                                                           {rebar_prv_install_deps,
                                                                            handle_profile_level,
                                                                            7,
                                                                            [{file,
                                                                              "/rebar3/apps/rebar/src/rebar_prv_install_deps.erl"},
                                                                             {line,
                                                                              179}]},
                                                                           {rebar_plugins,
                                                                            handle_plugin,
                                                                            5,
                                                                            [{file,
                                                                              "/rebar3/apps/rebar/src/rebar_plugins.erl"},
                                                                             {line,
                                                                              121}]},
                                                                           {rebar_plugins,
                                                                            '-handle_plugins/4-fun-0-',
                                                                            5,
                                                                            [{file,
                                                                              "/rebar3/apps/rebar/src/rebar_plugins.erl"},
                                                                             {line,
                                                                              102}]},
                                                                           {lists,
                                                                            foldl,
                                                                            3,
                                                                            [{file,
                                                                              "lists.erl"},
                                                                             {line,
                                                                              1594}]},
                                                                           {rebar_plugins,
                                                                            handle_plugins,
                                                                            4,
                                                                            [{file,
                                                                              "/rebar3/apps/rebar/src/rebar_plugins.erl"},
                                                                             {line,
                                                                              101}]},
                                                                           {lists,
                                                                            foldl,
                                                                            3,
                                                                            [{file,
                                                                              "lists.erl"},
                                                                             {line,
                                                                              1594}]}]
===> Errors loading plugin pc. Run rebar3 with DEBUG=1 set to see errors.
===> Running provider: {bare,compile}
===> Compile (untagged)
===> Running hooks for compile in app eiconv (/Users/az/testapp/deps/eiconv) with configuration:
===>    {provider_hooks, [{pre, [{pc,compile}]}]}.
===> Running provider: {pc,compile}
===> Unable to run pre hooks for 'compile', command 'compile' in namespace 'pc' not found.
===> Unable to run pre hooks for 'compile', command 'compile' in namespace 'pc' not found.
** (Mix) Could not compile dependency :eiconv, "/Users/az/.asdf/installs/elixir/1.16.2-otp-26/.mix/elixir/1-16/rebar3 bare compile --paths /Users/az/testapp/_build/dev/lib/*/ebin" command failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile eiconv --force", update it with "mix deps.update eiconv" or clean it with "mix deps.clean eiconv"

This PR fixed that issue.

@mworrell mworrell requested a review from mmzeeman March 19, 2024 12:50
@mmzeeman mmzeeman merged commit 8cb34a4 into zotonic:master Mar 22, 2024
0 of 4 checks passed
@mmzeeman
Copy link
Member

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants