bugCompact Disc Input and Control Library - Bugs: bug #30019, When built on OS X 10.6 libcdio...

 
 

bug #30019: When built on OS X 10.6 libcdio fails to find OSX device driver

Submitter:  Jeremiah Boyle <j3r3miah>
Submitted:  Mon 31 May 2010 10:32:41 PM UTC
   
 
Category:  compilation Severity:  5 - Average
Item Group:  libcdio Status:  In Progress
Privacy:  Public Assigned to:  rocky
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 24 Apr 2012 04:52:27 AM UTC, comment #18: 

Tested as working on 10.6 and 10.7. Please close.

(will create another bug ticket for the free crash)

Nigel Pearson <nigelpearson>
Mon 23 Apr 2012 10:25:42 AM UTC, comment #17: 

Ok, updated in git. This time for sure?

Rocky Bernstein <rocky>
Group administrator
Mon 23 Apr 2012 09:12:12 AM UTC, comment #16: 

Still not working because $host_os is darwin10.8.0, not darwin10

You missed the asterisk at the end of those darwin patterns :-(

Nigel Pearson <nigelpearson>
Mon 23 Apr 2012 12:32:49 AM UTC, comment #15: 

Thanks for the configure.ac patch. Is in git now. And no, it is not dependant on the version of autoconf, [] is the way one quotes a string.

Thanks also for looking into the malloc/free. A guess is that some structure has changed in other drivers it is not reflected in the osx driver. There have been some major changes recently. CD-Text was overhauled which is the most likely cause. Some changes were also made to support non-gcc compilers MSVC in particular which doesn't allow flexible arrays at the end of structures.

Rocky Bernstein <rocky>
Group administrator
Mon 23 Apr 2012 12:09:36 AM UTC, comment #14: 

Getting closer, but those wildcards don't seem to work in configure:

MacBook% make distclean
...
rm -f Makefile
MacBook% git pull
Already up-to-date.
MacBook% ./configure
checking for a BSD-compatible install... /usr/bin/install -c
...
checking for cos in -lm... yes
configure: WARNING: I don't see GNU ld. I'm going to assume --without-versioned-libs
configure: WARNING: Don't have OS CD-reading support for darwin10.8.0...
configure: WARNING: Will use generic support.
^C


After a bit of fiddling, it looks like autoconf strips the square brackets off. Try this:


diff --git a/configure.ac b/configure.ac
index 580d2d3..f38cb73 100644
--- a/configure.ac
+++ b/configure.ac
@@ -324,7 +324,7 @@ case $host_os in
        ## AC_DEFINE([HAVE_AIX_CDROM], [1],
        ##     [Define 1 if you have AIX CD-ROM support])
        ;;
-     darwin[6-9]|darwin1[0-2])
+     darwin[[6-9]]*|darwin1[[0-2]]*)
        AC_CHECK_HEADERS(IOKit/IOKitLib.h CoreFoundation/CFBase.h,
                         [have_iokit_h="yes"])
        if test "x$have_iokit_h" = "xyes" ; then
@@ -346,7 +346,7 @@ case $host_os in
         fi

         case $host_os in
-          darwin1[0-2])
+          darwin1[[0-2]]*)
              AC_DEFINE([DARWIN_10_OR_GREATER], 1,
              [Define 1 if you have Darwin OS X 10 or greater])
                ;;
@@ -419,7 +419,7 @@ int has_timeout=sizeof(test.timeout);],

        fi
        enable_cdda_player="no"
        ;;
-     freebsd4.*|freebsd5.*|freebsd[6-9]*|dragonfly*|kfreebsd*)
+     freebsd4.*|freebsd5.*|freebsd[[6-9]]*|dragonfly*|kfreebsd*)
        AC_DEFINE([HAVE_FREEBSD_CDROM], [1],
                   [Define 1 if you have FreeBSD CD-ROM support])
        LIBS="$LIBS -lcam"


It might just be the old autoconf I am using, but I doubt it?

Still looking into the malloc/free problem.

Nigel Pearson <nigelpearson>
Sun 22 Apr 2012 03:51:16 AM UTC, comment #13: 

I have made changes in git to try to address all of the issues except the SEGV. For that I'd need a gdb traceback. Better would be if there is something like valgrind for OSX which tracks invalid memory reads and writes.

Rocky Bernstein <rocky>
Group administrator
Sat 21 Apr 2012 12:31:52 PM UTC, comment #12: 

1) Rocky, good guess about the bool. Looks like include/cdio/types.h assumes stdbool.h is always included beforehand (the #ifndef __bool_true_false_are_defined).

When compiling osx.c, it isn't. Correct way is for configure to check for stdbool.h, and include/cdio/types.h should #include it if exists on the platform.

A simpler way is just to include it in osx.c :-)

Sadly, with either compile fix, git head has other faults:

MacBook% git diff
diff --git a/lib/driver/osx.c b/lib/driver/osx.c
index 507e64a..73ccca2 100644
--- a/lib/driver/osx.c
+++ b/lib/driver/osx.c
@@ -33,7 +33,7 @@
 #endif

 static const char _rcsid[] = "$Id: osx.c,v 1.14 2008/10/17 11:58:52 rocky Exp $
-
+#include <stdbool.h>
 #include <cdio/logging.h>
 #include <cdio/sector.h>
 #include <cdio/util.h>
MacBook% make
...
libtool: link: gcc -g -O2 -Wall -Wchar-subscripts -Wmissing-prototypes -Wmissing-declarations -Wunused -Wpointer-arith -Wwrite-strings -Wnested-externs -Wno-sign-compare -o .libs/udffile udffile.o -Wl,-framework -Wl,CoreFoundation -Wl,-framework -Wl,IOKit -Wl,-framework -Wl,DiskArbitration  ../lib/udf/.libs/libudf.0.0.0.dylib /Volumes/Users/nigel/Programming/libcdio/lib/driver/.libs/libcdio.13.0.0.dylib ../lib/driver/.libs/libcdio.13.0.0.dylib -liconv -lm
make[2]: Nothing to be done for `all-am'.
MacBook% src/cd-info
cd-info version 0.84git i386-apple-darwin10.8.0
Copyright (c) 2003, 2004, 2005, 2007, 2008, 2011, 2012 R. Bernstein
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
cd-info(30540) malloc: *** error for object 0x1: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
zsh: abort      src/cd-info


Core dump reveals:


Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libSystem.B.dylib                     0x00007fff8888b0b6 __kill + 10
1   libSystem.B.dylib                     0x00007fff8892b9f6 abort + 83
2   libSystem.B.dylib                     0x00007fff88843195 free + 128
3   libcdio.13.dylib                      0x000000010001c993 cdio_generic_free + 99 (_cdio_generic.c:121)
4   libcdio.13.dylib                      0x000000010002ca3a cdio_open_osx + 698 (osx.c:1970)
5   libcdio.13.dylib                      0x000000010001ea73 scan_for_driver + 99 (device.c:337)
6   libcdio.13.dylib                      0x000000010001f5d2 cdio_open_am + 210 (device.c:968)
7   cd-info                               0x0000000100004b36 open_input + 230 (util.c:100)
8   cd-info                               0x00000001000029c8 main + 1352 (cd-info.c:876)
9   cd-info                               0x0000000100001704 start + 52


2)a) Duplicate symbol stuff appears to be resolved. Thanks!

2)b) 10.7 is:

Nigels-MacBook-Air:libcdio nigel$ ./config.guess
i386-apple-darwin11.3.0
Nigels-MacBook-Air:libcdio nigel$ uname -a
Darwin Nigels-MacBook-Air.local 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64

darwin11 needs to be added to configure.ac, lines 327 and 349. Will probably need darwin12 for 10.8, too.

P.S. The new darwin_10 stuff in configure.ac is broken:

MacBook% egrep DARWIN config.h
#define DARWIN_10_OR_GREATER $darwin_10
#define HAVE_DARWIN_CDROM 1

I don't think variables are expanded in AC_DEFINE ?

Nigel Pearson <nigelpearson>
Wed 18 Apr 2012 11:21:32 AM UTC, comment #11: 

Re: comment #10

1) the "conflicting types" must probably be different definitions of "bool". You can see what the definition of bool is by compiling osx.c using the gcc flags -dD -E and changing -o to say /tmp/osx.i. Then look for definitions of bool to see why this is getting defined differently two ways.

2) What does running config.guess in the directory where configure is located report? What does uname -a show?

I believe the problems with the duplicate symbol _cdtext_format_enum should be resolved in current git sources.

Rocky Bernstein <rocky>
Group administrator
Tue 17 Apr 2012 01:54:05 AM UTC, comment #10: 

Re: comment #6

After grabbing last night's Git master, and hacking (10.6 only has autoconf 2.61 on 10.6, and 10.7 doesn't seem to come with any autoconf)...


1) On 10.6, the includes and HAVE_DARWIN_CDROM are all OK, but compilation fails elsewhere:

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I../../lib/driver -I../../include -I../../include/ -g -O2 -Wall -Wchar-subscripts -Wmissing-prototypes -Wmissing-declarations -Wunused -Wpointer-arith -Wwrite-strings -Wnested-externs -Wno-sign-compare -MT osx.lo -MD -MP -MF .deps/osx.Tpo -c osx.c  -fno-common -DPIC -o .libs/osx.o
osx.c: In function ‘cdio_open_osx’:
osx.c:1910: warning: initialization from incompatible pointer type
osx.c:1916: warning: initialization from incompatible pointer type
osx.c:1924: warning: initialization from incompatible pointer type
osx.c:1925: warning: initialization from incompatible pointer type
osx.c:1926: warning: initialization from incompatible pointer type
osx.c:1927: warning: initialization from incompatible pointer type
osx.c:1928: warning: initialization from incompatible pointer type
osx.c: At top level:
osx.c:1983: error: conflicting types for ‘cdio_have_osx’
cdio_private.h:543: error: previous declaration of ‘cdio_have_osx’ was here
make[3]: *** [osx.lo] Error 1



2) On 10.7, configure doesn't set HAVE_DARWIN_CDROM:

checking dynamic linker characteristics... darwin11.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking for cos in -lm... yes
configure: WARNING: I don't see GNU ld. I'm going to assume --without-versioned-libs
configure: WARNING: Don't have OS CD-reading support for darwin11.3.0...
configure: WARNING: Will use generic support.


and make fails elsewhere, as per comments #7 thru #9 (another anonymous, not me :-)

Nigel Pearson <nigelpearson>
Mon 16 Apr 2012 11:48:04 PM UTC, comment #9: 

that helped but there are other files with same issue:

ld: duplicate symbol _cdtext_format_enum in .libs/bincue.o and .libs/cdtext.o for architecture x86_64

it seems like bad form, and the source of this build issue, that xxx_private.h is being included anywhere but xxx.c:

aix.c:#include "cdtext_private.h"
bsdi.c:#include "cdtext_private.h"
cdtext.c:#include "cdtext_private.h"
image/bincue.c:#include "cdtext_private.h"
image/cdrdao.c:#include "cdtext_private.h"
image/nrg.c:#include "cdtext_private.h"
mmc/mmc.c:#include "cdtext_private.h"
solaris.c:#include "cdtext_private.h"

Anonymous
Mon 16 Apr 2012 11:16:14 PM UTC, comment #8: 

I think I found the problem here. Try with current git sources, commit db91979..dd7a5dc or apply the attached patch.

(file #25665)

Rocky Bernstein <rocky>
Group administrator
Mon 16 Apr 2012 07:52:37 PM UTC, comment #7: 

I am attempting to test the latest changes on OS X 10.7 but i am running into build issues. Building in lib/driver produces a linker error:

ld: duplicate symbol _cdtext_format_enum in .libs/gnu_linux.o and .libs/cdtext.o for architecture x86_64

Anonymous
Fri 13 Apr 2012 08:22:21 PM UTC, comment #6: 

First and foremost, thanks for the information.

In the current git sources what I had done was to use the new path from your patch but only in Darwin 10 or greater. From http://en.wikipedia.org/wiki/Darwin_%28operating_system%29 this goes back to August 2009. Given what you report it may also be valid from Darwin 9 or greater as well. But I am guessing that the other path was okay since no one has said anything about this previously.

Would you do me a favor and try the current git sources to see that things compile properly on 10.6.8. If so, let me know and I will close ticket. Thanks.

Rocky Bernstein <rocky>
Group administrator
Tue 10 Apr 2012 11:55:39 AM UTC, comment #5: 

Hi Rocky. The Apple documentation has mandated the shorter path for about 5 years:

http://developer.apple.com/library/mac/#documentation/Darwin/Reference/IOKit/SCSITaskLib_h/index.html

Only compiled and tested on a 10.6.8 machine. A quick search of include paths on nearby machines:


macbook% find /System/Library/Frameworks/ -name scsi-commands
macbook% find /Volumes/10*/System/Library/Frameworks/ -name SCSITaskLib.h
/Volumes/10.3/System/Library/Frameworks//IOKit.framework/Versions/A/Headers/scsi/SCSITaskLib.h
/Volumes/10.3/System/Library/Frameworks//IOKit.framework/Versions/A/Headers/scsi-commands/SCSITaskLib.h
/Volumes/10.4/System/Library/Frameworks//IOKit.framework/Versions/A/Headers/scsi/SCSITaskLib.h
/Volumes/10.6/System/Library/Frameworks//IOKit.framework/Versions/A/Headers/scsi/SCSITaskLib.h
macbook% uname -a
Darwin MacBook.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386


reveals safety for the last 4 major OS releases?

Sorry for the anonymity - the artificially complex I was forced to register with has somehow slipped my short term memory, and I have to wait another day for that unused account to expire :-(

-email is unavailable-

Anonymous
Tue 10 Apr 2012 07:41:42 AM UTC, comment #4: 

With respect to the patch that was attached, what OSX were tested. Just 10.6?

#include locations were changed in that patch. How far back are those different locations valid?

Rocky Bernstein <rocky>
Group administrator
Sun 09 Jan 2011 02:52:35 AM UTC, comment #3: 

No. I still don't have access to something that runs Snow Leopard let alone have something I can develop from.

But the code is open source. Patches are welcome and I invite others can feel free to look at and suggest fixes.

Rocky Bernstein <rocky>
Group administrator
Sun 09 Jan 2011 02:41:19 AM UTC, comment #2: 

Have you had a chance to look at this?

Jeremiah Boyle <j3r3miah>
Thu 15 Jul 2010 10:31:00 AM UTC, comment #1: 

Sorry for the delay.

If you attach diff output on the headers and output logs perhaps I can take a look. Right now I don't have anything I can develop Snow Leopard on.

Thanks.

Rocky Bernstein <rocky>
Group administrator
Mon 31 May 2010 10:32:41 PM UTC, original submission:  

I attempted to build 0.82 and git latest on Snow Leopard. In both cases the resulting library is broken.

I poked around a little bit and noticed that the osx driver isn't even being init'ed because HAVE_DARWIN_CDROM seems to not be defined.

Just defining HAVE_DARWIN_CDROM doesn't resolve the problem. There are some IOKit headers which seem to have change been moved in 10.6. Once I fixed those I got some undefined symbols. That's where I gave up.

It looks like the build just needs to be fixed up for Snow Leopard.

$ ./example/device
++ WARN: could not retrieve file info for `image.nrg': No such file or directory++ WARN: can't open nrg image file image.nrg for reading
Problem in trying to find a driver.

We don't have: AIX SCSI driver
We don't have: BSDI ATAPI and SCSI driver
We don't have: FreeBSD driver
We don't have: NetBSD driver
We don't have: GNU/Linux ioctl and MMC driver
We don't have: Solaris ATAPI and SCSI driver
We don't have: IBM OS/2 driver
We don't have: Apple Darwin OS X driver
We don't have: MS Windows ASPI and ioctl driver
We have: cdrdao (TOC) disk image driver
We have: bin/cuesheet disk image driver
We have: Nero NRG disk image driver

Jeremiah Boyle <j3r3miah>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #25665:  osx-10.7.patch added by rocky (330B - text/x-diff)
file #25623:  cdio.patch added by None (1KiB - application/octet-stream - Build fixes for 10.6)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nigelpearson (Posted a comment)
  • -email is unavailable- added by rocky (Posted a comment)
  • -email is unavailable- added by j3r3miah (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-04-24 rocky Open/ClosedOpen Closed
    2012-04-16 rocky Attached File- Added osx-10.7.patch, #25665
    2012-04-13 rocky StatusNone In Progress
    2012-04-10 None Attached File- Added cdio.patch, #25623
    2010-07-15 rocky CategoryNone compilation
        Item GroupNone libcdio
        Assigned toNone rocky
    2010-05-31 j3r3miah Carbon-CopyRemoved -email is unavailable- -
    2010-05-31 j3r3miah Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code