zmstone / crc32cer

CRC32-C Erlang NIF binding
Apache License 2.0
9 stars 7 forks source link

NIF sources not found when used as a dependency #2

Open jesperes opened 2 years ago

jesperes commented 2 years ago

When crc32cer is used as a dependency, the NIF sources are not found, and the port compiler says:

===> Found no source files for:
"c_src/*.c"

This can be worked around by doing

{overrides,
 [{override, crc32cer,
   [{port_specs, [{"priv/crc32cer_nif.so", ["${REBAR_DEPS_DIR}/crc32cer/c_src/*.c"
                                           ]}
                 ]}
   ]}
 ]}.

in the parent project, but it would be nice if this worked out-of-the-box.

zmstone commented 2 years ago

crc32cer is used in many different rebar3 projects without such issue. Which rebar3 version or pc plugin version is it in your parent project ?

jesperes commented 2 years ago

Let me see if I can get you a minimal reproducible example of this.

jesperes commented 2 years ago

To reproduce:

  1. Create an empty application:
    $ rebar3 new app myapp
  2. Add a dependency to crc32cer:
    {deps, [{crc32cer, {git, "git@github.com:zmstone/crc32cer.git", {tag, "0.1.10"}}}
       ]}.
  3. Try to build it:
    09:35 $ rebar3 compile
    ===> Fetching rebar3_format v1.0.1
    ===> Fetching katana_code v1.1.1
    ===> Analyzing applications...
    ===> Compiling katana_code
    ===> Compiling rebar3_format
    Not formatting the formatter. We're not on the regular compiling cycle
    ===> Verifying dependencies...
    ===> Fetching crc32cer (from {git,"git@github.com:zmstone/crc32cer.git",{tag,"0.1.10"}})
    ===> Fetching pc (from {git,"https://github.com/blt/port_compiler.git",{tag,"v1.10.2"}})
    ===> Analyzing applications...
    ===> Compiling pc
    ===> Found no source files for:
    "c_src/*.c"
    ===> Analyzing applications...
    ===> Compiling crc32cer
    ===> Analyzing applications...
    ===> Compiling testapp

    Note the error message.

  4. Observe that there are no *.so files built
    $ find _build | grep crc32.*so
jesperes commented 2 years ago

Upgrading to latest port_compiler v1.14.0 does not have any effect.

jesperes commented 2 years ago
$ rebar3 --version
rebar 3.18.0 on Erlang/OTP 23 Erts 11.2.2.2
jesperes commented 2 years ago

Also, https://github.com/zmstone/snappyer suffers the same problem.

rlipscombe commented 1 year ago

I'm having the same problem (I'm on macOS). The workaround, er, works for me, too.