We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3712 - macro INFTIM is not defined in SDL_sndioaudio.c using CMAKE
Summary: macro INFTIM is not defined in SDL_sndioaudio.c using CMAKE
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: HG 2.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-25 04:53 UTC by kdavison
Modified: 2017-08-07 04:27 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kdavison 2017-07-25 04:53:11 UTC
Overview:
INFTIM macro was not defined on my local system causing compilation to fail.

Steps
1. don't have INFTIM macro defined (maybe I'm missing a driver?)
2. clone SDL from mercurial or one of the many github mirrors
3. build using CMAKE and add_subdirectory

Expected Result:
built SDL2 libraries

Actual Result:
compilation failure due to undefined INFTIM macro.

Additional Information:
SDL Version 2.0.5.1.5 on Ubuntu 16.04 using CMAKE


Proposed Fix:
Through googling and inspection I determined that INFTIM should be set to (-1).

Option #1: define macro (probably the safest)
#ifndef INFTIM
#define INFTIM (-1)
#endif //#ifndef INFTIM
static int
SNDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
{


Option #2: remove use of the macro
  poll(this->hidden->pfd, nfds, INFTIM)
to
  poll(this->hidden->pfd, nfds, -1)
but this assumes that all poll(...) implementations recognize -1 as infinite timeout.
Comment 1 Ryan C. Gordon 2017-07-25 06:01:48 UTC
This is probably a bug in the CMake file; sndio is meant for OpenBSD, not Linux.

--ryan.
Comment 2 Ozkan Sezer 2017-07-25 06:38:26 UTC
(In reply to Ryan C. Gordon from comment #1)
> This is probably a bug in the CMake file; sndio is meant for OpenBSD, not
> Linux.

There is a linux port at sndio.org, so people can actually experiment
with sndio on linux if they want to.

As for INFTIM macro: from the poll() man page:
http://man7.org/linux/man-pages/man2/poll.2.html

---
Some implementations define the nonstandard constant INFTIM with the
value -1 for use as a timeout for poll().  This constant is 
provided in glibc.
---

... so the ifdef suggestion of the OP seems plausible IMO.
Comment 3 kdavison 2017-07-25 23:41:21 UTC
I do actually have libsndio-dev installed (not sure why!), so it is definitely possible to have this package on systems other than OpenBSD.
Comment 4 Ryan C. Gordon 2017-08-07 04:27:40 UTC
(In reply to kdavison from comment #3)
> I do actually have libsndio-dev installed (not sure why!), so it is
> definitely possible to have this package on systems other than OpenBSD.

Huh, I'm surprised by this.  :)

Anyhow, this should be fixed in https://hg.libsdl.org/SDL/rev/c4ff854c6586, and we'll add that package to the Linux buildbots so it'll get code coverage in the future!

--ryan.