ninenines / erlang.mk

A build tool for Erlang that just works.
https://erlang.mk
ISC License
578 stars 241 forks source link

Build error on docker with alpine image #736

Closed MarcAntoine-Arnaud closed 6 years ago

MarcAntoine-Arnaud commented 6 years ago

Hello,

I'm trying to build my Elixir project on an alpine image (which depends on rabbit_common project). When I call make I got:

 ERLC  
src/ssl_compat.erl:47: Warning: ssl:connection_info/1: removed in 20.0; use ssl:connection_information/[1,2] instead
src/ssl_compat.erl:67: Warning: ssl:connection_info/1: removed in 20.0; use ssl:connection_information/[1,2] instead
awk: bad regex '{modules,': Repetition not preceded by valid expression
make[1]: *** [Makefile:80: ebin/rabbit_common.app] Error 1
make: *** [erlang.mk:4913: app] Error 2

To repeat issue:

docker pull elixir:1.5.2-alpine
docker run -it elixir:1.5.2-alpine /bin/sh

then inside the container:

apk update
apk add git make curl
mix local.hex --force
mix local.rebar --force
mix hex.info
mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
mix phx.new testbuild
cd testbuild

Add AMQP dependency into mix.exs: {:amqp, "~> 0.3.0"},

mix compile

Remarks:

The Rabbit_common team mention the error appends here: https://github.com/rabbitmq/rabbitmq-common/blob/master/erlang.mk#L5136

Is it possible to have some help on that ?

Thanks, Marc-Antoine

essen commented 6 years ago

You say that building directly on alpine works, but not on alpine inside a Docker container? What's the difference?

MarcAntoine-Arnaud commented 6 years ago

Sorry no, everything is inside an Alpine docker container. It's just if I try to build the project itself (git clone, and run make), it works. The error appends when I create an Elixir project which have amqp (and rabbit_common) as dependencies. Is it clear ?

essen commented 6 years ago

Can you add $(info $(shell env)) to the rabbit_common Makefile and paste the result? Would also be good to have the command that runs this Makefile.

MarcAntoine-Arnaud commented 6 years ago

Here the complete build logs with the info level:

HOSTNAME=8d73c772b924 SHLVL=5 OLDPWD=/ HOME=/root OTP_VERSION=20.1.6 ERL_LIBS=/testbuild/_build/dev/lib PROGNAME=erl EMU=beam BINDIR=/usr/local/lib/erlang/erts-9.1.5/bin TERM=xterm PATH=/usr/local/lib/erlang/erts-9.1.5/bin:/usr/local/lib/erlang/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin LANG=C.UTF-8 ROOTDIR=/usr/local/lib/erlang ELIXIR_VERSION=v1.5.2 PWD=/testbuild/deps/rabbit_common IS_DEP=1
 GEN    clean-app
 GEN    coverdata-clean
 GEN    clean-dist
HOSTNAME=8d73c772b924 SHLVL=5 OLDPWD=/ HOME=/root OTP_VERSION=20.1.6 ERL_LIBS=/testbuild/_build/dev/lib PROGNAME=erl EMU=beam BINDIR=/usr/local/lib/erlang/erts-9.1.5/bin TERM=xterm PATH=/usr/local/lib/erlang/erts-9.1.5/bin:/usr/local/lib/erlang/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin LANG=C.UTF-8 ROOTDIR=/usr/local/lib/erlang ELIXIR_VERSION=v1.5.2 PWD=/testbuild/deps/rabbit_common IS_DEP=1
 DEPEND rabbit_common.d
ERLANG_MK_FILENAME=/testbuild/deps/rabbit_common/erlang.mk ERL_LIBS=/testbuild/_build/dev/lib:/testbuild/deps/rabbit_common/apps:/testbuild/deps/rabbit_common/deps current_rmq_ref=master PATH=/usr/local/lib/erlang/erts-9.1.5/bin:/usr/local/lib/erlang/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin NO_AUTOPATCH=amqp_client rabbit rabbit_common rabbitmq_amqp1_0 rabbitmq_auth_backend_amqp rabbitmq_auth_backend_cache rabbitmq_auth_backend_http rabbitmq_auth_backend_ldap rabbitmq_auth_mechanism_ssl rabbitmq_aws rabbitmq_boot_steps_visualiser rabbitmq_clusterer rabbitmq_cli rabbitmq_codegen rabbitmq_consistent_hash_exchange rabbitmq_ct_client_helpers rabbitmq_ct_helpers rabbitmq_delayed_message_exchange rabbitmq_dotnet_client rabbitmq_event_exchange rabbitmq_federation rabbitmq_federation_management rabbitmq_java_client rabbitmq_jms_client rabbitmq_jms_cts rabbitmq_jms_topic_exchange rabbitmq_lvc rabbitmq_management rabbitmq_management_agent rabbitmq_management_exchange rabbitmq_management_themes rabbitmq_management_visualiser rabbitmq_message_timestamp rabbitmq_metronome rabbitmq_mqtt rabbitmq_objc_client rabbitmq_peer_discovery_aws rabbitmq_peer_discovery_common rabbitmq_peer_discovery_consul rabbitmq_peer_discovery_etcd rabbitmq_peer_discovery_k8s rabbitmq_recent_history_exchange rabbitmq_routing_node_stamp rabbitmq_rtopic_exchange rabbitmq_server_release rabbitmq_sharding rabbitmq_shovel rabbitmq_shovel_management rabbitmq_stomp rabbitmq_toke rabbitmq_top rabbitmq_tracing rabbitmq_trust_store rabbitmq_web_dispatch rabbitmq_web_mqtt rabbitmq_web_mqtt_examples rabbitmq_web_stomp rabbitmq_web_stomp_examples rabbitmq_website _compat_rebar_config={deps, [  ]}. {erl_opts, [debug_info,warn_export_vars,warn_shadow_vars,warn_obsolete_guard]}. IS_DEP=1 REBAR_DEPS_DIR=/testbuild/deps/rabbit_common/deps IGNORE_DEPS= PWD=/testbuild/deps/rabbit_common OTP_VERSION=20.1.6 base_rmq_ref=master HOME=/root EMU=beam HOSTNAME=8d73c772b924 XREFR=mk/xrefr SHLVL=5 BINDIR=/usr/local/lib/erlang/erts-9.1.5/bin DIALYZER_PLT=/testbuild/deps/rabbit_common/.rabbit_common.plt APPS_DIR=/testbuild/deps/rabbit_common/apps ELIXIR_VERSION=v1.5.2 DEPS_DIR=/testbuild/deps/rabbit_common/deps OLDPWD=/ KERL=/testbuild/deps/rabbit_common/.erlang.mk/kerl/kerl MAKEFLAGS= MFLAGS= PLATFORM=linux ERLANG_MK_TMP=/testbuild/deps/rabbit_common/.erlang.mk PROGNAME=erl ROOTDIR=/usr/local/lib/erlang LANG=C.UTF-8 TERM=xterm MAKELEVEL=1
 ERLC   app_utils.erl code_version.erl credit_flow.erl delegate.erl delegate_sup.erl ec_semver.erl ec_semver_parser.erl file_handle_cache.erl file_handle_cache_stats.erl gen_server2.erl mirrored_supervisor.erl mnesia_sync.erl mochijson2.erl mochinum.erl mochiweb_util.erl pmon.erl priority_queue.erl rabbit_amqqueue_common.erl rabbit_auth_backend_dummy.erl rabbit_auth_mechanism.erl rabbit_authn_backend.erl rabbit_authz_backend.erl rabbit_backing_queue.erl rabbit_basic_common.erl rabbit_binary_generator.erl rabbit_binary_parser.erl rabbit_cert_info.erl rabbit_channel_common.erl rabbit_command_assembler.erl rabbit_control_misc.erl rabbit_core_metrics.erl rabbit_data_coercion.erl rabbit_error_logger_handler.erl rabbit_event.erl rabbit_exchange_type.erl rabbit_framing_amqp_0_8.erl rabbit_framing_amqp_0_9_1.erl rabbit_heartbeat.erl rabbit_log.erl rabbit_misc.erl rabbit_msg_store_index.erl rabbit_net.erl rabbit_nodes_common.erl rabbit_password_hashing.erl rabbit_pbe.erl rabbit_policy_validator.erl rabbit_queue_collector_common.erl rabbit_queue_master_locator.erl rabbit_resource_monitor_misc.erl rabbit_runtime_parameter.erl rabbit_ssl_options.erl rabbit_types.erl rabbit_writer.erl supervisor2.erl vm_memory_monitor.erl worker_pool.erl worker_pool_sup.erl worker_pool_worker.erl
 APP    rabbit_common.app.src
 ERLC  
src/ssl_compat.erl:47: Warning: ssl:connection_info/1: removed in 20.0; use ssl:connection_information/[1,2] instead
src/ssl_compat.erl:67: Warning: ssl:connection_info/1: removed in 20.0; use ssl:connection_information/[1,2] instead
awk: bad regex '{modules,': Repetition not preceded by valid expression
make[1]: *** [Makefile:82: ebin/rabbit_common.app] Error 1
make: *** [erlang.mk:4913: app] Error 2
** (Mix) Could not compile dependency :rabbit_common, "make clean && make" command failed. You can recompile this dependency with "mix deps.compile rabbit_common", update it with "mix deps.update rabbit_common" or clean it with "mix deps.clean rabbit_common"

Thanks for your help

essen commented 6 years ago

What's the output of env on the terminal where you build manually?

MarcAntoine-Arnaud commented 6 years ago

env is

HOSTNAME=532b957a8499
SHLVL=1
OLDPWD=/
HOME=/root
OTP_VERSION=20.1.6
TERM=xterm
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LANG=C.UTF-8
ELIXIR_VERSION=v1.5.2
PWD=/testbuild
essen commented 6 years ago

I got no clue I'm afraid. Can we do a last test to figure out if it's a Docker issue, an Elixir/Mix issue or a combination of both? Would involve repeating the same steps outside of Docker to see if it still happens. If it does, it's Elixir/Mix. If it doesn't, then it's either Docker or Docker+Elixir/Mix. I can probably take over after that when time allows (don't know when unfortunately).

Also if building on Docker is the only issue a workaround would be to build separately and then add the files to Docker, if that's possible. I'm not familiar with Docker and Elixir/Mix.

iamd3vil commented 6 years ago

I am also facing this issue. What solved it for me is that installing gawk (GNU Awk) package in Alpine. I think the issue is some incompatibility between Busybox Awk and GNU Awk.

essen commented 6 years ago

Cheers. I guess this warrants a note in the installation part of the guide. Thanks!

MarcAntoine-Arnaud commented 6 years ago

@iamd3vil thanks for the solution. I test it, and it works for me too. Thanks too !

queer commented 6 years ago

@iamd3vil Worked perfectly, thanks!

essen commented 6 years ago

Added the note, closing, thanks!