bugWeeChat - Bugs: bug #40981, illumos compilation issues


bug #40981: illumos compilation issues

Submitter:  Lauri Tirkkonen <lotheac>
Submitted:  Fri 20 Dec 2013 02:26:50 PM UTC
Category:  compilation Severity:  3 - Normal
Item Group:  compile/install Status:  Fixed
Privacy:  Public Assigned to:  flashcode
Originator Name:  Open/Closed:  Closed
Release:  * 0.4.2 IRC nick:  lotheac
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Sun 16 Mar 2014 06:22:20 PM UTC, comment #8: 

I think the compilation problem is now fixed (I was able to compile latest devel version on SmartOS).
Maybe it's not a very clean solution on all points, but it's working.
See also: https://github.com/weechat/weechat/issues/23

Sebastien Helleu <flashcode>
Group administrator
Mon 23 Dec 2013 09:28:20 AM UTC, comment #7: 

If you know how to do that, please provide a patch for both cmake and autotools (against latest git version).

Sebastien Helleu <flashcode>
Group administrator
Mon 23 Dec 2013 09:15:22 AM UTC, comment #6: 

I did see it, but I am saying that it isn't entirely right. Like I said before,
strptime was introduced in XPG4. That means that the macro requirements are
actually, per the illumos manual page standards(5)
(http://illumos.org/man/5/standards), XPG4 ("The application  must  define
_XOPEN_SOURCE and  set _XOPEN_VERSION=4.  If _XOPEN_SOURCE is defined with a
value, the value  must be less than 500."), XPG4v2 ("The application  must
defined with a  value, the value must be less than 500."), SUSv2
(_XOPEN_SOURCE=500), SUSv3/POSIX-1.2001 (_XOPEN_SOURCE=600) or POSIX-1.2008

700 does not work on illumos precisely because it does not yet support
POSIX-1.2008 (per standards(5)) and I suspect the reason it was disabled on
OpenBSD is similar (700 works on OpenBSD 5.4, as does 600).

My point is that it should not be necessary to have that check if the build
system defines macros according to the standards that the application requires,
assuming the target operating systems conform to the standard.  If weechat
actually does require POSIX 2008 then it won't compile on illumos presently,
but at least in the strptime case that requirement is too high.

Lauri Tirkkonen <lotheac>
Mon 23 Dec 2013 08:19:10 AM UTC, comment #5: 

The _XOPEN_SOURCE=700 is required for all OS (like Linux) but NOT OpenBSD (see the code I pasted 2 days ago).

Sebastien Helleu <flashcode>
Group administrator
Mon 23 Dec 2013 08:15:45 AM UTC, comment #4: 

Another note: strptime is visible with (and without) _XOPEN_SOURCE=700 on OpenBSD 5.4. It's possible older versions did not yet support POSIX-1.2008 and defining the macro to 700 broke stuff, as is still the case on illumos; that's why I suggested using 600, ie. POSIX-1.2001 unless you know you require some features from the newer standard.

Lauri Tirkkonen <lotheac>
Sat 21 Dec 2013 09:50:09 AM UTC, comment #3: 

Well, it looks like strptime was introduced in XPG4 (http://pubs.opengroup.org/onlinepubs/009696899/functions/strptime.html), so it is correct to require a definition to use that standard if it is necessary for the application. Like I said it might be better for the build system to define it instead of having source files mix and match different standards (unless this is desired for some reason?). If you use POSIX-1.2001 with -D_XOPEN_SOURCE=600, strptime is visible on at least Linux, OpenBSD and illumos (it is part of that standard after all).

Lauri Tirkkonen <lotheac>
Sat 21 Dec 2013 09:32:13 AM UTC, comment #2: 

The problem in charset plugin with strcasecmp is now fixed (I use weechat_strcasecmp instead, like all plugins do).

For the question about _XOPEN_SOURCE in src/plugins/irc/irc-protocol.c, yes there is a reason, as written in comment, in the file:

/* this define is needed for strptime() (not on OpenBSD) */
#if !defined(__OpenBSD__)
#define _XOPEN_SOURCE 700

If the _XOPEN_SOURCE 700 is not needed for Illumos (for strptime), then it would be possible to condition that (like already done for OpenBSD).

Sebastien Helleu <flashcode>
Group administrator
Fri 20 Dec 2013 02:42:08 PM UTC, comment #1: 


The configure script in tarballs has been removed, precisely to encourage people to use cmake (and then you should use it too).
It may be completely removed in future, so it's time to switch to cmake now.

Anyway, as configure is still there, I'll look at your problems and look if I can fix things (without breaking on other platforms).

Sebastien Helleu <flashcode>
Group administrator
Fri 20 Dec 2013 02:26:50 PM UTC, original submission:  

Compilation on OmniOS (illumos, which is derived from OpenSolaris) using
autoconf fails due to a few different issues.


    gcc -DHAVE_CONFIG_H -I. -I../..  -DLOCALEDIR=\"/opt/niksula/share/locale\" -I/opt/niksula/include   -I/opt/niksula/include -D_REENTRANT  -Wall -W -Werror-implicit-function-declaration -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_LARGE_FILES -g -O0 -DWEECHAT_VERSION=\"0.4.2\" -DWEECHAT_LICENSE=\"GPL3\" -MT wee-network.o -MD -MP -MF .deps/wee-network.Tpo -c -o wee-network.o wee-network.c
    wee-network.c: In function 'network_connect_child':
    wee-network.c:721:5: error: implicit declaration of function 'CMSG_SPACE' [-Werror=implic
    mv -f .deps/wee-upgrade-file.Tpo .deps/wee-upgrade-file.Po
    wee-network.c:1151:12: error: 'struct msghdr' has no member named 'msg_control'
    wee-network.c:1152:12: error: 'struct msghdr' has no member named 'msg_controllen'
    [ omitting more messages caused by the same issue ]

This is because CMSG_* and the control members require at least XPG4v2. I am
able to work around this by appending -D_XOPEN_SOURCE=600 to CPPFLAGS and
-std=c99 to CFLAGS (compiling as POSIX-1.2001 application). This breaks some
other stuff though:

    libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../.. "-DLOCALEDIR=\"/opt/niksula/share/locale\"" -I/opt/niksula/include -D_XOPEN_SOURCE=600 -I/opt/niksula/include -D_REENTRANT -Wall -W -Werror-implicit-function-declaration -std=c99 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_LARGE_FILES -g -O0 "-DWEECHAT_VERSION=\"0.4.2\"" "-DWEECHAT_LICENSE=\"GPL3\"" -MT irc-protocol.lo -MD -MP -MF .deps/irc-protocol.Tpo -c irc-protocol.c  -fPIC -DPIC -o .libs/irc-protocol.o
    irc-protocol.c:25:0: warning: "_XOPEN_SOURCE" redefined [enabled by default]
    <command-line>:0:0: note: this is the location of the previous definition
    In file included from /opt/gcc-4.7.2/lib/gcc/i386-pc-solaris2.11/4.7.2/include-fixed/iso/stdlib_iso.h:57:0,
                     from /usr/include/stdlib.h:34,
                     from irc-protocol.c:32:
    /opt/gcc-4.7.2/lib/gcc/i386-pc-solaris2.11/4.7.2/include-fixed/sys/feature_tests.h:360:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications         and pre-2001 POSIX applications"

which is because of the _XOPEN_SOURCE definition in the source file. Is there a
reason for this? It might be simpler to have the build system define feature
macros for the standards the application requires instead (-D_XOPEN_SOURCE=600
-std=c99 for POSIX-1.2001) (as a side note illumos does not yet support
POSIX-1.2008 so _XOPEN_SOURCE=700 breaks stuff)

Second, plugins/charset/charset.c uses strcasecmp but does not include

    libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../.. "-DLOCALEDIR=\"/opt/niksula/share/locale\"" -D_XOPEN_SOURCE=500 -I/opt/niksula/include -D_REENTRANT -Wall -W -Werror-implicit-function-declaration -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_LARGE_FILES -g -O0 "-DWEECHAT_VERSION=\"0.4.2\"" "-DWEECHAT_LICENSE=\"GPL3\"" -MT charset.lo -MD -MP -MF .deps/charset.Tpo -c charset.c  -fPIC -DPIC -o .libs/charset.o
    charset.c: In function 'charset_config_init':
    charset.c:212:5: error: implicit declaration of function 'strcasecmp' [-Werror=implicit-function-declaration]
    [ omitting more messages caused by the same issue ]

This is fixed by including strings.h (just string.h is not enough).

There might be more issues, I haven't finished looking into this yet.

As a side note, a generated configure script should be included in release
tarballs (although I do understand autoconf is secondary to you)

Lauri Tirkkonen <lotheac>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by flashcode (Posted a comment)
  • -email is unavailable- added by lotheac (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-08-15 flashcode Open/ClosedOpen Closed
    2014-03-16 flashcode StatusNeed Info Fixed
    2013-12-21 flashcode StatusIn Progress Need Info
    2013-12-20 flashcode Item GroupNone compile/install
        StatusNone In Progress
        Assigned toNone flashcode

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code