milkytracker / MilkyTracker

An FT2 compatible music tracker
http://milkytracker.github.io/
Other
1.67k stars 160 forks source link

Illegal instruction error on startup for Linux #318

Closed FConnuli closed 1 year ago

FConnuli commented 1 year ago

program crashed on startup with this output after building from a repo clone:

Available Renderers: opengl opengles2 software 
Vendor     : AMD
Renderer   : AMD Radeon RX 6600 XT (navi23, LLVM 15.0.7, DRM 3.52, 6.4.1-arch1-1)
Version    : OpenGL ES 3.2 Mesa 23.1.3
SDL: Minimum window size set to 640x480.
SDL: Using accelerated renderer.
SDL: Renderer supports rendering to texture.
0 0
SDL: Using audio driver: pulseaudio
SDL: Buffer size = 2048 samples (requested 2048)
MIDI: scanning input ports:
MIDI:  0. Midi Through:Midi Through Port-0 14:0

Crashed with signal 4
Please submit a bug report stating exactly what you were doing at the time of the crash, as well as the above signal number. Also note if it is possible to reproduce this crash.

A backup has been saved to /home/frankie/BACKUP01.XM

Illegal instruction (core dumped)

Running it through gdb showed the illegal instruction occurred in MidiReceiver::countPorts()

upon reviewing the function:

unsigned int MidiReceiver::countPorts()
{
    midiin = new RtMidiIn();
    unsigned int nPorts = midiin->getPortCount();
    std::cout << "MIDI: scanning input ports:\n";   
    for ( unsigned i=0; i<nPorts; i++ ) {
        std::string portName = midiin->getPortName(i);  
        std::cout << "MIDI:  " << i << ". " << portName << '\n';
    }
    delete midiin;
    midiin = NULL;
}

it appears to be missing a return. Adding return 0; prevented the error for me.