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

Cannot compile in Alpine Linux #30

Open
simpers opened this issue Jul 3, 2018 · 11 comments
Open

Cannot compile in Alpine Linux #30

simpers opened this issue Jul 3, 2018 · 11 comments

Comments

@simpers
Copy link

simpers commented Jul 3, 2018

I'm trying to setup a workflow where I can compile my app in a docker container running Alpine Linux such that the release will then run in a docker image in a Kubernetes cluster. I'm using distillery and edeliver for this.

I do however get this when trying to compile my own app, as parse_trans is a part of the dependency tree. My app is a Phoenix 1.3.2 application.

In the Alpine Linux container I have these versions of Erlang and Elixir:

Erlang:

Erlang/OTP 20 [erts-9.1.5] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V9.1.5

Elixir (might not interesting for you I suppose):

IEx 1.5.2

Error when trying to compile parse_trans

DEBUG=1 rebar3 bare compile --paths "/tmp/edeliver/tol/builds/_build/prod/lib/*/ebin"         
===> Expanded command sequence to be run: []
===> Provider: {default,do}
===> Expanded command sequence to be run: [{default,app_discovery},
                                                  {bare,compile}]
===> Provider: {default,app_discovery}
===> Provider: {bare,compile}
===> Compiling parse_trans
===> run_hooks("/tmp/edeliver/tol/builds/deps/parse_trans", pre_hooks, compile) -> no hooks defined

===> run_hooks("/tmp/edeliver/tol/builds/deps/parse_trans", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info]
===> files to compile ["/tmp/edeliver/tol/builds/deps/parse_trans/src/exprecs.erl",
                              "/tmp/edeliver/tol/builds/deps/parse_trans/src/ct_expand.erl",
                              "/tmp/edeliver/tol/builds/deps/parse_trans/src/parse_trans_pp.erl",
                              "/tmp/edeliver/tol/builds/deps/parse_trans/src/parse_trans_mod.erl",
                              "/tmp/edeliver/tol/builds/deps/parse_trans/src/parse_trans.erl",
                              "/tmp/edeliver/tol/builds/deps/parse_trans/src/parse_trans_codegen.erl"]
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
===> Uncaught error: undef
===> Stack trace to the error location:
[{erl_syntax,type,[{attribute,626,module,exprecs}],[]},
 {rebar_erlc_compiler,parse_attrs,3,
                      [{file,"/home/tristan/Devel/rebar3/_build/prod/lib/rebar/src/rebar_erlc_compiler.erl"},
                       {line,670}]},
 {rebar_erlc_compiler,modify_erlcinfo,5,
                      [{file,"/home/tristan/Devel/rebar3/_build/prod/lib/rebar/src/rebar_erlc_compiler.erl"},
                       {line,478}]},
 {rebar_erlc_compiler,'-update_erlcinfo_fun/2-fun-0-',4,
                      [{file,"/home/tristan/Devel/rebar3/_build/prod/lib/rebar/src/rebar_erlc_compiler.erl"},
                       {line,463}]},
 {lists,foldl,3,[{file,"lists.erl"},{line,1263}]},
 {rebar_erlc_compiler,init_erlcinfo,4,
                      [{file,"/home/tristan/Devel/rebar3/_build/prod/lib/rebar/src/rebar_erlc_compiler.erl"},
                       {line,411}]},
 {rebar_erlc_compiler,compile_dirs,5,
                      [{file,"/home/tristan/Devel/rebar3/_build/prod/lib/rebar/src/rebar_erlc_compiler.erl"},
                       {line,195}]},
 {rebar_erlc_compiler,compile,2,
                      [{file,"/home/tristan/Devel/rebar3/_build/prod/lib/rebar/src/rebar_erlc_compiler.erl"},
                       {line,121}]}]
===> When submitting a bug report, please include the output of `rebar3 report "your command"`
@simpers
Copy link
Author

simpers commented Jul 3, 2018

Actually, this might be due to rebar3 and not this project itself. I guess we should close it.

@ning-y
Copy link

ning-y commented Jul 26, 2018

@simpers I got the same problem on alpine:3.7. Do you have a fix for the rebar3 issue?

@simpers
Copy link
Author

simpers commented Jul 26, 2018

@ningyuansg unfortunately this is not possible on 3.7 as this package is only available in edge for now. Rebar3 Alpine Linux package

So I decided to just build my edeliver-builder against edge for now, but it might be possible to have the server-image be 3.7 after it's been built etc.

@fenollp
Copy link
Contributor

fenollp commented Jul 26, 2018

I know this works:

docker run --rm -t erlang:alpine /bin/sh -xc 'apk update && apk upgrade && apk add git curl make && curl --fail --output /usr/local/bin/rebar3 https://s3.amazonaws.com/rebar3/rebar3 && chmod +x /usr/local/bin/rebar3 && rebar3 --version && git clone https://github.com/uwiger/parse_trans.git && cd parse_trans && rebar3 compile'

but it uses erlang:alpine which right now is based on alpine:3.8

@simpers
Copy link
Author

simpers commented Jul 26, 2018

@fenollp So that rebar3 is working on 3.8? How is this possible? There is no rebar3 package in the 3.8 repos though, which makes me wonder why that is if there's a binary out there that works.

@bhuvankrishna
Copy link

bhuvankrishna commented Mar 17, 2019

I get a similar error while installing pleroma. When I run mix pleroma.instance.gen as suggested in pleroma install guide
I get the same error in the crashdump of rebar3

Error: {badmatch,[]}
[{rebar_prv_bare_compile,do,1,
                         [{file,"/home/tristan/Devel/rebar3/_build/prod/lib/rebar/src/rebar_prv_bare_compile.erl"},
                          {line,47}]},
 {rebar_core,do,2,
             [{file,"/home/tristan/Devel/rebar3/_build/prod/lib/rebar/src/rebar_core.erl"},
              {line,154}]},
 {rebar_prv_do,do_tasks,2,
               [{file,"/home/tristan/Devel/rebar3/_build/prod/lib/rebar/src/rebar_prv_do.erl"},
                {line,68}]},
 {rebar_core,do,2,
             [{file,"/home/tristan/Devel/rebar3/_build/prod/lib/rebar/src/rebar_core.erl"},
              {line,154}]},
 {rebar3,main,1,
         [{file,"/home/tristan/Devel/rebar3/_build/prod/lib/rebar/src/rebar3.erl"},
          {line,66}]},
 {escript,run,2,[{file,"escript.erl"},{line,758}]},
 {escript,start,1,[{file,"escript.erl"},{line,277}]},
 {init,start_em,1,[]}]

As sugested in another issue I think it may not be related to parse_trans but I don't know how to approch this issue and fix it.
This is on debian testing with the following version or rebar3
rebar 3.6.1 on Erlang/OTP 21 Erts 10.2.4

@fenollp
Copy link
Contributor

fenollp commented Mar 17, 2019

Can it be that you used code compiled with a different major version of OTP? A cache not evicted?
I don’t know if there are garanties on the backwards compatibility of the compiled BEAM code.

@bhuvankrishna
Copy link

The problem was with erlang version. I installed erlang package that came with debian and not the one that is suggested by pleroma doc. After installing the deb from erlang everything worked.

@z411
Copy link

z411 commented Jul 11, 2019

@bhuvankrishna Excuse me, do you know which version of erlang caused the problem and which one fixed it? I'm using the newly released Debian 10 release (buster) and the suggested repos don't have a repo for it yet, so I'll probably need to build the packages myself.

EDIT: I tried using erlang packages from sid (version 22.0) but they don't work either. I wonder if there's something wrong with the Debian packages?

@bhuvankrishna
Copy link

bhuvankrishna commented Aug 3, 2019

@bhuvankrishna Excuse me, do you know which version of erlang caused the problem and which one fixed it? I'm using the newly released Debian 10 release (buster) and the suggested repos don't have a repo for it yet, so I'll probably need to build the packages myself.

EDIT: I tried using erlang packages from sid (version 22.0) but they don't work either. I wonder if there's something wrong with the Debian packages?

@z411 erlang version provided by debian is not working. I added repository from erlang download page. In fact the process is to download the deb and install it with dpkg -i package

@neysofu
Copy link

neysofu commented Nov 18, 2019

The following solved this for me:

apk add --update alpine-sdk

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

No branches or pull requests

6 participants