amidiminder
amidiminder copied to clipboard
Doesn't build on Ubuntu Studio 22.04 (i.e. g++-11)
Hi there!
I've got amidiminder working on a Libre Le Potato single board computer, running their customize Raspbian, based on Debian 11.6. I had no problems building and installing it, it seems to be working, hooray!
I'm developing the MIDI tool I'm using mostly on my Ubuntu Studio 22.04 laptop, however, a regular amd64 machine running g++ 11.3.0. When I try to build amidiminder there it fails trying to compile the rule.cpp file. It doesn't like the usage of the Parse
class, raising errors like this:
rule.cpp: In function ‘ClientSpec {anonymous}::parseClientSpec(const string&)’:
rule.cpp:168:56: error: cannot bind non-const lvalue reference of type ‘std::ostream&’ {aka ‘std::basic_ostream<char>&’} to an rvalue of type ‘std::basic_ostream<char>’
168 | throw Parse(Error() << "malformed client '" << s << "'");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
rule.cpp:159:27: note: initializing argument 1 of ‘{anonymous}::Parse::Parse(std::ostream&)’
159 | Parse(std::ostream& o) : std::string(errormsg(o)) { }
| ~~~~~~~~~~~~~~^
I don't know c++ at all, so I don't really know where to start with this. I tried removing the &
from Parse(std::ostream& o)
since the error talks about a mismatch between std::basic_ostream<char>&
and std::basic_ostream<char>
, but that also fails, with messages like this:
rule.cpp:168:62: error: ‘std::basic_ostream<_CharT, _Traits>::basic_ostream(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]’ is protected within this context
Is there an easy fix to get this to build on my laptop?
Thanks!
I figured out an (obvious in retrospect) workaround to get this working on my laptop, describing it here in case anyone else hits this issue: I installed g++-10 on my system and used that to build amidiminder. Here's the full set of steps I took:
- install g++-10 compiler (
sudo apt install g++-10
) - edit the
debian/control
file to a) changeArchitecture: armhf
toArchitecture: amd64
and delete the empty newline at the bottom of the file - cd to the amidiminder folder and build using
make CXX=g++-10 CC=g++-10
This gave me a deb file that installed onto my system and gave me a working amidiminder.
I'm leaving this issue open since it's still worth fixing, but am happy to now be able to use amidiminder in non-ARM contexts.