Hi,

On 08/16/2013 05:34 AM, Xiaofan Chen wrote:
> On Wed, Aug 14, 2013 at 10:05 PM, Hans de Goede <hdego...@redhat.com> wrote:
>> From: Daniel Berrange <berra...@redhat.com>
>>
>> Since libusb-0.1 did not have any init / exit function, code using the
>> libusb-0.1 API will not call libusb_exit.
>
> Hmm, it that true with the latest libusb-compat-0.1.5? As per
> the ticket #130 for libusb-compat-0.1, the fix is there.
> http://libusb.org/ticket/130
>
> Do we still need the fix below?

Yes, at-exit only runs, well at exit, the problem here is that libusb-0.1
is dynamically opened using dlopen, used and the dlclose-d. So the program
does not exit. At this point the thread still exists, but the code for it
has been unloaded by dlclose and as soon the thread tries to run things go
boom. The -znodelete linker option tells the elf dynamic linker to keep
things around on dlclose, fixing the crash.

<snip>

>> diff --git a/libusb/Makefile.am b/libusb/Makefile.am
>> index 33a609a..a20fdb5 100644
>> --- a/libusb/Makefile.am
>> +++ b/libusb/Makefile.am
>> @@ -5,5 +5,5 @@ libusb_la_SOURCES = core.c usbi.h
>>   libusb_la_CFLAGS = -fvisibility=hidden $(AM_CFLAGS) $(LIBUSB_1_0_CFLAGS)
>>   libusb_la_LIBADD = $(LIBUSB_1_0_LIBS)
>>   libusb_la_LDFLAGS = -version-info $(LT_MAJOR):$(LT_REVISION):$(LT_AGE) \
>> -       -release 0.1
>> +       -release 0.1 -Wl,-z -Wl,nodelete
>>
>
> Just wondering if this is applicable for other OS as well
> (eg: Mac OS X).

I'm not sure.

> And I am wondering if this is MinGW friendly or not. I know
> that currently libusb-compat-0.1 does not support Windows
> but there are people who like the idea that libusb-compat-0.1
> to support Windows.

This is very likely not mingw friendly.

Regards,

Hans

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to