Bug 209407

Summary: devel/jsoncpp: Update to 1.7.2
Product: Ports & Packages Reporter: Yuri Victorovich <yuri>
Component: Individual Port(s)Assignee: Kurt Jaeger <pi>
Status: Closed FIXED    
Severity: Affects Only Me CC: brd, johan, pi, rleigh, swills
Priority: --- Flags: pi: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch
none
patch
none
patch
none
patch
none
Additonal patch fixing includedir in .pc none

Description Yuri Victorovich freebsd_committer 2016-05-09 21:51:02 UTC
Created attachment 170160 [details]
patch

Synopsis of changes:
* Added jsoncpp.pc file for pkg-config
* USE_GCC=yes for 9.X to fix compilation problem

An important package devel/cmake depends on jsoncpp, so I made sure they both build in poudriere in both 10.2 and 9.3.
Comment 1 Yuri Victorovich freebsd_committer 2016-05-09 21:52:15 UTC
Also switched to github since the new version seem to be distributed from there.
Comment 2 Yuri Victorovich freebsd_committer 2016-05-09 23:34:24 UTC
Created attachment 170161 [details]
patch
Comment 3 Kurt Jaeger freebsd_committer 2016-05-10 05:35:15 UTC
There are two other attempts to update jsoncpp, see:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200648

and

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200939

and they both stalled. Does this PR adress the issues raised in the other PRs ?
If yes, how ?
Comment 4 Yuri Victorovich freebsd_committer 2016-05-10 06:15:30 UTC
Sorry, I didn't see the previous Bug reports.

Now that I read them, they are talking about scons deprecation in favor of cmake build. Going with cmake build obviously creates a problem with circular dependency with cmake.

My patch solves this scons vs cmake problem by going with scons build. It works, with some extra steps added by Makefile.

Since this is such an involved port, I would like to suggest to do an exp-run with the patch to see if anything else breaks. I would be absolutely willing to resolve the issues, unless there are hundreds of them, which is probably unlikely.
Comment 5 Yuri Victorovich freebsd_committer 2016-05-10 06:24:45 UTC
I asked mat@ if he thinks it makes sense to do an exp-run.
Comment 6 Yuri Victorovich freebsd_committer 2016-05-14 23:45:25 UTC
I've rebuilt the whole kde4 tree, firefox, thunderbird, chrome, qTox, etc without any failures of any kind in build and run.

So I am fairly confident there is no danger.
Comment 7 Kurt Jaeger freebsd_committer 2016-05-15 02:04:34 UTC
Thanks for the testing. I've now asked all involved from all jsoncpp-PRs if we can proceed with this update.
Comment 8 Yuri Victorovich freebsd_committer 2016-05-15 03:28:13 UTC
Created attachment 170307 [details]
patch

Thanks Kurt.

Now I added c++11 because as it turned out jsoncpp has some optional parts of API turned on by the C++ compiler features. c++11 makes users be able to use those if users happen to compile with c++11 option. Otherwise user builds fail with missing symbols in Json:: namespace.

Yuri
Comment 9 Kurt Jaeger freebsd_committer 2016-05-15 07:49:28 UTC
This newer version fails to build on 9.3a:

http://people.freebsd.org/~pi/logs/devel__jsoncpp-93a-1463298259.txt

Builds on other versions are fine.
Comment 10 Yuri Victorovich freebsd_committer 2016-05-15 08:10:57 UTC
Created attachment 170313 [details]
patch

Sorry about that.
Now it builds on both 9.3 and 10.3.
Comment 11 Brad Davis freebsd_committer 2016-05-15 16:23:05 UTC
*** Bug 200648 has been marked as a duplicate of this bug. ***
Comment 12 Steve Wills freebsd_committer 2016-05-16 00:57:16 UTC
*** Bug 200939 has been marked as a duplicate of this bug. ***
Comment 13 Kurt Jaeger freebsd_committer 2016-05-16 08:38:33 UTC
testsbuilds on 11amd64, 11armv6, 10.3i+a, 9.3a all fine
Comment 14 Kurt Jaeger freebsd_committer 2016-05-16 09:05:31 UTC
maint-approve by mail
Comment 15 commit-hook freebsd_committer 2016-05-17 17:00:36 UTC
A commit references this bug:

Author: pi
Date: Tue May 17 17:00:16 UTC 2016
New revision: 415395
URL: https://svnweb.freebsd.org/changeset/ports/415395

Log:
  devel/jsoncpp: 0.6.0 -> 1.7.2

  Changes: https://github.com/open-source-parsers/jsoncpp/releases
  - Changed distsite to github
  - This is a major upgrade, please report any issues

  PR:		209407
  Submitted by:	yuri@rawbw.com
  Approved by:	johan@stromnet.se (maintainer)
  Reviewed by:	brd, swills

Changes:
  head/devel/jsoncpp/Makefile
  head/devel/jsoncpp/distinfo
  head/devel/jsoncpp/files/patch-SConstruct
  head/devel/jsoncpp/files/patch-include_json_config.h
  head/devel/jsoncpp/files/patch-src_lib__json_sconscript
  head/devel/jsoncpp/pkg-descr
  head/devel/jsoncpp/pkg-plist
Comment 16 Kurt Jaeger freebsd_committer 2016-05-17 17:01:14 UTC
Committed, thanks to all involved. I'll keep this open for a few days for fallout.
Comment 17 commit-hook freebsd_committer 2016-05-17 18:01:43 UTC
A commit references this bug:

Author: pi
Date: Tue May 17 18:01:16 UTC 2016
New revision: 415401
URL: https://svnweb.freebsd.org/changeset/ports/415401

Log:
  devel/jsoncpp: bump portrevision for dependent ports for shlib change .0 -> .1

  PR:		209407
  Submitted by:	sunpoet

Changes:
  head/devel/cmake/Makefile
  head/science/orthanc/Makefile
  head/science/orthanc-dicomweb/Makefile
  head/science/orthanc-postgresql/Makefile
  head/science/orthanc-webviewer/Makefile
  head/www/chromium/Makefile
Comment 18 Roger Leigh 2016-05-20 23:34:19 UTC
Hi folks,

The new jsoncpp fails to build on 10.3/powerpc:

scons: Building targets ...
c++ -o buildscons/linux-gcc-FreeBSD/src/jsontestrunner/main.o -c -O2 -pipe -fno-strict-aliasing --std=c++11 -Iinclude -I. src/jsontestrunner/main.cpp
cc1plus: error: unrecognized command line option "-std=c++11"
scons: *** [buildscons/linux-gcc-FreeBSD/src/jsontestrunner/main.o] Error 1

Due to still using GCC 4.2.1 on this platform, where the option isn't supported.  Would it be possible to make this port use a newer GCC to build?


Thanks,
Roger
Comment 19 Yuri Victorovich freebsd_committer 2016-05-20 23:42:21 UTC
Hi Roger,

Why don't try with something like this:
.if (${ARCH} == "powerpc")
USE_GCC=     4.9+
.endif

Please change gcc version to what is desired.
Comment 20 Johan Ström 2016-05-21 17:03:14 UTC
Hi,

could someone else please take maintainership of this port?

Thanks
Comment 21 Johan Ström 2016-05-27 06:10:46 UTC
The /usr/local/libdata/pkgconfig/jsoncpp.pc file installed has an invalid include dir:

prefix=/usr/local
exec_prefix=${prefix}
libdir=/usr/local/lib
includedir=/usr/local/jsoncpp



$ pkg info -l jsoncpp 
jsoncpp-1.7.2:
        /usr/local/include/jsoncpp/json/allocator.h
...
        /usr/local/include/jsoncpp/json/version.h
        /usr/local/lib/libjsoncpp.a
...
        /usr/local/lib/libjsoncpp.so.1.7.2
...
Comment 22 Yuri Victorovich freebsd_committer 2016-05-27 06:32:31 UTC
Created attachment 170712 [details]
Additonal patch fixing includedir in .pc

Hi Johan,

You are right, this path is wrong. I am attaching an additional patch fixing this.

The main patch is already committed in r415395, but this bug report is not closed for some reason.
Comment 23 commit-hook freebsd_committer 2016-05-27 12:02:56 UTC
A commit references this bug:

Author: pi
Date: Fri May 27 12:01:57 UTC 2016
New revision: 415936
URL: https://svnweb.freebsd.org/changeset/ports/415936

Log:
  devel/jsoncpp: fix jsoncpp.pc includedir

  - and: submitter becomes maintainer

  PR:		209407
  Submitted by:	yuri@rawbw.com (new maintainer)
  Reported by:	johan@stromnet.se (old maintainer)
  Approved by:	johan@stromnet.se (old maintainer)

Changes:
  head/devel/jsoncpp/Makefile
Comment 24 Roger Leigh 2016-05-27 19:34:38 UTC
I tried it on powerpc with gcc 4.9, but it fails with a stdlib error, possibly a gcc/clang stdlib mismatch of some sort.  Either that or the jsoncpp #define workaround is broken in this situation.

# make install
===>  Building for jsoncpp-1.7.2
scons: Reading SConscript files ...
Using platform 'linux-gcc-FreeBSD'
LD_LIBRARY_PATH = :libs/linux-gcc-FreeBSD
Building using PLATFORM = linux-gcc-FreeBSD

scons: warning: The build_dir keyword has been deprecated; use the variant_dir keyword instead.
File "/usr/ports/devel/jsoncpp/work/jsoncpp-1.7.2/SConstruct", line 212, in buildProjectInDirectory

scons: warning: The build_dir keyword has been deprecated; use the variant_dir keyword instead.
File "/usr/ports/devel/jsoncpp/work/jsoncpp-1.7.2/SConstruct", line 212, in buildProjectInDirectory

scons: warning: The build_dir keyword has been deprecated; use the variant_dir keyword instead.
File "/usr/ports/devel/jsoncpp/work/jsoncpp-1.7.2/SConstruct", line 212, in buildProjectInDirectory
scons: done reading SConscript files.
scons: Building targets ...
g++49 -o buildscons/linux-gcc-FreeBSD/src/lib_json/json_reader.o -c -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc49 -fno-strict-aliasing --std=c++11 -Wl,-rpath=/usr/local/lib/gcc49 -Iinclude src/lib_json/json_reader.cpp
src/lib_json/json_reader.cpp: In member function 'std::string Json::Reader::getLocationLineAndColumn(Json::Reader::Location) const':
src/lib_json/json_reader.cpp:34:18: error: 'snprintf' is not a member of 'std'
 #define snprintf std::snprintf
                  ^
src/lib_json/json_reader.cpp:817:3: note: in expansion of macro 'snprintf'
   snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
   ^
src/lib_json/json_reader.cpp:34:18: note: suggested alternative:
 #define snprintf std::snprintf
                  ^
src/lib_json/json_reader.cpp:817:3: note: in expansion of macro 'snprintf'
   snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
   ^
In file included from /usr/local/lib/gcc49/include/c++/cstdio:42:0,
                 from src/lib_json/json_reader.cpp:13:
/usr/local/lib/gcc49/gcc/powerpc-portbld-freebsd10.3/4.9.4/include-fixed/stdio.h:296:6: note:   'snprintf'
 int  snprintf(char * __restrict, size_t, const char * __restrict,
      ^
src/lib_json/json_reader.cpp: In member function 'std::string Json::OurReader::getLocationLineAndColumn(Json::OurReader::Location) const':
src/lib_json/json_reader.cpp:34:18: error: 'snprintf' is not a member of 'std'
 #define snprintf std::snprintf
                  ^
src/lib_json/json_reader.cpp:1823:3: note: in expansion of macro 'snprintf'
   snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
   ^
src/lib_json/json_reader.cpp:34:18: note: suggested alternative:
 #define snprintf std::snprintf
                  ^
src/lib_json/json_reader.cpp:1823:3: note: in expansion of macro 'snprintf'
   snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
   ^
In file included from /usr/local/lib/gcc49/include/c++/cstdio:42:0,
                 from src/lib_json/json_reader.cpp:13:
/usr/local/lib/gcc49/gcc/powerpc-portbld-freebsd10.3/4.9.4/include-fixed/stdio.h:296:6: note:   'snprintf'
 int  snprintf(char * __restrict, size_t, const char * __restrict,
      ^
scons: *** [buildscons/linux-gcc-FreeBSD/src/lib_json/json_reader.o] Error 1
scons: building terminated because of errors.
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make: stopped in /usr/ports/devel/jsoncpp