erlang / rebar3

Erlang build tool that makes it easy to compile and test Erlang applications and releases.
http://www.rebar3.org
Apache License 2.0
1.71k stars 517 forks source link

Undefined symbols for architecture x86_64 enif_make_atom #2064

Closed mberrueta closed 5 years ago

mberrueta commented 5 years ago

Pre-Check

First sorry if is not something missing here

Environment

Rebar3 report
 version 3.10.0
 generated at 2019-05-04T10:52:46+00:00
=================
Please submit this along with your issue at https://github.com/erlang/rebar3/issues (and feel free to edit out private information, if any)
-----------------
Task:
Entered as:

-----------------
Operating System: x86_64-apple-darwin18.5.0
ERTS: Erlang/OTP 21 [erts-10.3.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]
Root Directory: /usr/local/Cellar/erlang/21.3.7/lib/erlang
Library directory: /usr/local/Cellar/erlang/21.3.7/lib/erlang/lib
-----------------
Loaded Applications:
bbmustache: 1.6.1
certifi: 2.5.1
cf: 0.2.2
common_test: 1.17.1
compiler: 7.3.2
crypto: 4.4.2
cth_readable: 1.4.3
dialyzer: 3.3.2
edoc: 0.10
erlware_commons: 1.3.1
eunit: 2.3.7
eunit_formatters: 0.5.0
getopt: 1.0.1
hipe: 3.18.3
inets: 7.0.7
kernel: 6.3.1
providers: 1.7.0
public_key: 1.6.5
relx: 3.31.0
sasl: 3.3
snmp: 5.2.12
ssl_verify_fun: 1.1.4
stdlib: 3.8.1
syntax_tools: 2.1.7
tools: 3.1

-----------------
Escript path: /Users/matiasberrueta/.mix/rebar3
Providers:
  app_discovery as clean compile compile cover ct deps dialyzer do edoc escriptize eunit get-deps help install install_deps list lock new path pkgs release relup report repos shell state tar tree unlock update upgrade upgrade upgrade version xref
...

Current behaviour

Trying to update https://github.com/deadtrickster/prometheus_process_collector I clean deps and now I'm not longer able to compile because it fail with enif_make missing dependency (tried prev versions too) so not sure if is something missing here https://www.rebar3.org/docs/building-cc (sorry if not)

env DEBUG=1  mix deps.compile prometheus_process_collector
===> 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 prometheus_process_collector
===> sh info:
    cwd: "/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector"
    cmd: make -C c_src

===>    opts: [use_stdout,
               {cd,"/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector"},
               {env,[{"REBAR_DEPS_DIR",
                      "/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/_build/default/lib"},
                     {"REBAR_BUILD_DIR",
                      "/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/_build/default"},
                     {"REBAR_ROOT_DIR",
                      "/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/."},
                     {"REBAR_CHECKOUTS_DIR",
                      "/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/_checkouts"},
                     {"REBAR_PLUGINS_DIR",
                      "/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/_build/default/plugins"},
                     {"REBAR_GLOBAL_CONFIG_DIR",
                      "/Users/matiasberrueta/.config/rebar3"},
                     {"REBAR_GLOBAL_CACHE_DIR",
                      "/Users/matiasberrueta/.cache/rebar3"},
                     {"REBAR_TEMPLATE_DIR",
                      "/Users/matiasberrueta/.config/rebar3/templates"},
                     {"REBAR_APP_DIRS",
                      "/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/_build/default/apps/*:/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/_build/default/lib/*:/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/_build/default/."},
                     {"REBAR_SRC_DIRS",[]},
                     {"ERLANG_ERTS_VER","10.3.4"},
                     {"ERLANG_ROOT_DIR",
                      "/usr/local/Cellar/erlang/21.3.7/lib/erlang"},
                     {"ERL",
                      "/usr/local/Cellar/erlang/21.3.7/lib/erlang/bin/erl"},
                     {"ERLC",
                      "/usr/local/Cellar/erlang/21.3.7/lib/erlang/bin/erlc"},
                     {"ERLANG_ARCH","64"},
                     {"ERLANG_TARGET","21.3.7-x86_64-apple-darwin18.5.0-64"},
                     {"ERLANG_LIB_DIR_erl_interface",
                      "/usr/local/Cellar/erlang/21.3.7/lib/erlang/lib/erl_interface-3.11.2"},
                     {"ERLANG_LIB_VER_erl_interface","3.11.2"}]},
               {abort_on_error,"Hook for compile failed!\n"}]

===> Port Cmd: make -C c_src
Port Opts: [{cd,"/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector"},
            {env,[{"REBAR_DEPS_DIR",
                   "/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/_build/default/lib"},
                  {"REBAR_BUILD_DIR",
                   "/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/_build/default"},
                  {"REBAR_ROOT_DIR",
                   "/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/."},
                  {"REBAR_CHECKOUTS_DIR",
                   "/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/_checkouts"},
                  {"REBAR_PLUGINS_DIR",
                   "/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/_build/default/plugins"},
                  {"REBAR_GLOBAL_CONFIG_DIR",
                   "/Users/matiasberrueta/.config/rebar3"},
                  {"REBAR_GLOBAL_CACHE_DIR",
                   "/Users/matiasberrueta/.cache/rebar3"},
                  {"REBAR_TEMPLATE_DIR",
                   "/Users/matiasberrueta/.config/rebar3/templates"},
                  {"REBAR_APP_DIRS",
                   "/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/_build/default/apps/*:/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/_build/default/lib/*:/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/_build/default/."},
                  {"REBAR_SRC_DIRS",[]},
                  {"ERLANG_ERTS_VER","10.3.4"},
                  {"ERLANG_ROOT_DIR",
                   "/usr/local/Cellar/erlang/21.3.7/lib/erlang"},
                  {"ERL","/usr/local/Cellar/erlang/21.3.7/lib/erlang/bin/erl"},
                  {"ERLC",
                   "/usr/local/Cellar/erlang/21.3.7/lib/erlang/bin/erlc"},
                  {"ERLANG_ARCH","64"},
                  {"ERLANG_TARGET","21.3.7-x86_64-apple-darwin18.5.0-64"},
                  {"ERLANG_LIB_DIR_erl_interface",
                   "/usr/local/Cellar/erlang/21.3.7/lib/erlang/lib/erl_interface-3.11.2"},
                  {"ERLANG_LIB_VER_erl_interface","3.11.2"}]},
            exit_status,
            {line,16384},
            use_stdio,stderr_to_stdout,hide,eof]

cc /Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/c_src/prometheus_process_collector_nif.o /Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/c_src/prometheus_process_collector_backend.o -L/usr/local/opt/openssl/lib -shared -L /usr/local/Cellar/erlang/21.3.7/lib/erlang/lib/erl_interface-3.11.2/lib -lerl_interface -lei -o /Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/c_src/../priv/prometheus_process_collector.so
Undefined symbols for architecture x86_64:
  "_enif_get_int", referenced from:
      _get_process_info in prometheus_process_collector_nif.o
  "_enif_make_atom", referenced from:
      _on_load in prometheus_process_collector_nif.o
  "_enif_make_badarg", referenced from:
      _get_process_info in prometheus_process_collector_nif.o
  "_enif_make_double", referenced from:
      _get_process_info in prometheus_process_collector_nif.o
  "_enif_make_int", referenced from:
      _get_process_info in prometheus_process_collector_nif.o
  "_enif_make_list_from_array", referenced from:
      _get_process_info in prometheus_process_collector_nif.o
  "_enif_make_long", referenced from:
      _get_process_info in prometheus_process_collector_nif.o
  "_enif_make_tuple", referenced from:
      _get_process_info in prometheus_process_collector_nif.o
  "_enif_make_ulong", referenced from:
      _get_process_info in prometheus_process_collector_nif.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/matiasberrueta/code/p/w/deps/prometheus_process_collector/c_src/../priv/prometheus_process_collector.so] Error 1
===> Hook for compile failed!

** (Mix) Could not compile dependency :prometheus_process_collector, "/Users/matiasberrueta/.mix/rebar3 bare compile --paths "/Users/matiasberrueta/code/p/w/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile prometheus_process_collector", update it with "mix deps.update prometheus_process_collector" or clean it with "mix deps.clean prometheus_process_collector"
matiasberrueta@mac:~/c/p/w|master✓

Expected behaviour

Describe what you expected to happen.

ferd commented 5 years ago

This is an error in the make -C c_src command that Prometheus calls as part of its build process. I would expect this error to be unrelated to the build tool at hand. I would first start by opening an issue on the prometheus repository, since it appears the error is entirely outside the scope of rebar3 as a build tool.

mberrueta commented 5 years ago

perfect, I thought that, but wasn't sure. thanks man!