JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-5606

asprintf does not exist on Solaris, so C extensions do not build

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6
    • Fix Version/s: JRuby 1.6.2
    • Component/s: C Extensions
    • Labels:
      None
    • Environment:
      Solaris 10
    • Patch Submitted:
      Yes
    • Number of attachments :
      1

      Description

      asprintf() doesn't exist on Solaris 10, so the C extensions fail to build. However, there is a asprintf implementation included with the C extensions, but it's in the windows specific include file. I've attached a patch that moves the asprintf implementation into a separate header that is then pulled in from ruby.h on Solaris and Windows.

      This problem probably exists on other platforms also, in which case it should be fairly easy to extend it via platform specific #ifdef's. Ideally I think it would probably be better to detect this via autoconf or something similar.

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        I'm going to trust that removing the definitions from jruby_win32.h is ok, since we know asprintf will always be present on Windows. Yes?

        commit 54a74fe4dc863dddfbc9d38210dcba5a747fa42a
        Author: Charles Oliver Nutter <headius@headius.com>
        Date: Thu Mar 24 18:49:16 2011 -0500

        Fix JRUBY-5606: asprintf does not exist on Solaris, so C extensions do not build

        Show
        Charles Oliver Nutter added a comment - I'm going to trust that removing the definitions from jruby_win32.h is ok, since we know asprintf will always be present on Windows. Yes? commit 54a74fe4dc863dddfbc9d38210dcba5a747fa42a Author: Charles Oliver Nutter <headius@headius.com> Date: Thu Mar 24 18:49:16 2011 -0500 Fix JRUBY-5606 : asprintf does not exist on Solaris, so C extensions do not build
        Hide
        Clayton O'Neill added a comment -

        I don't know for sure, but my reading of the way it was before is that asprintf is never available on Windows. That's why I have asprintf.h included on Windows.

        Show
        Clayton O'Neill added a comment - I don't know for sure, but my reading of the way it was before is that asprintf is never available on Windows. That's why I have asprintf.h included on Windows.
        Hide
        Clayton O'Neill added a comment -

        I should have looked when this was committed, but asprintf.h from the patch doesn't seem to have made it into the commit

        Show
        Clayton O'Neill added a comment - I should have looked when this was committed, but asprintf.h from the patch doesn't seem to have made it into the commit
        Hide
        Charles Oliver Nutter added a comment -

        Oh, the file itself? Drat, that's unfortunate. I'll look into it.

        Show
        Charles Oliver Nutter added a comment - Oh, the file itself? Drat, that's unfortunate. I'll look into it.
        Hide
        Charles Oliver Nutter added a comment -

        New files always trip me up. Seems like SCMs need to do a better job handling this.

        commit af447dd37ddda0e06333858bb654ddf05a6d3e1c
        Author: Charles Oliver Nutter <headius@headius.com>
        Date: Wed Apr 13 10:55:52 2011 -0500

        Add asprintf.h from JRUBY-5606, apparently missed in the original commit.

        Show
        Charles Oliver Nutter added a comment - New files always trip me up. Seems like SCMs need to do a better job handling this. commit af447dd37ddda0e06333858bb654ddf05a6d3e1c Author: Charles Oliver Nutter <headius@headius.com> Date: Wed Apr 13 10:55:52 2011 -0500 Add asprintf.h from JRUBY-5606 , apparently missed in the original commit.
        Hide
        Wayne Meissner added a comment -

        Since asprintf is only used in one place (and is not provided in a header by MRI either), I think a better solution would be to just replace the asprintf usage in cext with malloc + sprintf or something similar.

        Show
        Wayne Meissner added a comment - Since asprintf is only used in one place (and is not provided in a header by MRI either), I think a better solution would be to just replace the asprintf usage in cext with malloc + sprintf or something similar.
        Hide
        Charles Oliver Nutter added a comment -

        Wayne: I'm going to go ahead and resolve this. If you want to commit a better fix that just avoids asprintf altogether, that's fine too.

        Fixed on master and in 1.6.2.

        Show
        Charles Oliver Nutter added a comment - Wayne: I'm going to go ahead and resolve this. If you want to commit a better fix that just avoids asprintf altogether, that's fine too. Fixed on master and in 1.6.2.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Clayton O'Neill
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: