[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Mathgl build failure



On Fri, Feb 24, 2012 at 07:13:11PM +0100, Savvas Radevic wrote:
> > mgl_eps.cpp: In member function 'virtual void mglGraphPS::WriteEPS(const
> > char*, const char*)':
> > mgl_eps.cpp:308:55: error: conditional expression between distinct pointer
> > types 'gzFile' and 'FILE* {aka _IO_FILE*}' lacks a cast
> > mgl_eps.cpp:456:19: error: invalid conversion from 'void*' to 'gzFile' [-
> > fpermissive]
> > /usr/include/zlib.h:1488:24: error:   initializing argument 1 of 'int
> > gzclose(gzFile)' [-fpermissive]
> >
> 
> There's a similar error here:
> https://aur.archlinux.org/packages.php?ID=16851&detail=0&comments=all(Under
> "Comment by: ShadowKyogre on Mon, 06 Feb 2012 03:49:32 +0000")
> 
> They suggested to add to the CXX_FLAGS "-fpermissive":

... which only papers over the bug instead of fixing it.  The warning is
correct: this line:

    void *fp = gz ? gzopen(fname,"wt") : fopen(fname,"wt");

tries to mix completely unrelated types.  Both happen to be pointers but not
even that is guaranteed (gzFile is documented as an opaque type).

C allows implicit casts between void* and any pointer type (but not between
two distinct pointer types like in your ?: case!), C++ doesn't allow that.

A quick fix would be adding explicit casts.  This may break on strange
architectures where, for example, pointers to objects of different size
cannot be mixed, but AFAIK it's enough on all Debian archs.



BTW, in your packaging, the "binary" target doesn't depend on "build", which
breaks Policy 4.9.

-- 
// If you believe in so-called "intellectual property", please immediately
// cease using counterfeit alphabets.  Instead, contact the nearest temple
// of Amon, whose priests will provide you with scribal services for all
// your writing needs, for Reasonable and Non-Discriminatory prices.

Attachment: signature.asc
Description: Digital signature


Reply to: