
[PATCH] do_mysql-0.9.1 compile fails on Solaris 5.11
Reported by Daniel Meyer | June 11th, 2008 @ 11:45 AM
Platform: Sun Solaris 5.11 build 86 on x86 with Sun Studio compiler.
Using the pkg:/SUNWmysql5@5.0.45-0.86 package places the libraries and headers under /usr/mysql/5.0 which are not found during compile. In addition extconf.rb is not configured to detect use of the Sun Studio compiler and adds -Wall to $CFLAGS which is not supported.
I believe the platform does not support tm_gmtoff functionality and thus fails to compile. I've made some modifications to hopefully accomplish the equivalent in ANSI C. The module builds and installs without error. I would appreciate a review of the technical correctness of the workaround.
do_mysql_ext.c:
183a184
> long gmtoffset;
185,186c186,187
< time_t rawtime;
< struct tm * timeinfo;
---
> time_t t1, t2;
> struct tm tm;
197,200c198,203
< // Get localtime
< time(&rawtime);
< timeinfo = localtime(&rawtime);
<
---
> // begin ANSI GMT offset calculation
> t1 = time(0);
> tm = *gmtime(&t1);
> t2 = mktime(&tm);
> gmtoffset = (long) difftime(t1,t2);
>
203,204c206,207
< int hour_offset = abs(timeinfo->tm_gmtoff) / 3600;
< int minute_offset = abs(timeinfo->tm_gmtoff) % 3600 / 60;
---
> int hour_offset = abs(gmtoffset) / 3600;
> int minute_offset = abs(gmtoffset) % 3600 / 60;
207c210
< if (timeinfo->tm_gmtoff < 0) {
---
> if (gmtoffset < 0) {
231c234
< offset = seconds_to_offset(timeinfo->tm_gmtoff);
---
> offset = seconds_to_offset(gmtoffset);
Comments and changes to this ticket
-
vo.x July 1st, 2008 @ 03:22 PM
- Tag set to 5.11, cygwin, do_mysql, solaris
I have similar problem using recent cygwin. If I am right, tm_gmtoff is bsd extension and it is not available in ISO C.
-
Karlin September 26th, 2008 @ 01:38 PM
- Tag changed from 5.11, cygwin, do_mysql, solaris to do_mysql, solaris
I haven't tried Daniel's solution, but I have a similar one that works for OpenSolaris (I'm hosting with Joyent). If the platform is not Solaris, there is essentially no change, similar to Daniel's fix.
You can get the commit here:
http://github.com/karlin/do/commit/06350b0f93782cde9f3407d44356e1da9cdefb2e
It was an answer to this mailing-list post.
My other thought was to just call the Ruby function Time.gmtoff, which already implements a cross-platform version of this function. I haven't implemented that idea yet.
-
Botanicus September 30th, 2008 @ 07:01 AM
I've upgraded it for 0.9.6, please see http://pastie.org/282092
-
Dan Kubb (dkubb) November 28th, 2008 @ 02:32 AM
- Tag changed from do_mysql, solaris to do_mysql, patch, solaris
- Title changed from do_mysql-0.9.1 compile fails on Solaris 5.11 to [PATCH] do_mysql-0.9.1 compile fails on Solaris 5.11
- Assigned user cleared.
-
Jonathan Stott (namelessjon) November 30th, 2008 @ 07:46 AM
- State changed from new to open
-
Dan Kubb (dkubb) November 30th, 2008 @ 12:36 PM
- Assigned user set to Dirkjan Bussink
Dirkjan, would you mind reviewing this patch?
-
Dirkjan Bussink November 30th, 2008 @ 01:55 PM
- State changed from open to resolved
I've reworked some stuff in do_mysql, it should work now. Could you let me know if there is an issue on solaris?
-
Makoto Kuwata December 18th, 2008 @ 03:09 AM
Dirkjan, I found that do_mysql 0.9.9 can't be compiled on Solaris (5.11 i86pc).
Error message is the same as the following post: http://groups.google.com/group/d...
And I also find that Karlin's patch works fine: http://github.com/karlin/do/comm...
Could you include it to do_mysql?
-
Dirkjan Bussink December 18th, 2008 @ 04:05 AM
Could you verify that this is already resolved with the current edge do_mysql? There is no usage of tm_gmtoff in there anymore.
-
Makoto Kuwata December 18th, 2008 @ 08:08 PM
I found that this is fixed in do_mysql 0.9.10. Thank you very much!
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
People watching this ticket
Referenced by
-
429 do_sqlite3-0.9.2 compile fails under cygwin I have found ticket #344 which describes similar problem...
-
719 can't compile do_mysql on Solaris Related ticket: #344 http://datamapper.lighthouseapp....
-
719 can't compile do_mysql on Solaris Related ticket: #344 http://datamapper.lighthouseapp....