[erlang-questions] Building C code in dep with rebar3: c_src not found

Igor Clark igor.clark@REDACTED
Wed Jan 23 20:35:50 CET 2019


Hi everyone,

I have an simple app which has a C port in it. I have a rebar.config from which it builds correctly when I run 'rebar3 compile' inside the app directory:

> { erl_opts, [debug_info] }.
> { deps, [] }.
> 
> { plugins, [
> 	{ pc, { git, "https://github.com/blt/port_compiler.git", { tag, "v1.10.1" } } }
> ] }.
> 
> { provider_hooks, [
> 	{ pre, [
> 		{ compile, { pc, compile }},
> 		{ clean, { pc, clean }}
> 	] }
> ] }.
> 
> { port_specs, [
> 	{ "priv/bin/my_port_binary", [
> 		"c_src/my_c_file.1.c",
> 		"c_src/subdir/my_c_file_2.c"
> 	] }
> ] }.
> 
> { port_env, [
> 	{ "CFLAGS", "$CFLAGS -Ic_src/ -g -Wall -Werror -O2" }
> ] }.


Compiling this works fine. The artifact is created in priv/bin, and running myapp:module_info() inside the shell shows the right details.

However, when I try to include this app as a dependency, I get this error:

> ===> Found no source files for:
> "c_src/my_c_file.1.c"
> ===> Found no source files for:
> "c_src/subdir/my_c_file_2.c"


I've included src, c_src and rebar.config in the 'files' entry in src/my_app.app.src.

I've also included a jiffy dep as a test to make sure C code gets built correctly, and that works fine, but I can't see what jiffy's config has that I don't.

Anyone know what I'm missing to make this work?

Thanks very much!
Igor


More information about the erlang-questions mailing list