How to build? Makefile does not work
Created by: baderas
Hi,
I am trying to build dalmatinerdb on Debian Jessie as explained on https://dalmatiner.io/docs/installation.html#from-sorce, but the Makefile does not work. I installed Erlang (version 17.3) and rebar (gcc and make are installed). That should satisfy all needed dependencies ("Erlang > R16B3, Make, GCC"). I cloned the git repository and tried to run 'make deps all rel', which did not work since there is not deps hook. Then I tried 'make' alone, which ended in:
===> Compiling /home/vagrant/dalmatinerdb/_build/default/lib/mmath/c_src/bin_nif.c
===> /home/vagrant/dalmatinerdb/_build/default/lib/mmath/c_src/bin_nif.c: In function ‘to_list’:
/home/vagrant/dalmatinerdb/_build/default/lib/mmath/c_src/bin_nif.c:36:3: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (unsigned i = 0 ; i < count; i++) {
^
/home/vagrant/dalmatinerdb/_build/default/lib/mmath/c_src/bin_nif.c:36:3: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
/home/vagrant/dalmatinerdb/_build/default/lib/mmath/c_src/bin_nif.c:38:7: warning: implicit declaration of function ‘htonll’ [-Wimplicit-function-declaration]
last = FROM_DDB(vs[i]);
^
/home/vagrant/dalmatinerdb/_build/default/lib/mmath/c_src/bin_nif.c: In function ‘from_list’:
/home/vagrant/dalmatinerdb/_build/default/lib/mmath/c_src/bin_nif.c:71:3: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (int i = 0; i < count; i++) {
^
/home/vagrant/dalmatinerdb/_build/default/lib/mmath/c_src/bin_nif.c:76:5: warning: implicit declaration of function ‘ntohll’ [-Wimplicit-function-declaration]
target[i] = TO_DDB(v);
^
/home/vagrant/dalmatinerdb/_build/default/lib/mmath/c_src/bin_nif.c: In function ‘realize’:
/home/vagrant/dalmatinerdb/_build/default/lib/mmath/c_src/bin_nif.c:100:3: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (int i = 0; i < count; i++) {
^
/home/vagrant/dalmatinerdb/_build/default/lib/mmath/c_src/bin_nif.c:104:9: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (int j = 0; j < i; j++) {
^
/home/vagrant/dalmatinerdb/_build/default/lib/mmath/c_src/bin_nif.c: At top level:
/home/vagrant/dalmatinerdb/_build/default/lib/mmath/c_src/bin_nif.c:115:1: warning: return type defaults to ‘int’ [-Wreturn-type]
derealize(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
^
/home/vagrant/dalmatinerdb/_build/default/lib/mmath/c_src/bin_nif.c: In function ‘derealize’:
/home/vagrant/dalmatinerdb/_build/default/lib/mmath/c_src/bin_nif.c:131:3: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (int i = 0; i < count; i++) {
^
/home/vagrant/dalmatinerdb/_build/default/lib/mmath/c_src/bin_nif.c: At top level:
/home/vagrant/dalmatinerdb/_build/default/lib/mmath/c_src/bin_nif.c:143:3: warning: initialization from incompatible pointer type
{"derealize", 1, derealize}
^
/home/vagrant/dalmatinerdb/_build/default/lib/mmath/c_src/bin_nif.c:143:3: warning: (near initialization for ‘nif_funcs[3].fptr’)
Makefile:20: recipe for target 'compile' failed
make: *** [compile] Error 1
Any idea how to fix this?
I also tried https://github.com/dalmatinerdb/dalmatinerdb/archive/0.1.0.tar.gz, but make complains:
cp hooks/* .git/hooks
cp: cannot create regular file ‘.git/hooks’: No such file or directory
Makefile:11: recipe for target 'cp-hooks' failed
make: *** [cp-hooks] Error 1
After 'mkdir .git' it stucks at the same error as the actual git checkout.
I think somehow C99 must be set (-std=c99), but I don't know how to fix this in combination with rebar.