band115 / ecirca

Erlang circular array NIFs
Other
29 stars 4 forks source link

Compiling with clang: error: missing field 'flags' initializer [-Werror,-Wmissing-field-initializers] #39

Open mtourne opened 9 years ago

mtourne commented 9 years ago

I can get passed this previous compilation issue, mentioned here : https://github.com/band115/ecirca/issues/38

by running : ERL_CFLAGS=-I/usr/local/Cellar/erlang/17.3.4/lib/erlang/erts-6.2.1/include rebar -v compile

Now I'm getting a bunch of errors along those lines :

INFO:  sh info:
    cwd: "/Users/mtourne/dev/yawndb/deps/ecirca"
    cmd: clang -c  -std=c99 -Wall -Wextra -Werror -pedantic -g -Wall -fPIC -I/usr/local/Cellar/erlang/17.3.4/lib/erlang/erts-6.2.1/include  c_src/ecirca_small.c -o c_src/ecirca_small.o
Compiling /Users/mtourne/dev/yawndb/deps/ecirca/c_src/ecirca_small.c
/Users/mtourne/dev/yawndb/deps/ecirca/c_src/ecirca_small.c:2756:19: error: missing field 'flags' initializer [-Werror,-Wmissing-field-initializers]
    {"new", 3, new},
                  ^
/Users/mtourne/dev/yawndb/deps/ecirca/c_src/ecirca_small.c:2757:21: error: missing field 'flags' initializer [-Werror,-Wmissing-field-initializers]
    {"push", 2, push},
[...]
superbobry commented 9 years ago

This might be due to a change in Erlang NIF API, @si14 can you take a look?

mtourne commented 9 years ago

I can add to the ERL_CFLAGS : ERL_CFLAGS="-I/usr/local/Cellar/erlang/17.3.4/lib/erlang/erts-6.2.1/include -Wno-missing-field-initializers" rebar -v compile

and get to this new set of warnings :

/Users/mtourne/dev/yawndb/deps/ecirca/c_src/ecirca_small.c:1342:1: error: unused function '_OSSwapInt16' [-Werror,-Wunused-function]
_OSSwapInt16(
^
/Users/mtourne/dev/yawndb/deps/ecirca/c_src/ecirca_small.c:1351:1: error: unused function '_OSSwapInt32' [-Werror,-Wunused-function]
_OSSwapInt32(
^
/Users/mtourne/dev/yawndb/deps/ecirca/c_src/ecirca_small.c:1366:1: error: unused function '_OSSwapInt64' [-Werror,-Wunused-function]
_OSSwapInt64(
^
/Users/mtourne/dev/yawndb/deps/ecirca/c_src/ecirca_small.c:1887:32: error: unused function 'enif_make_tuple1' [-Werror,-Wunused-function]
static __inline__ ERL_NIF_TERM enif_make_tuple1(ErlNifEnv* env,
si14 commented 9 years ago

I'm sorry for a delay, I'm looking into the issue.

Looks like it's related to new rebar or GCC or both, because Travis builds repo just fine, but locally I can reproduce your warnings.

si14 commented 9 years ago

OK, the first one set of warnings (missing-field) is because of new Erlang mechanism for dirty schedulers. According to release docs, it should be fine on 17.3 already, but I'll fix it.

Regarding #38 — right now I have no idea why this happens. It looks like compiler gets called twice, second time without necessary arguments. Investigating.

Regarding the last set of warnings — no idea yet, will fix.

BTW, what are your versions of Erlang and rebar?

si14 commented 9 years ago

Can you please check if the project compiles for you now? It should do so, albeit with a couple of warnings.