Build 6.2.0 fails on Solaris

While building 6.2.0 on Solaris 10 SPARC with gcc 7.3.0, gmake ends thusly:

    liboctave/wrappers/iconv-wrappers.c:35:1: error: conflicting types for 'octave_iconv_open_wrapper'
     octave_iconv_open_wrapper (const char *tocode, const char *fromcode)
    In file included from liboctave/wrappers/iconv-wrappers.c:32:0:
    liboctave/wrappers/iconv-wrappers.h:34:1: note: previous declaration of 'octave_iconv_open_wrapper' was here
     octave_iconv_open_wrapper (const char *tocode, const char *fromcode);
    liboctave/wrappers/iconv-wrappers.c:41:1: error: conflicting types for 'octave_iconv_close_wrapper'
     octave_iconv_close_wrapper (iconv_t cd)
    In file included from liboctave/wrappers/iconv-wrappers.c:32:0:
    liboctave/wrappers/iconv-wrappers.h:37:1: note: previous declaration of 'octave_iconv_close_wrapper' was here
     octave_iconv_close_wrapper (void *cd);

The second one is an issue but I don’t get the first one. Both declataions look the same to me. Any help would be appreciated.

OK, I get it. The declaration was split over two lines so the error output only showed the second lines (which are identical). In the first error the function is declared “extern void *” in the .h file and “iconv_t” in the c file. Which one is right?

Could you file a bug report about this at

Looks like it should be extern iconv_t in iconv-wrappers.h for octave_iconv_open_wrapper. But, I don’t know if that will compile or not.

EDIT: Nope, it won’t compile.

Can you check the contents of /usr/include/iconv.h or wherever that header file is located on a Solaris machine? On my Linux machine there is a typedef for iconv_t to void *. It may be that the compiler is simply being overly literal and saying iconv_t != void * at a lexical level. But as soon as you substitute what iconv_t stands for then you get the correct result.

" Could you file a bug report about this at"
I would if I could figure out how. I managed to log in but all I see is a page that says “Bugs: Browse items” with no “New item” or something.

I’ve got

     * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
     * Use is subject to license terms.

    #ifndef	_ICONV_H
    #define	_ICONV_H

    #pragma ident	"@(#)iconv.h	1.3	03/12/04 SMI"

    #include <sys/feature_tests.h>
    #include <sys/types.h>

    #ifdef	__cplusplus
    extern "C" {

    typedef struct _iconv_info *iconv_t;

    #if defined(__STDC__)
    extern iconv_t	iconv_open(const char *, const char *);
    #ifdef _XPG6
    extern size_t	iconv(iconv_t, char **_RESTRICT_KYWD,
    		size_t *_RESTRICT_KYWD, char **_RESTRICT_KYWD,
    		size_t *_RESTRICT_KYWD);
    extern size_t	iconv(iconv_t, const char **_RESTRICT_KYWD,
    		size_t *_RESTRICT_KYWD, char **_RESTRICT_KYWD,
    		size_t *_RESTRICT_KYWD);
    extern int	iconv_close(iconv_t);
    #else /* __STDC__ */
    extern iconv_t	iconv_open();
    extern size_t	iconv();
    extern int	iconv_close();

    #ifdef	__cplusplus

    #endif	/* _ICONV_H */

The Savannah interface is a little old school…


Or as URL GNU Octave - Bugs: Submit Item [Savannah]

IIRC, we wanted to avoid including the headers in the iconv_wrappers.h file that we’d need to use the correct type there. In my memory, I asked how to best work with that, and we’d decided to just use void* instead of the “correct” type in the header. (But I could be mixing things up. I cannot find where that was now.)

A possible solution might be to cast between void* and the type used on the respective system (i.e. iconv_t) inside the wrapper functions and use void* in the function definition, too. I’ll provide a patch when we’ll have a bug report.

Ah ha! Thanks. I guess I should have read my +1 blessed scroll of invisible command detection. Anyway, it’s entered now: GNU Octave - Bugs: bug #60162, Conflicting types for... [Savannah]

In the interest of expediency, I just changed the definitions in iconv_wrappers.c to exactly match those in iconv_wrappers.h. I don’t know if that’s good or not but it made the compiler happy. It’s now stopping further along but I suppose I should open another topic for that.

octave_iconv_open_wrapper (const char *tocode, const char *fromcode)
  return iconv_open (tocode, fromcode);

int octave_iconv_close_wrapper (iconv_t cd)
  return iconv_close (cd);

Yes, the idea of the wrappers is to hide as much as possible the details of these C functions including special types like iconv_t, so we don’t want to include any system-dependent headers in the wrapper header files.