This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add OSS module support for Solaris
Type: enhancement Stage:
Components: Extension Modules Versions: Python 3.3
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: jcea Nosy List: brian-cameron-oracle, enchanter, jcea, trent, wiedi
Priority: normal Keywords: patch

Created on 2013-01-09 08:27 by brian-cameron-oracle, last changed 2022-04-11 14:57 by admin.

Files
File name Uploaded Description Edit
ossaudiodev.patch brian-cameron-oracle, 2013-01-09 08:27 Patch fixing issue
Messages (15)
msg179424 - (view) Author: (brian-cameron-oracle) Date: 2013-01-09 08:27
Solaris supports OSS, but the attached patch is needed to get it to build.

Note that some of the EXPORT_INT lines in Modules/ossaudiodev.c need to be
#ifndef'ed out on Sun since OSS on Solaris doesn't support them all. 

Does it make sense to use #ifndef like this, or should each EXPORT_INT be encapsulated by its own #ifdef?
msg179452 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2013-01-09 15:30
Brian, is this supported in Solaris 10 or Solaris 11?.

How can I actually try it?. I use Solaris on servers, and have Solaris 10/11 virtual machines in my laptop but never ever used sound under Solaris...

Also, I am unsure about this being a new feature (available in future Python 3.4) or a bugfix (to be available on 2.7, 3.2, 3.3 and 3.4). Opinions?
msg179468 - (view) Author: (brian-cameron-oracle) Date: 2013-01-09 16:14
OSS is the default audio system in Solaris 11 and 12.  In Solaris 10 and earlier, the sunaudio (or SADA) interfaces are still used.  You can only test this if you are using Solaris 11 or later, on a machine with a sound card supported by OSS.

I would say this is really more of a bugfix.  The main problem is that the configure script was avoiding even trying to build the OSS module on Solaris, and that the code only builds if the ioctls unsupported on Solaris are #ifdef'ed out on Solaris.  So it would make sense to support the ability to build the OSS module in 2.7, 3.x and onwards.
msg179471 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2013-01-09 16:25
Brian, then this module should be compiled only under Solaris 11 and up and, presumably, OpenSolaris/Illumos derivatives.

Does your patch compiles cleanly under previous Solaris versions?.

I am +1 to consider this a bugfix. Any other python-dev opinion?

PS: My virtual machines are configured with AC97 sound. Is that supported under Solaris 11?.
msg179474 - (view) Author: (brian-cameron-oracle) Date: 2013-01-09 16:37
Correct, OSS should work out-of-the-box on Solaris 11 and up since it is
the default audio system there.  OSS was also integrated into OpenSolaris, so it is probably the most sensible audio plugin to use there also.  Some end-users may build and install their own OSS code on Solaris 10 or earlier, so it should not hurt to try and build the OSS plugin even on older versions of Solaris. 

Also, I'm not sure if the way I'm doing the #ifndef's in the patch is right.  Looking at the rest of the code, I see that each EXPORT_INT is
surrounded by its own #ifdef.  I added similar #ifdef's around SNDCTL_DSP_BIND_CHANNEL SNDCTL_DSP_MAPINBUF, and SNDCTL_DSP_MAPOUTBUF.
However I just put "#ifndef __sun" around the SNDCTL_COPR_* and
SNDCTL_DSP_* ioctls because it seemed to make the patch more simple.
But, I'm not sure this was the right decision.  Maybe it just might be
more consistent to use an #ifdef around each one separately.
msg179477 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2013-01-09 17:08
The problem with your approach is that different Solaris release could support different flags. So I rather prefer specific #ifdef's.

I wonder about compiling OSS module under Solaris without OSS support. Compiling a module acting as "NULL" is OK, compiling a node that will crash on import, for instance, it is not.
msg179478 - (view) Author: (brian-cameron-oracle) Date: 2013-01-09 17:17
Sure, doing multiple #ifdef's makes sense.  Do you need me to provide an updated patch, or is this something easier for someone who has commit access to the source code repository to just go ahead and do.

I would think this Module would fail to compile if OSS isn't present, no?  So I guess I do not understand your comment about this possibly causing any sort of crash on import at runtime.

The Modules/ossaudiodev.c file should not compile if 
/usr/include/sys/soundcard.h isn't available with OSS definitions.  It wouldn't be on Solaris 10 or earlier.  Is it okay to try and compile this plugin and let it fail if it does?  Or does the configure script need to check this first and only try building it on Solaris 11 or later?
msg179499 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2013-01-09 23:33
Brian, this patch would try to compile OSS module on any Solaris machine, even if not OSS support is provided. That is, compilation would fail in that case. That is not acceptable. Some kind of OSS detection is needed.
msg179505 - (view) Author: (brian-cameron-oracle) Date: 2013-01-10 00:41
I'm not sure how to write such OSS detection code.  I do know that
OSS is only on Solaris systems that have this OSS-specific file:

/usr/include/sys/soundcard.h

So that's probably the best way to check and it should work even on Solaris 10 if OSS is already installed by the end-user.
msg179506 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2013-01-10 00:58
Brian, Linux has that include file too. So, yes, I think that detection would be appropiate. If we could confirm that all platforms with OSS support have that file, we could have something :-).

If not, or we are not sure, just check for that file *IF* the platform is "sunos5.

Could you possibly provide a new patch with that test and independent #ifdef's?

I am assigning this issue to me. Lets move :-).
msg179507 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2013-01-10 00:59
For user installed packages, the usual path would be "/usr/local/include/sys/soundcard.h". So, maybe check both paths. Do you agree?
msg179582 - (view) Author: (brian-cameron-oracle) Date: 2013-01-10 18:17
Since Modules/ossaudiodev.c has the following line (which is not surrounded by any conditional #ifdef sort of things):

#include <sys/soundcard.h>

This means that the OSS plugin will only build on a system that has this header file, so it is safe to check for on any system.  How can the Module code build if the header can't be found?

The code will only compile if the CFLAGS used when building the
module is setup to include /usr/include or /usr/local/include, but
this is normally taken care of by default.

If users need to specify their OSS headers are in some weird 
non-standard location, then they can use CFLAGS or other Makefile mechanisms to specify the compiler arguments they would then need to build anything that uses their non-standard OSS.

Or am I just confused by your question?
msg195935 - (view) Author: Tim Mooney (enchanter) Date: 2013-08-23 00:18
For what it's worth, I've been using a patch nearly identical to this one with python 2.6.x and 2.7.x with good success, and in my case it was under Solaris 10 with the no-cost "oss" package from 4Front.  I now have a new workstation and I've installed OpenIndiana (one of the OpenSolaris derivatives) on it, so I've had to revisit my patch slightly to get it to work with Python 2.7.5.

It causes no real harm to attempt to build ossaudiodev even on earlier Solaris platforms that don't have the package installed.  With Brian's patch or mine, the build reports that it expected to build ossaudiodev but that build failed.  There are other modules that setup.py expects to have work on Solaris that do not, so this is not the first instance of trying something only to have it gracefully fail.  It's really no different from what's being done with linux -- setup.py attempts to build ossaudiodev for all Linux distributions, even though some of them have ripped out support for OSS, in favor of ALSA or Pulse.

I would agree that using individual ifdef's for each define is useful; it appears that the oss package from 4Front provides more of the defines than the modified "Boomer" OSS headers that are part of the OpenSolaris derivatives.

My recommendation would be that Brian's patch or something like it be included as a bug fix in any releases of Python, not as just a "new feature" in the latest release.
msg276751 - (view) Author: Tim Mooney (enchanter) Date: 2016-09-16 21:25
Sooo....  It's been 3 years.  Brian's patch has bit-rotted a bit, but it's easy to update for recent Python.

What are the hold-ups to getting this applied?
msg380057 - (view) Author: Sebastian Wiedenroth (wiedi) * Date: 2020-10-31 12:38
This patch has also been applied to the python versions shipped by OpenIndiana and OmniOS for a long time. I'd say it's safe to merge.
History
Date User Action Args
2022-04-11 14:57:40adminsetgithub: 61106
2020-10-31 12:38:23wiedisetnosy: + wiedi
messages: + msg380057
2016-09-16 21:25:48enchantersetmessages: + msg276751
2013-08-23 00:18:33enchantersetnosy: + enchanter
messages: + msg195935
2013-01-10 18:17:26brian-cameron-oraclesetmessages: + msg179582
2013-01-10 00:59:56jceasetmessages: + msg179507
2013-01-10 00:58:10jceasetassignee: jcea
messages: + msg179506
2013-01-10 00:41:29brian-cameron-oraclesetmessages: + msg179505
2013-01-09 23:33:19jceasetmessages: + msg179499
2013-01-09 17:17:52brian-cameron-oraclesetmessages: + msg179478
2013-01-09 17:08:52jceasetmessages: + msg179477
2013-01-09 16:37:15brian-cameron-oraclesetmessages: + msg179474
2013-01-09 16:25:58jceasetmessages: + msg179471
2013-01-09 16:14:47brian-cameron-oraclesetmessages: + msg179468
2013-01-09 16:05:42trentsetnosy: + trent
2013-01-09 15:30:56jceasetnosy: + jcea
messages: + msg179452
2013-01-09 08:27:20brian-cameron-oraclecreate