View Issue Details

IDProjectCategoryView StatusLast Update
0007691ardourbugspublic2020-04-19 20:18
Reporteraquilarubra Assigned Tox42  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformx86_64OSWindowsOS Version10
Product Version5.X git (version in description) 
Summary0007691: zita-convolver cross compilation issue
DescriptionWhile 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.
TagsNo tags attached.

Activities

x42

2018-11-24 12:48

administrator   ~0020476

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/semutils.cc. 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 nightly.ardour.org offfers). The current code also compiles with MSVC.

How does it fail in your case? What semaphore implementation do you use?

timbyr

2018-11-24 23:26

developer   ~0020479

Last edited: 2018-11-24 23: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:

https://github.com/preshing/cpp11-on-multicore/blob/master/common/sema.h

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

x42

2018-11-24 23:38

administrator   ~0020480

We do use pthreads-win32 with binaries from ardour.org as is john with MSVC.

x42

2018-11-24 23:44

administrator   ~0020481

@timbyr: is there a compiler define when mingw provides winpthread itself?

timbyr

2018-11-24 23:58

developer   ~0020482

winpthreads does provide a semaphore.h header, so I guess you could add __WINPTHREADS_VERSION to ifdef and it might work.

x42

2018-11-25 00:07

administrator   ~0020483

That sounds like a good solution. @aquilarubra could you try that?

change zita-convolver.h line 37

 ... || defined(PTW32_VERSION) || defined (__WINPTHREADS_VERSION)

aquilarubra

2018-11-25 06:39

reporter   ~0020484

Yes, I am using winpthreads. I'll try and report.

aquilarubra

2018-11-25 07:19

reporter   ~0020485

I confirm it works with || defined (__WINPTHREADS_VERSION)

x42

2018-11-25 17:51

administrator   ~0020488

Fixed in 6.0-pre0-1306-g3fd8dad9d

system

2020-04-19 20:18

developer   ~0023786

Issue has been closed automatically, by Trigger Close Plugin.
Feel free to re-open with additional information if you think the issue is not resolved.

Issue History

Date Modified Username Field Change
2018-11-24 11:34 aquilarubra New Issue
2018-11-24 12:48 x42 Note Added: 0020476
2018-11-24 23:26 timbyr Note Added: 0020479
2018-11-24 23:27 timbyr Note Edited: 0020479
2018-11-24 23:38 x42 Note Added: 0020480
2018-11-24 23:44 x42 Note Added: 0020481
2018-11-24 23:58 timbyr Note Added: 0020482
2018-11-25 00:07 x42 Note Added: 0020483
2018-11-25 00:09 x42 Assigned To => x42
2018-11-25 00:09 x42 Status new => feedback
2018-11-25 06:39 aquilarubra Note Added: 0020484
2018-11-25 06:39 aquilarubra Status feedback => assigned
2018-11-25 07:19 aquilarubra Note Added: 0020485
2018-11-25 17:51 x42 Note Added: 0020488
2018-11-25 17:51 x42 Status assigned => resolved
2018-11-25 17:51 x42 Resolution open => fixed
2020-04-19 20:18 system Note Added: 0023786
2020-04-19 20:18 system Status resolved => closed