[bug #40981] illumos compilation issues

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug #40981] illumos compilation issues

Eric L.-2
URL:
  <http://savannah.nongnu.org/bugs/?40981>

                 Summary: illumos compilation issues
                 Project: WeeChat
            Submitted by: lotheac
            Submitted on: Fri 20 Dec 2013 02:26:50 PM GMT
                Category: compilation
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name:
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 0.4.2
                IRC nick: lotheac

    _______________________________________________________

Details:

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

First:

    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
    it-function-declaration]
    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
strings.h:

    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)





    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?40981>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
Weechat-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-dev
Reply | Threaded
Open this post in threaded view
|

[bug #40981] illumos compilation issues

Eric L.-2
Update of bug #40981 (project weechat):

              Item Group:                    None => compile/install        
                  Status:                    None => In Progress            
             Assigned to:                    None => flashcode              

    _______________________________________________________

Follow-up Comment #1:

Hi,

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).

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?40981>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.nongnu.org/


_______________________________________________
Weechat-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-dev
Reply | Threaded
Open this post in threaded view
|

[bug #40981] illumos compilation issues

Eric L.-2
Update of bug #40981 (project weechat):

                  Status:             In Progress => Need Info              

    _______________________________________________________

Follow-up 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
#endif


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).

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?40981>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.nongnu.org/


_______________________________________________
Weechat-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-dev
Reply | Threaded
Open this post in threaded view
|

[bug #40981] illumos compilation issues

Eric L.-2
Follow-up Comment #3, bug #40981 (project weechat):

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).

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?40981>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
Weechat-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-dev
Reply | Threaded
Open this post in threaded view
|

[bug #40981] illumos compilation issues

Eric L.-2
Follow-up Comment #4, bug #40981 (project weechat):

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.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?40981>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
Weechat-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-dev
Reply | Threaded
Open this post in threaded view
|

[bug #40981] illumos compilation issues

Eric L.-2
Follow-up Comment #5, bug #40981 (project weechat):

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

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?40981>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.nongnu.org/


_______________________________________________
Weechat-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-dev
Reply | Threaded
Open this post in threaded view
|

[bug #40981] illumos compilation issues

Eric L.-2
Follow-up Comment #6, bug #40981 (project weechat):

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
define  _XOPEN_SOURCE and set _XOPEN_SOURCE_EXTENDED=1.   If _XOPEN_SOURCE is
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
(_XOPEN_SOURCE=700).

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.


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?40981>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
Weechat-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-dev
Reply | Threaded
Open this post in threaded view
|

[bug #40981] illumos compilation issues

Eric L.-2
Follow-up Comment #7, bug #40981 (project weechat):

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

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?40981>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.nongnu.org/


_______________________________________________
Weechat-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-dev
Reply | Threaded
Open this post in threaded view
|

[bug #40981] illumos compilation issues

Eric L.-2
Update of bug #40981 (project weechat):

                  Status:               Need Info => Fixed                  

    _______________________________________________________

Follow-up 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

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?40981>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.nongnu.org/


_______________________________________________
Weechat-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-dev