Sun 09 Mar 2014 12:59:32 AM UTC, original submission:
I installed pycdio on Python 2.7 on my Mac, via pip. I installed libcdio via MacPorts. When I tried to import pycdio and cdio in Python, I got error messages.
Also, when running cd-info on a valid commercially-produced CD, in the track listings it gave me surprising error messages of the form:
The curious thing about this is that the number of minutes was less than 99. I suspected an integer type mismatch.
I was able to fix this on my Mac by adding a reference to three necessary Mac OS frameworks to in the link rule for libcdio. There was already a macro with the framework references, I just added this macro to the link rule.
A patch file is attached.
I fetched libcdio 0.92 sources from the libcdio git repository, built, and installed, and was able to reproduce the import failure in Python. Sadly, I couldn't reproduce the cd-info error message about truncated track lengths.
This is the Python error message:
I believe the underlying problem is that libcdio needs to refer to three Darwin (Mac OS X) frameworks: CoreFoundation, IOKit, and DiskArbitration. The symbol which wasn't found appears to be related to kIOMasterPortDefault as defined in IOKit:
<https://developer.apple.com/library/mac/documentation/IOKit/Reference/IOKitLib_header_reference/Reference/reference.html#//apple_ref/doc/uid/TP40012419-CHIOKitLibhConstants-SW2>
The dynamic library libcdio.dylib as built from 0.92 does not refer to these frameworks:
The fix which works for me is to use a macro DARWIN_PKG_LIB_HACK, which is defined in configure.ac:370..395 . I append it to the end of the definition of libcdio_la_ldflags in lib/driver/Makefile.am:111. I then run "autoreconf" to propogate the changes from Makefile.am to Makefile.in, and then run ./configure and make as usual.
After applying this patch, the libcdio.dylib library now refers to the frameworks:
And, import of pycdio in Python now works fine:
I don't know quite why this would have stopped working. I don't see any recent changes which clearly would have broken this linking.
I am using quite an old edition of Mac OS X, i.e. 10.5.8 . I don't know if this problem occurs on newer versions of Mac OS X. I expect that a macro named DARWIN_PKG_LIB_HACK would be nicely null on other OS's, but I haven't tested this. And perhaps there is a better place to apply this fix than were I applied it.
|