MantisBT - ardour
View Issue Details
0007691ardourbugspublic2018-11-24 03:342018-11-25 09:51
5.X git (version in description) 
0007691: zita-convolver cross compilation issue
While cross compiling for Windows, zita-convolver does not seem to recognize the Windows platform correctly and I have to run the following command to fix:

sed -i '1s/^/#define PTW32_VERSION\n\n/' libs/zita-convolver/zita-convolver/zita-convolver.h

A better Windows detection should be implemented.
No tags attached.
Issue History
2018-11-24 03:34aquilarubraNew Issue
2018-11-24 04:48x42Note Added: 0020476
2018-11-24 15:26timbyrNote Added: 0020479
2018-11-24 15:27timbyrNote Edited: 0020479bug_revision_view_page.php?bugnote_id=20479#r637
2018-11-24 15:38x42Note Added: 0020480
2018-11-24 15:44x42Note Added: 0020481
2018-11-24 15:58timbyrNote Added: 0020482
2018-11-24 16:07x42Note Added: 0020483
2018-11-24 16:09x42Assigned To => x42
2018-11-24 16:09x42Statusnew => feedback
2018-11-24 22:39aquilarubraNote Added: 0020484
2018-11-24 22:39aquilarubraStatusfeedback => assigned
2018-11-24 23:19aquilarubraNote Added: 0020485
2018-11-25 09:51x42Note Added: 0020488
2018-11-25 09:51x42Statusassigned => resolved
2018-11-25 09:51x42Resolutionopen => fixed

2018-11-24 04:48   
The case at hand is not to detect windows, but to detect which semaphore implementation to use. On Windows using ptw32 is the easiest.

The alternative would be to use code from libs/pbd/ We cannot use libpbd here since the convolver needs to be statically linked into plugins. Also ideally the code would go upstream to libzita-convolver.

Cross-compiling for windows works just fine (using mingw, that's what offfers). The current code also compiles with MSVC.

How does it fail in your case? What semaphore implementation do you use?
2018-11-24 15:26   
(edited on: 2018-11-24 15:27)
An issue here is that for a few years mingw-w64 and GCC itself ship with winpthreads as the pthread implementation AFAIR.

I'm not sure if it is possible to still use pthreads-win32 with GCC/mingw-w64 anymore (At least I'm not aware of anyone still doing so).

Perhaps an appropriately licensed and header only cross platform semaphore implementation could be used instead and proposed upstream. Perhaps something like: [^]

Without the C++11 only part at the bottom.

2018-11-24 15:38   
We do use pthreads-win32 with binaries from as is john with MSVC.
2018-11-24 15:44   
@timbyr: is there a compiler define when mingw provides winpthread itself?
2018-11-24 15:58   
winpthreads does provide a semaphore.h header, so I guess you could add __WINPTHREADS_VERSION to ifdef and it might work.
2018-11-24 16:07   
That sounds like a good solution. @aquilarubra could you try that?

change zita-convolver.h line 37

 ... || defined(PTW32_VERSION) || defined (__WINPTHREADS_VERSION)
2018-11-24 22:39   
Yes, I am using winpthreads. I'll try and report.
2018-11-24 23:19   
I confirm it works with || defined (__WINPTHREADS_VERSION)
2018-11-25 09:51   
Fixed in 6.0-pre0-1306-g3fd8dad9d