michaelrsweet / htmldoc

HTML Conversion Software
https://www.msweet.org/htmldoc
GNU General Public License v2.0
206 stars 46 forks source link

Solaris 11.4 Compile: error: ‘struct std::tm’ has no member named ‘tm_gmtoff’ #498

Closed johnkwoods closed 12 months ago

johnkwoods commented 1 year ago

When compiling htmldoc 1.9.16 from source, on Solaris 11.4.51.132.1, with gcc 12.1.0, the htmldoc/ps-pdf.cxx file fails to compile:

gmake

Making all in htmldoc... gmake[1]: Entering directory '/tmp/htmldoc-1.9.16-SunOS-5.11-i386/htmldoc' Compiling gui.cxx... Compiling epub.cxx... Compiling html.cxx... Compiling htmldoc.cxx... Compiling htmlsep.cxx... Compiling license.cxx... Compiling markdown.cxx... Compiling mmd.c... cc1: warning: command-line option ‘-fpermissive’ is valid for C++/ObjC++ but not for C mmd.c: In function ‘mmdCopyAllText’: mmd.c:208:33: warning: pointer ‘all’ may be used after ‘realloc’ [-Wuse-after-free] 208 | allptr = temp + (allptr - all); | ~~^~~~ mmd.c:200:19: note: call to ‘realloc’ here 200 | temp = realloc(all, allsize); | ^~~~~ Compiling ps-pdf.cxx... ps-pdf.cxx: In function ‘void pdf_write_links(std::FILE)’: ps-pdf.cxx:3469:28: warning: comparison of integer expressions of different signedness: ‘short int’ and ‘std::size_t’ {aka ‘long unsigned int’} [-Wsign-compare] 3469 | if (link->page < num_pages) | ~~~^~~ ps-pdf.cxx: In function ‘void write_prolog(std::FILE, int, uchar, uchar, uchar, uchar, uchar*)’: ps-pdf.cxx:11656:28: error: ‘struct std::tm’ has no member named ‘tm_gmtoff’ 11656 | (int)(doc_date.tm_gmtoff / 3600)); | ^~~~~ ps-pdf.cxx:12045:28: error: ‘struct std::tm’ has no member named ‘tm_gmtoff’ 12045 | (int)(doc_date.tm_gmtoff / 3600)); | ^~~~~ gmake[1]: [../Makedefs:92: ps-pdf.o] Error 1 gmake[1]: Leaving directory '/tmp/htmldoc-1.9.16-SunOS-5.11-i386/htmldoc' gmake: [Makefile:31: all] Error 1 #

Upon research, I was able to compile htmldoc 2.9.15 just fine with the same configuration.

I believe this is related to the two following issues/commits: 543d6e3827cbb0e0efee186365d4754a9e3d3389

472

On Solaris, in /usr/include/iso/time_iso.h, the struct does not contain tm_gmtoff:

struct  tm {    /* see ctime(3) */
        int     tm_sec;
        int     tm_min;
        int     tm_hour;
        int     tm_mday;
        int     tm_mon;
        int     tm_year;
        int     tm_wday;
        int     tm_yday;
        int     tm_isdst;
};

I noticed that in the configure output, there is a line to detect whether tm_gmtoff exists, while setting HAVE_TM_GMTOFF:

checking for tm_gmtoff member in tm structure... no

I'd imagine you probably don't have a spare Solaris server to compile on, so please let me know if you need me to test compile a fix.

Thanks again for creating/maintaining a great tool!!!

michaelrsweet commented 12 months ago

[master 3cdeb68] Fix Solaris builds (Issue #498)