Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Will not compile under Fedora #5

Closed
VanAxe opened this issue Jun 19, 2016 · 4 comments
Closed

Will not compile under Fedora #5

VanAxe opened this issue Jun 19, 2016 · 4 comments

Comments

@VanAxe
Copy link

VanAxe commented Jun 19, 2016

I tried compiling under Fedora 23 and consistently get the following error :

[VanAxe:~/src/ex-portmidi]$ mix.compile
cc -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter -I/usr/local/lib/erlang/erts-7.3/include -fPIC -shared  -o priv/portmidi_in.so -lportmidi src/portmidi_in.c src/portmidi_shared.c
src/portmidi_in.c: In function ‘load’:
src/portmidi_in.c:18:23: warning: unused variable ‘flags’ [-Wunused-variable]
   ErlNifResourceFlags flags = ERL_NIF_RT_CREATE | ERL_NIF_RT_TAKEOVER;
                       ^
src/portmidi_in.c: In function ‘do_read’:
src/portmidi_in.c:74:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   int bufferSize = enif_make_int(env, argv[2]);
   ^
src/portmidi_in.c:77:3: warning: ISO C90 forbids variable length array ‘events’ [-Wvla]
   ERL_NIF_TERM events[numEvents];
   ^
src/portmidi_in.c:78:3: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
   for(int i = 0; i < numEvents; i++) {
   ^
src/portmidi_in.c:78:3: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
src/portmidi_in.c: At top level:
src/portmidi_in.c:107:3: warning: missing initializer for field ‘flags’ of ‘ErlNifFunc {aka struct <anonymous>}’ [-Wmissing-field-initializers]
   {"do_open",  1, do_open},
   ^
In file included from src/portmidi_in.c:2:0:
/usr/local/lib/erlang/erts-7.3/include/erl_nif.h:109:14: note: ‘flags’ declared here
     unsigned flags;
              ^
src/portmidi_in.c:108:3: warning: missing initializer for field ‘flags’ of ‘ErlNifFunc {aka struct <anonymous>}’ [-Wmissing-field-initializers]
   {"do_poll",  1, do_poll},
   ^
In file included from src/portmidi_in.c:2:0:
/usr/local/lib/erlang/erts-7.3/include/erl_nif.h:109:14: note: ‘flags’ declared here
     unsigned flags;
              ^
src/portmidi_in.c:109:3: warning: missing initializer for field ‘flags’ of ‘ErlNifFunc {aka struct <anonymous>}’ [-Wmissing-field-initializers]
   {"do_read",  2, do_read},
   ^
In file included from src/portmidi_in.c:2:0:
/usr/local/lib/erlang/erts-7.3/include/erl_nif.h:109:14: note: ‘flags’ declared here
     unsigned flags;
              ^
src/portmidi_in.c:110:3: warning: missing initializer for field ‘flags’ of ‘ErlNifFunc {aka struct <anonymous>}’ [-Wmissing-field-initializers]
   {"do_close", 1, do_close}
   ^
In file included from src/portmidi_in.c:2:0:
/usr/local/lib/erlang/erts-7.3/include/erl_nif.h:109:14: note: ‘flags’ declared here
     unsigned flags;
              ^
Makefile:17: recipe for target 'priv/portmidi_in.so' failed
make: *** [priv/portmidi_in.so] Error 1
** (Mix.Error) could not run `make`. Do you have make, gcc and libportmidi installed?
    mix.exs:47: Mix.Tasks.Compile.PortMidi.run/1
    (elixir) lib/enum.ex:1088: Enum."-map/2-lists^map/1-0-"/2
    (mix) lib/mix/tasks/compile.all.ex:19: anonymous fn/1 in Mix.Tasks.Compile.All.run/1
    (mix) lib/mix/tasks/compile.all.ex:37: Mix.Tasks.Compile.All.with_logger_app/1
    (mix) lib/mix/tasks/compile.ex:88: Mix.Tasks.Compile.run/1
    (mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2

Some context :

uname -a
Linux 4.5.6-200.fc23.x86_64 #1 SMP Wed Jun 1 21:28:20 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
Elixir 1.2.6
Mix 1.2.6

I also had the same error compiling on an i386 platform with Fedora 23.

@lucidstack
Copy link
Owner

Hi there, thanks for trying out ex-portmidi! From the logs, it seems that your gcc doesn't default to c99 or c11. I've pushed a branch where I've added the c99 flag to the Makefile.

Could you give it a try? Just put this in your mix.exs file 😄

  defp deps do
    [{:portmidi, github: "lucidstack/ex-portmidi", branch: "makefile-with-c99"}]
  end

@VanAxe
Copy link
Author

VanAxe commented Jun 22, 2016

Thank you so much! (I'm quite clueless with C. -_-: ) It compiles! (I don't a midi keyboard handy anything to actually test, but it does list the default ALSA IO if I poll PortMidi.devices() Much horrays!

@lucidstack
Copy link
Owner

Nice! I'll merge that into master, and release a new version on Hex. Thanks a lot for reporting this! 🙇

@lucidstack
Copy link
Owner

Now on Hex! https://hex.pm/packages/portmidi/5.0.1 🎉 👋

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants