[yoshimi] pthreads vs jack compilation failure

  • From: blubee blubeeme <gurenchan@xxxxxxxxx>
  • To: yoshimi@xxxxxxxxxxxxx
  • Date: Thu, 26 Oct 2017 18:36:19 +0800

when trying to build yoshimi I get this compilation error:
FAILED: CMakeFiles/yoshimi.dir/MusicIO/MusicClient.cpp.o
/usr/bin/c++   -DADD_COLOUR=0xdfafbf00 -DBASE_COLOUR=0xbfbfbf00
-DCOMMAND_SIZE=80 -DDEFAULT_AUDIO=jack_audio -DDEFAULT_MIDI=jack_midi
-DFADEIN_ADJUSTMENT_SCALE=20 -DFF_MAX_FORMANTS=12 -DFF_MAX_SEQUENCE=8
-DFF_MAX_VOWELS=6 -DHALFPI=1.57079632679f -DLOG_2=0.693147181f
-DMAX_AD_HARMONICS=128 -DMAX_ALIENWAH_DELAY=100 -DMAX_BANKS_IN_ROOT=128
-DMAX_BANK_ROOT_DIRS=128 -DMAX_ENVELOPE_POINTS=40 -DMAX_EQ_BANDS=8
-DMAX_FILTER_STAGES=5 -DMAX_HISTORY=25 -DMAX_KEY_SHIFT=36
-DMAX_PHASER_STAGES=12 -DMAX_PRESETS=1000 -DMAX_PRESET_DIRS=128
-DMAX_RESONANCE_POINTS=256 -DMAX_SUB_HARMONICS=64 -DMIDI_LEARN_BLOCK=128
-DMIN_ENVELOPE_DB=-60 -DMIN_KEY_SHIFT=-36 -DNUM_INS_EFX=8
-DNUM_KIT_ITEMS=16 -DNUM_MIDI_CHANNELS=16 -DNUM_MIDI_PARTS=64
-DNUM_PART_EFX=3 -DNUM_SYS_EFX=4 -DNUM_VOICES=8 -DPAD_COLOUR=0xcfdfaf00
-DPAD_MAX_SAMPLES=96 -DPI=3.1415926536f -DPOLIPHONY=80
-DSUB_COLOUR=0xafcfdf00 -DTWOPI=6.28318530718f -DVELOCITY_MAX_SCALE=8.0f
-DXML_BANK=7 -DXML_CONFIG=6 -DXML_HISTORY=8 -DXML_INSTRUMENT=1
-DXML_MICROTONAL=3 -DXML_MIDILEARN=10 -DXML_PARAMETERS=2 -DXML_PRESETS=4
-DXML_STATE=5 -DXML_VECTOR=9 -DYOSHIMI=\"yoshimi\" -DYOSHI_FIFO_DIR=\"\"
-I. -I/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src
-I/usr/local/include -I/usr/local/include/alsa
-I/usr/local/include/freetype2 -I/usr/local/include/cairo
-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include
-I/usr/local/include/pixman-1 -I/usr/local/include/libdrm
-I/usr/local/include/libpng16 -O2 -pipe -fstack-protector
-fno-strict-aliasing -O3 -msse -msse2 -mfpmath=sse -ffast-math
-fomit-frame-pointer   -std=gnu++11 -D'YOSHIMI_VERSION="1.5.4 M"'
-D'BASE_INSTALL_DIR="/usr/local"' -L/usr/local/lib -lasound
-L/usr/local/lib -ljack -pthread -std=gnu++11 -MD -MT
CMakeFiles/yoshimi.dir/MusicIO/MusicClient.cpp.o -MF
CMakeFiles/yoshimi.dir/MusicIO/MusicClient.cpp.o.d -o
CMakeFiles/yoshimi.dir/MusicIO/MusicClient.cpp.o -c
/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src/MusicIO/MusicClient.cpp
c++: warning: -lasound: 'linker' input unused
[-Wunused-command-line-argument]
c++: warning: -ljack: 'linker' input unused [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-L/usr/local/lib'
[-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-L/usr/local/lib'
[-Wunused-command-line-argument]
In file included from
/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src/MusicIO/MusicClient.cpp:23:
/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src/MusicIO/MusicClient.h:58:5:
error: unknown type name 'pthread_t'; did you mean 'pthread'?
    pthread_t timerThreadId;
    ^~~~~~~~~
    pthread
/usr/include/stdio.h:150:9: note: 'pthread' declared here
        struct pthread *_fl_owner;      /* current owner */
               ^
In file included from
/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src/MusicIO/MusicClient.cpp:23:
/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src/MusicIO/MusicClient.h:58:15:
error: field has incomplete type 'pthread'
    pthread_t timerThreadId;
              ^
/usr/include/stdio.h:150:9: note: forward declaration of 'pthread'
        struct pthread *_fl_owner;      /* current owner */
               ^
2 errors generated.
ninja: build stopped: subcommand failed.
*** Error code 1

Stop.
make: stopped in /usr/ports/audio/yoshimi

I head to the file: work/yoshimi-7150c23/src/MusicIO/MusicClient.h
There's no <pthread.h> so I add it as below

#ifndef MUSIC_CLIENT_H
#define MUSIC_CLIENT_H

#include <string>

using namespace std;


#include "MusicIO/MidiControl.h"
#include <pthread.h>

The compilation goes on a bit further but then fails here:
FAILED: CMakeFiles/yoshimi.dir/MusicIO/JackEngine.cpp.o
/usr/bin/c++   -DADD_COLOUR=0xdfafbf00 -DBASE_COLOUR=0xbfbfbf00
-DCOMMAND_SIZE=80 -DDEFAULT_AUDIO=jack_audio -DDEFAULT_MIDI=jack_midi
-DFADEIN_ADJUSTMENT_SCALE=20 -DFF_MAX_FORMANTS=12 -DFF_MAX_SEQUENCE=8
-DFF_MAX_VOWELS=6 -DHALFPI=1.57079632679f -DLOG_2=0.693147181f
-DMAX_AD_HARMONICS=128 -DMAX_ALIENWAH_DELAY=100 -DMAX_BANKS_IN_ROOT=128
-DMAX_BANK_ROOT_DIRS=128 -DMAX_ENVELOPE_POINTS=40 -DMAX_EQ_BANDS=8
-DMAX_FILTER_STAGES=5 -DMAX_HISTORY=25 -DMAX_KEY_SHIFT=36
-DMAX_PHASER_STAGES=12 -DMAX_PRESETS=1000 -DMAX_PRESET_DIRS=128
-DMAX_RESONANCE_POINTS=256 -DMAX_SUB_HARMONICS=64 -DMIDI_LEARN_BLOCK=128
-DMIN_ENVELOPE_DB=-60 -DMIN_KEY_SHIFT=-36 -DNUM_INS_EFX=8
-DNUM_KIT_ITEMS=16 -DNUM_MIDI_CHANNELS=16 -DNUM_MIDI_PARTS=64
-DNUM_PART_EFX=3 -DNUM_SYS_EFX=4 -DNUM_VOICES=8 -DPAD_COLOUR=0xcfdfaf00
-DPAD_MAX_SAMPLES=96 -DPI=3.1415926536f -DPOLIPHONY=80
-DSUB_COLOUR=0xafcfdf00 -DTWOPI=6.28318530718f -DVELOCITY_MAX_SCALE=8.0f
-DXML_BANK=7 -DXML_CONFIG=6 -DXML_HISTORY=8 -DXML_INSTRUMENT=1
-DXML_MICROTONAL=3 -DXML_MIDILEARN=10 -DXML_PARAMETERS=2 -DXML_PRESETS=4
-DXML_STATE=5 -DXML_VECTOR=9 -DYOSHIMI=\"yoshimi\" -DYOSHI_FIFO_DIR=\"\"
-I. -I/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src
-I/usr/local/include -I/usr/local/include/alsa
-I/usr/local/include/freetype2 -I/usr/local/include/cairo
-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include
-I/usr/local/include/pixman-1 -I/usr/local/include/libdrm
-I/usr/local/include/libpng16 -O2 -pipe -fstack-protector
-fno-strict-aliasing -O3 -msse -msse2 -mfpmath=sse -ffast-math
-fomit-frame-pointer   -std=gnu++11 -D'YOSHIMI_VERSION="1.5.4 M"'
-D'BASE_INSTALL_DIR="/usr/local"' -L/usr/local/lib -lasound
-L/usr/local/lib -ljack -pthread -std=gnu++11 -MD -MT
CMakeFiles/yoshimi.dir/MusicIO/JackEngine.cpp.o -MF
CMakeFiles/yoshimi.dir/MusicIO/JackEngine.cpp.o.d -o
CMakeFiles/yoshimi.dir/MusicIO/JackEngine.cpp.o -c
/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src/MusicIO/JackEngine.cpp
c++: warning: -lasound: 'linker' input unused
[-Wunused-command-line-argument]
c++: warning: -ljack: 'linker' input unused [-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-L/usr/local/lib'
[-Wunused-command-line-argument]
c++: warning: argument unused during compilation: '-L/usr/local/lib'
[-Wunused-command-line-argument]
/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src/MusicIO/JackEngine.cpp:342:16:
error: cannot initialize return object of type 'int' with an rvalue of type
'jack_native_thread_t' (aka 'pthread *')
        return jack_client_thread_id(jackClient);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src/MusicIO/JackEngine.cpp:509:13:
warning: 'jack_port_set_latency' is deprecated [-Wdeprecated-declarations]
        if (jack_port_set_latency && audio.ports[i])
            ^
/usr/local/include/jack/jack.h:981:6: note: 'jack_port_set_latency' has
been explicitly marked deprecated here
void jack_port_set_latency (jack_port_t *, jack_nframes_t)
JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
     ^
/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src/MusicIO/JackEngine.cpp:509:13:
warning: address of function 'jack_port_set_latency' will always evaluate
to 'true' [-Wpointer-bool-conversion]
        if (jack_port_set_latency && audio.ports[i])
            ^~~~~~~~~~~~~~~~~~~~~ ~~
/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src/MusicIO/JackEngine.cpp:509:13:
note: prefix with the address-of operator to silence this warning
        if (jack_port_set_latency && audio.ports[i])
            ^
            &
/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src/MusicIO/JackEngine.cpp:510:13:
warning: 'jack_port_set_latency' is deprecated [-Wdeprecated-declarations]
            jack_port_set_latency(audio.ports[i],
jack_get_buffer_size(jackClient));
            ^
/usr/local/include/jack/jack.h:981:6: note: 'jack_port_set_latency' has
been explicitly marked deprecated here
void jack_port_set_latency (jack_port_t *, jack_nframes_t)
JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT;
     ^
/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src/MusicIO/JackEngine.cpp:512:9:
warning: address of function 'jack_recompute_total_latencies' will always
evaluate to 'true' [-Wpointer-bool-conversion]
    if (jack_recompute_total_latencies)
    ~~  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src/MusicIO/JackEngine.cpp:512:9:
note: prefix with the address-of operator to silence this warning
    if (jack_recompute_total_latencies)
        ^
        &
4 warnings and 1 error generated.
ninja: build stopped: subcommand failed.
*** Error code 1

Stop.
make: stopped in /usr/ports/audio/yoshimi
yoshimi/work/yoshimi-7150c23/src/MusicIO/JackEngine.cpp:342:16: error:
cannot initialize return object of type 'int' with an rvalue of type
'jack_native_thread_t' (aka 'pthread *')
        return jack_client_thread_id(jackClient);

Seems that there's some casting magic going on here and I'm not exactly
sure how to get past this.

It's either failing at the pthreads or something strange happening with
casts.

Any Idea how to fix this?

Other related posts: