[prev in list] [next in list] [prev in thread] [next in thread] 

List:       libusb-devel
Subject:    Re: [libusb] Current git failed to build under Mac OS X 10.11.3
From:       Nathan Hjelm <hjelmn () me ! com>
Date:       2016-02-25 17:08:43
Message-ID: 3EC078C6-6798-4C80-8CC6-42141B5D5F56 () me ! com
[Download RAW message or body]

Opened a PR to fix the issue and test Travis.

-Nathan

> On Feb 25, 2016, at 8:23 AM, Nathan Hjelm <hjelmn@me.com> wrote:
> 
> I am looking at setting up Travis CI now.
> 
> -Nathan
> 
> > On Feb 25, 2016, at 8:08 AM, Nathan Hjelm <hjelmn@me.com> wrote:
> > 
> > Ugh, we need to add travis or something similar to catch stuff like this. The \
> > change that added the call to the optional posix_gettime should have used the \
> > backend clock_gettime function. We added that function because OS X does not \
> > implement it. 
> > -Nathan
> > 
> > > On Feb 25, 2016, at 5:22 AM, Ludovic Rousseau <ludovic.rousseau@gmail.com> \
> > > wrote: 
> > > 
> > > 
> > > 2016-02-25 12:38 GMT+01:00 Xiaofan Chen <xiaofanc@gmail.com>:
> > > On Thu, Feb 25, 2016 at 7:29 PM, Xiaofan Chen <xiaofanc@gmail.com> wrote:
> > > 
> > > > os/threads_posix.c:67:6: error: implicit declaration of function \
> > > > 'clock_gettime' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
> > > > r = clock_gettime(CLOCK_REALTIME, &timeout);
> > > > ^
> > > > os/threads_posix.c:67:6: note: did you mean 'clock_set_time'?
> > > > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/mach/clock_priv.h:52:15:
> > > >  note:
> > > > 'clock_set_time' declared here
> > > > kern_return_t clock_set_time
> > > > ^
> > > > os/threads_posix.c:67:20: error: use of undeclared identifier \
> > > > 'CLOCK_REALTIME' r = clock_gettime(CLOCK_REALTIME, &timeout);
> > > > ^
> > > > 2 errors generated.
> > > 
> > > BTW, libusb-1.0.20 release is okay.
> > > 
> > > 
> > > Exact.
> > > The code is broken on Mac OS X because of a change by Chris Dickens.
> > > 
> > > https://github.com/libusb/libusb/commit/3a4fd0ac64cf9d4cf8f2a665f2f43f2bb1d25369#diff-8b11e8e328cd7b1e66f7dd3d6b026210R67
> > >  
> > > 
> > > Proposed fix (untested but the compilation succeeds):
> > > 
> > > --- /var/folders/5h/3d1x67_x5g30t36wypgxpmpc0000gn/T//eBjnMa_threads_posix.c    \
> > >                 2016-02-25 13:19:51.000000000 +0100
> > > +++ libusb/os/threads_posix.c   2016-02-25 13:19:45.000000000 +0100
> > > @@ -62,19 +62,23 @@ int usbi_cond_timedwait(pthread_cond_t *
> > > pthread_mutex_t *mutex, const struct timeval *tv)
> > > {
> > > struct timespec timeout;
> > > +   struct timeval timeout_u;
> > > int r;
> > > 
> > > -   r = clock_gettime(CLOCK_REALTIME, &timeout);
> > > +   r = gettimeofday(&timeout_u, NULL);
> > > if (r < 0)
> > > return r;
> > > 
> > > -   timeout.tv_sec += tv->tv_sec;
> > > -   timeout.tv_nsec += tv->tv_usec * 1000;
> > > -   while (timeout.tv_nsec >= 1000000000L) {
> > > -       timeout.tv_nsec -= 1000000000L;
> > > -       timeout.tv_sec++;
> > > +   timeout_u.tv_sec += tv->tv_sec;
> > > +   timeout_u.tv_usec += tv->tv_usec;
> > > +   while (timeout_u.tv_usec >= 1000000L) {
> > > +       timeout_u.tv_usec -= 1000000L;
> > > +       timeout_u.tv_sec++;
> > > }
> > > 
> > > +   timeout.tv_sec = timeout_u.tv_sec;
> > > +   timeout.tv_nsec = timeout_u.tv_usec * 1000L;
> > > +
> > > return pthread_cond_timedwait(cond, mutex, &timeout);
> > > }
> > > 
> > > 
> > > The effect of my change is a lower resolution from 1 nano second to 1 micro \
> > > second. I don't think that is critical because the timeout parameter is already \
> > > with a 1 micro second granularity. 
> > > Bye
> > > 
> > > -- 
> > > Dr. Ludovic Rousseau
> > > ------------------------------------------------------------------------------
> > > Site24x7 APM Insight: Get Deep Visibility into Application Performance
> > > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> > > Monitor end-to-end web transactions and take corrective actions now
> > > Troubleshoot faster and improve end-user experience. Signup Now!
> > > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140_______________________________________________
> > >  libusb-devel mailing list
> > > libusb-devel@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/libusb-devel
> > 
> > 
> > ------------------------------------------------------------------------------
> > Site24x7 APM Insight: Get Deep Visibility into Application Performance
> > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> > Monitor end-to-end web transactions and take corrective actions now
> > Troubleshoot faster and improve end-user experience. Signup Now!
> > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> > _______________________________________________
> > libusb-devel mailing list
> > libusb-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/libusb-devel
> 
> 
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> _______________________________________________
> libusb-devel mailing list
> libusb-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libusb-devel


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
libusb-devel mailing list
libusb-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic