Forums

Problem with rtmidi

Got the following error while pulling rtmidi.

The fix for this from what I understand is to install libasound2. However, since I can't use sudo, what is the alternative for this?

Thanks Chaoxin

  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -D__LINUX_ALSA__ -D__UNIX_JACK__ -Isrc/rtmidi -I/usr/include/python3.5m -c src/_rtmidi.cpp -o build/temp
.linux-x86_64-3.5/src/_rtmidi.o
  cc1plus: warning: command line option -Wstrict-prototypes is valid for C/ObjC but not for C++
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -D__LINUX_ALSA__ -D__UNIX_JACK__ -Isrc/rtmidi -I/usr/include/python3.5m -c src/rtmidi/RtMidi.cpp -o buil
d/temp.linux-x86_64-3.5/src/rtmidi/RtMidi.o
  cc1plus: warning: command line option -Wstrict-prototypes is valid for C/ObjC but not for C++
  src/rtmidi/RtMidi.cpp:2883:23: fatal error: jack/jack.h: No such file or directory
  compilation terminated.
  error: command 'gcc' failed with exit status 1

[edit by admin: formatting]

From the docs for RtMidi it looks like Jack is an alternative to asound. You might be able to download and compile it from its home page, though you'd need to know how compile C++ code.

I can compile the c++ but how do I get it into the environment to let Python recognized?

You'll need to pass in an include path and a library path to the command you are using to install them. Are you using pip?

So you mean compile it and pip it in? Have not done this Before. Any link for a guide? Do I need to put it on a server I guess? Github works?

Thanks Chaoxin

Sorry, I think I may have misunderstood. How are you installing rtmidi?

It's part of the pakacage I am piping from magenta. It always breaks when it tries to install rtmidi.

I looked up the rtmidi forum and they suggested that I need install libasound2 via sudo, but sudo is not supported.

OK, so if you're using pip, you can use its --global-option flag; this allows you to pass flags down the setup.py inside the pip package, which in turn means that they can be used by the C compiler.

The C compiler uses its -I option along with a colon-separated path to specify directories for include files, and -L for library files, and setup.py will pass those along.

All this means that if you've downloaded and compiled Jack to /home/chaoxin/jack, and it has put its include files in /home/chaoxin/jack/include and the libraries inside /home/chaoxin/jack/lib, you should be able to install the package by doing

pip3.6 install --user yourpackage --global-option="-L/home/chaoxin/jack/lib" --global-option="-I/home/chaoxin/jack/include"

Thanks. Let me give a try and I might come back for more questions.

OK, great!