rosbag fails to compile on OS X with clang

When building rosbag from source on OS X with clang I get:

    [ 80%] Building CXX object ros_comm/tools/rosbag/CMakeFiles/rosbag.dir/src/bag.cpp.o
    In file included from /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/src/bag.cpp:28:
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/include/rosbag/bag.h:392:40: error: use of undeclared identifier 'CONNECTION_FIELD_NAME'
            readField(*header.getValues(), CONNECTION_FIELD_NAME, true, &connection_id);
                                           ^
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/include/rosbag/bag.h:425:27: error: use of undeclared identifier 'TOPIC_FIELD_NAME'
            readField(fields, TOPIC_FIELD_NAME,    true,  topic);
                              ^
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/include/rosbag/bag.h:426:27: error: use of undeclared identifier 'LATCHING_FIELD_NAME'
            readField(fields, LATCHING_FIELD_NAME, false, latching);
                              ^
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/include/rosbag/bag.h:427:27: error: use of undeclared identifier 'CALLERID_FIELD_NAME'
            readField(fields, CALLERID_FIELD_NAME, false, callerid);
                              ^
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/include/rosbag/bag.h:581:12: error: use of undeclared identifier 'OP_FIELD_NAME'
        header[OP_FIELD_NAME]         = toHeaderString(&OP_MSG_DATA);
               ^
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/include/rosbag/bag.h:581:53: error: use of undeclared identifier 'OP_MSG_DATA'
        header[OP_FIELD_NAME]         = toHeaderString(&OP_MSG_DATA);
                                                        ^
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/include/rosbag/bag.h:582:12: error: use of undeclared identifier 'CONNECTION_FIELD_NAME'
        header[CONNECTION_FIELD_NAME] = toHeaderString(&conn_id);
               ^
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/include/rosbag/bag.h:583:12: error: use of undeclared identifier 'TIME_FIELD_NAME'
        header[TIME_FIELD_NAME]       = toHeaderString(&time);
               ^
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/src/bag.cpp:197:44: error: use of undeclared identifier 'VERSION'
        string version = string("#ROSBAG V") + VERSION + string("\n");
                                               ^
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/src/bag.cpp:326:12: error: use of undeclared identifier 'OP_FIELD_NAME'
        header[OP_FIELD_NAME]               = toHeaderString(&OP_FILE_HEADER);
               ^
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/src/bag.cpp:326:59: error: use of undeclared identifier 'OP_FILE_HEADER'
        header[OP_FIELD_NAME]               = toHeaderString(&OP_FILE_HEADER);
                                                              ^
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/src/bag.cpp:327:12: error: use of undeclared identifier 'INDEX_POS_FIELD_NAME'
        header[INDEX_POS_FIELD_NAME]        = toHeaderString(&index_data_pos_);
               ^
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/src/bag.cpp:328:12: error: use of undeclared identifier 'CONNECTION_COUNT_FIELD_NAME'
        header[CONNECTION_COUNT_FIELD_NAME] = toHeaderString(&connection_count_);
               ^
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/src/bag.cpp:329:12: error: use of undeclared identifier 'CHUNK_COUNT_FIELD_NAME'
        header[CHUNK_COUNT_FIELD_NAME]      = toHeaderString(&chunk_count_);
               ^
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/src/bag.cpp:335:22: error: use of undeclared identifier 'FILE_HEADER_LENGTH'
        if (header_len < FILE_HEADER_LENGTH)
                         ^
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/src/bag.cpp:336:20: error: use of undeclared identifier 'FILE_HEADER_LENGTH'
            data_len = FILE_HEADER_LENGTH - header_len;
                       ^
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/src/bag.cpp:357:23: error: use of undeclared identifier 'OP_FILE_HEADER'
        if (!isOp(fields, OP_FILE_HEADER))
                          ^
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/src/bag.cpp:361:23: error: use of undeclared identifier 'INDEX_POS_FIELD_NAME'
        readField(fields, INDEX_POS_FIELD_NAME, true, (uint64_t*) &index_data_pos_);
                          ^
    /Users/william/devel/groovy/base/src/ros_comm/tools/rosbag/src/bag.cpp:368:27: error: use of undeclared identifier 'CONNECTION_COUNT_FIELD_NAME'
            readField(fields, CONNECTION_COUNT_FIELD_NAME, true, &connection_count_);
                              ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    20 errors generated.
    make[2]: *** [ros_comm/tools/rosbag/CMakeFiles/rosbag.dir/src/bag.cpp.o] Error 1
    make[1]: *** [ros_comm/tools/rosbag/CMakeFiles/rosbag.dir/all] Error 2
    make: *** [all] Error 2

Odd enough, the workaround seems to be to rename the rosbag/constants.h to rosbag/rosbag_constants.h and change any references to it.  I don't know what is causing this, but this work arounds seems to fix it and is harmless.

I will attach a pull request asap.