Bug 225295 - editors/pdfedit: build error: kernel/cxref.h:422:18: error: non-constant-expression
Summary: editors/pdfedit: build error: kernel/cxref.h:422:18: error: non-constant-expr...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Tobias Kortkamp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-18 11:17 UTC by O. Hartmann
Modified: 2018-08-25 05:01 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (hrs)


Attachments
Two patch files included for editors/pdfedit (application/x-tar) (37.50 KB, application/x-tar)
2018-04-30 18:40 UTC, 1wkmmr
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2018-01-18 11:17:36 UTC
On recent CURRENT (FreeBSD 12.0-CURRENT #14 r328101: Wed Jan 17 23:57:27 CET 2018 amd64, WITH_LLD_IS_LD=YES), updating port editors/pdfedit fails with the error:

[...]
c++ -c -O2 -pipe -fstack-protector -fno-strict-aliasing    -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fno-strict-aliasing -fexceptions      -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fno-strict-aliasing -fexceptions      -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fno-strict-aliasing -fexceptions     -I. -I/usr/ports/editors/pdfedit/work/pdfedit-0.4.5/src -I/usr/ports/editors/pdfedit/work/pdfedit-0.4.5/src/xpdf/  -I/usr/local/include -I/usr/local/include/freetype2 -I/usr/local/include/libpng16 -I/usr/local/include -I/usr/include -o streamwriter.o streamwriter.cc
In file included from cxref.cc:28:
/usr/ports/editors/pdfedit/work/pdfedit-0.4.5/src/kernel/cxref.h:422:18: error: non-constant-expression cannot be narrowed from type 'pdfobjects::IndiRef::ObjNum' (aka 'unsigned int') to 'int' in initializer list [-Wc++11-narrowing]
                ::Ref xpdfRef={ref.num, ref.gen};
                               ^~~~~~~
/usr/ports/editors/pdfedit/work/pdfedit-0.4.5/src/kernel/cxref.h:422:18: note: insert an explicit cast to silence this issue
                ::Ref xpdfRef={ref.num, ref.gen};
                               ^~~~~~~
                               static_cast<int>( )
/usr/ports/editors/pdfedit/work/pdfedit-0.4.5/src/kernel/cxref.h:422:27: error: non-constant-expression cannot be narrowed from type 'pdfobjects::IndiRef::GenNum' (aka 'unsigned int') to 'int' in initializer list [-Wc++11-narrowing]
                ::Ref xpdfRef={ref.num, ref.gen};
Comment 1 1wkmmr 2018-04-30 18:40:01 UTC
Created attachment 192936 [details]
Two patch files included for editors/pdfedit (application/x-tar)
Comment 2 1wkmmr 2018-04-30 18:44:48 UTC
Comment on attachment 192936 [details]
Two patch files included for editors/pdfedit (application/x-tar)

Hi,

I have experienced the same trouble. 
Versions of Ports and FreeBSD are as follows: 
  # $FreeBSD: head/editors/pdfedit/Makefile 467711 2018-04-18 13:57:42Z jbeich $

  FreeBSD 11.2-PRERELEASE FreeBSD 11.2-PRERELEASE #1 r333087: amd64

Now, I attach two patch files as workaround. 
This patch makes compilation successful, anyway. 

Cheers
Comment 3 1wkmmr 2018-04-30 19:03:39 UTC
Comment on attachment 192936 [details]
Two patch files included for editors/pdfedit (application/x-tar)

I changed mime type, application/x-tar
Comment 4 commit-hook freebsd_committer 2018-08-25 05:00:41 UTC
A commit references this bug:

Author: tobik
Date: Sat Aug 25 05:00:37 UTC 2018
New revision: 478001
URL: https://svnweb.freebsd.org/changeset/ports/478001

Log:
  editors/pdfedit: Fix build with Clang 6

  /wrkdirs/usr/ports/editors/pdfedit/work/pdfedit-0.4.5/src/kernel/cxref.h:422:18: error: non-constant-expression cannot be narrowed from type 'pdfobjects::IndiRef::ObjNum' (aka 'unsigned int') to 'int' in initializer list [-Wc++11-narrowing]
                  ::Ref xpdfRef={ref.num, ref.gen};
                                 ^~~~~~~
  /wrkdirs/usr/ports/editors/pdfedit/work/pdfedit-0.4.5/src/kernel/cxref.h:422:18: note: insert an explicit cast to silence this issue
                  ::Ref xpdfRef={ref.num, ref.gen};
                                 ^~~~~~~
                                 static_cast<int>( )

  http://beefy11.nyi.freebsd.org/data/head-i386-default/p477696_s338122/logs/errors/pdfedit-0.4.5_11.log

  PR:		225295
  Reported by:	O. Hartmann <ohartmann@walstatt.org>

Changes:
  head/editors/pdfedit/Makefile
Comment 5 Tobias Kortkamp freebsd_committer 2018-08-25 05:01:32 UTC
(In reply to 1wkmmr from comment #2)
I am sorry I did not have time to do a thorough code review to find
out if the patches are good and have applied a blanket fix
(USE_CXXSTD=c++98) instead.

It should build fine now.