[yoshimi] Re: pthreads vs jack compilation failure

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

I worked through this issue by adding an #include <pthread.h> in
work/yoshimi-7150c23/src/MusicIO/MusicClient.h

/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);

I had to cast it as a long, here's another diff file:
--- work/yoshimi-7150c23/src/MusicIO/JackEngine.cpp.orig 2017-10-26
18:46:22.887622000 +0800
+++ work/yoshimi-7150c23/src/MusicIO/JackEngine.cpp 2017-10-26
18:46:36.175871000 +0800
@@ -339,7 +339,7 @@
 int JackEngine::clientId(void)
 {
     if (jackClient)
-        return jack_client_thread_id(jackClient);
+        return (long)jack_client_thread_id(jackClient);
     else
         return -1;
 }


That seems to sort out that issue but there seems to be a bigger issue that
I am not sure is so easily overcome.

FAILED: CMakeFiles/yoshimi.dir/MusicIO/AlsaEngine.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  -std=gnu++11 -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/AlsaEngine.cpp.o -MF
CMakeFiles/yoshimi.dir/MusicIO/AlsaEngine.cpp.o.d -o
CMakeFiles/yoshimi.dir/MusicIO/AlsaEngine.cpp.o -c
/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src/MusicIO/AlsaEngine.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/AlsaEngine.cpp:491:22:
error: duplicate case value '-32'
                case -ESTRPIPE:
                     ^
/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src/MusicIO/AlsaEngine.cpp:487:22:
note: previous case defined here
                case -EPIPE:
                     ^
/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src/MusicIO/AlsaEngine.cpp:522:14:
error: duplicate case value '-32'
        case -EPIPE:
             ^
/usr/ports/audio/yoshimi/work/yoshimi-7150c23/src/MusicIO/AlsaEngine.cpp:516:14:
note: previous case defined here
        case -ESTRPIPE:
             ^
2 errors generated.
ninja: build stopped: subcommand failed.
*** Error code 1

There's two issues with this
1) FreeBSD uses <sys/endian.h> which is different than linux <endian.h>
Here's a thread on FreeDesktop bugzilla:
https://bugs.freedesktop.org/show_bug.cgi?id=73786

2) It seems that those errors are being brought in twice, FreeBSD uses
<errno.h> while linux uses something else.

I am not sure how deeply yoshimi relies on <endian.h> and if those
functions can be emulated on FreeBSD. I did find the github zynaddsubfx and
their AlsaEngine.cpp looks different:
https://github.com/zynaddsubfx/zynaddsubfx/blob/8d7d52284878b552a9cc752ed19156997d531e56/src/Nio/AlsaEngine.cpp

Depending on how much your code relies on <endian.h> and why are those
error codes colliding like that. The error code collision could be debugged
but the <endian.h> could be a real issue if you rely heavily on it for your
project.

What functions do you use from <endian.h>

On Thu, Oct 26, 2017 at 8:41 PM, Will Godfrey <willgodfrey@xxxxxxxxxxxxxxx>
wrote:

On Thu, 26 Oct 2017 18:36:19 +0800
blubee blubeeme <gurenchan@xxxxxxxxx> wrote:

<snip>

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?

This of course works perfectly on debian, fedora, etc. linux :/

It looks like another compiler issue. I remember we had big problems moving
between gcc4 and gcc5/6. Again, it looks as if your compiler is more
demanding.

I haven't got any immediate suggestions at the moment. I don't know if
Andrew
has time to look at it - he sorted out most of the gcc ones!

--
Will J Godfrey
http://www.musically.me.uk
Say you have a poem and I have a tune.
Exchange them and we can both have a poem, a tune, and a song.
Yoshimi source code is available from either: https://sourceforge.net/
projects/yoshimi
Or: https://github.com/Yoshimi/yoshimi
Our list archive is at: https://www.freelists.org/archive/yoshimi
To post, email to yoshimi@xxxxxxxxxxxxx

Other related posts: