This project is archived and is in readonly mode.

#97 ✓ resolved
Floris Bruynooghe

Provide missing round function for solaris 8 & 9

Reported by Floris Bruynooghe | February 7th, 2012 @ 06:07 PM

The config.h file contains a round() function to use when the platform is missing it. However the conditions assume solaris has round. On our servers we found only Solaris 10 provided the symbols while they where missing on 8 and 9. The attached patch is what we currently use to fix this.

Comments and changes to this ticket

  • Floris Bruynooghe

    Floris Bruynooghe February 7th, 2012 @ 06:32 PM

    The previously attached patch was for 2.4.2, sorry about that. This one is updated for 2.4.4.

  • Daniele Varrazzo

    Daniele Varrazzo February 8th, 2012 @ 12:28 PM

    • State changed from “new” to “open”

    Hello Floris, thank you for the patch, it's very welcome.

    I've found in http://wiki.opencsw.org/porting-faq that there should be constants to detect the SunOS version: I've found mentioned:

    #if defined(__SunOS_5_9) || defined(__SunOS_5_10)
    

    would it be possible to use them instead of generating new symbols in the setup?

    What should we do on 5.11? I expect it to be more similar to 5.10, than to 5.9: in this case looks like your test would fail. I would define it as:

    #if [...] || ((defined(sun) || defined(__sun__)) && (defined(__SunOS_5_8) || defined(__SunOS_5_9)))
    

    could you test if this would work? Thanks.

  • Floris Bruynooghe

    Floris Bruynooghe February 8th, 2012 @ 01:47 PM

    Hi, I must admit I've been guilty of submitting the patch before running it on our build system (I did submit this in the middle between an upgrade from 3.4.2 to 2.4.4). After some more build failures I updated it to only include round for Solaris 8, this should also avoid the probable Solaris 11 issue (we don't build for Solaris 11 yet so I can't test).

    As for using the __SunOS_5_8 symbols these are provided by the Sun Studio compiler, which is what OpenCSW uses, but gcc doesn't provide equivalents. So the only portable solution I found was to define these myself.

    Having said this, Solaris 8 is out of normal support and soon the vintage patch service will stop as well (31 March 2012). And we will probably drop Solaris 8 soon too. So I guess this patch is not so important if you don't want to clutter up setup.py.

  • Daniele Varrazzo

    Daniele Varrazzo February 10th, 2012 @ 09:52 PM

    Re: [psycopg #97] Provide missing round function for solaris 8 & 9

  • Daniele Varrazzo

    Daniele Varrazzo February 10th, 2012 @ 09:55 PM

    Floris Bruynooghe updated this ticket at February 8th, 2012 @ 01:47 PM

    Hi, I must admit I've been guilty of submitting the patch before running it on our build system (I did submit this in the middle between an upgrade from 3.4.2 to 2.4.4). After some more build failures I updated it to only include round for Solaris 8, this should also avoid the probable Solaris 11 issue (we don't build for Solaris 11 yet so I can't test).

    Ok. So are you happy with the patch in its current form? If I read it correctly the round function is now only added for solaris 8, while instead we used to include it unconditionally on any solaris version. Right?

    As for using the __SunOS_5_8 symbols these are provided by the Sun Studio compiler, which is what OpenCSW uses, but gcc doesn't provide equivalents. So the only portable solution I found was to define these myself.

    Ok, makes sense.

    Having said this, Solaris 8 is out of normal support and soon the vintage patch service will stop as well (31 March 2012). And we will probably drop Solaris 8 soon too. So I guess this patch is not so important if you don't want to clutter up setup.py.

    It doesn't look a big problem for the setup, I'm fine with it.

  • Floris Bruynooghe

    Floris Bruynooghe February 18th, 2012 @ 03:01 PM

    Hi, sorry for the delay. I've been away for a while and wanted to double check by compiling on Solaris8 as well (we ended up dropping it early so it's no longer included in our automated build).

    However it turns out that now round is also available on Solaris8 so the ifdef statement simply becomes

    #if (defined(__FreeBSD__) && __FreeBSD_version < 503000) || (defined(_WIN32) && !defined(__GNUC__)).
    

    However this does make me wonder that maybe our build hosts have changed. We started having the originally submitted patch which suggest round was missing on sol8 & 9 but present on 10. But now it appears present on all 3 of them. Yet the only change on the hosts I can think of is an upgrade of the OpenCSW toolchain and libs while the round symbol is provided by libc afaik.

    I could make a patch with just the above #if statement, trivial as it is, but am no longer confident that it would be the correct behaviour for all versions. I've tried to experiment a little with distutils' compiler .has_function() method but that doesn't seem capable of figuring out the presence of round correctly either.

  • Daniele Varrazzo

    Daniele Varrazzo December 3rd, 2012 @ 12:30 AM

    • State changed from “open” to “hold”

    From the last comment is unclear to me if any patch is necessary or useful for psycopg.

  • Daniel Enman

    Daniel Enman April 18th, 2013 @ 08:02 PM

    Hi Daniele,

    I think I'm understanding form Floris' response that round is on all Solaris' version from 8 up.

    The issue described here has caused us all sorts of trouble, as trivial as it is (and as easy as it is to patch!). With the the revitalization of "Solaris" (in things like the illumos project, or Joyent's SmartOS), I think there are quite a few more people using Solaris-like operating systems now.

    I've sent up a pull request (https://github.com/psycopg/psycopg2/pull/4) which compiles for me on SmartOS (whereas it didn't before).

    Dan

  • Daniele Varrazzo

    Daniele Varrazzo April 19th, 2013 @ 08:12 AM

    • State changed from “hold” to “open”
    • Tag set to solaris

    Thank you very much: reopening the issue. Will take a look at your patch and integrate it.

  • Daniele Varrazzo

    Daniele Varrazzo April 21st, 2013 @ 08:23 PM

    • State changed from “open” to “resolved”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

WARNING: the informations in this tracker are archived. Please submit new tickets or comments to the new tracker.


Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

Shared Ticket Bins

Attachments

Tags

Referenced by

Pages