Bug 226401 - devel/jsoncpp scons build system claimed obsolete. moreover, won't build if system default python is 3.*
Summary: devel/jsoncpp scons build system claimed obsolete. moreover, won't build if s...
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Yuri Victorovich
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2018-03-06 19:58 UTC by Dan Lukes
Modified: 2020-01-14 22:43 UTC (History)
9 users (show)

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


Attachments
scons->cmake patch for head/devel/jsoncpp/Makefile 462353 2018-02-19 22:25:14Z yuri (1.42 KB, patch)
2018-03-06 19:58 UTC, Dan Lukes
no flags Details | Diff
patch (7.60 KB, patch)
2018-03-21 17:20 UTC, Yuri Victorovich
no flags Details | Diff
Fixed SConstruct to support Python3 (2.72 KB, patch)
2018-08-18 17:07 UTC, Eir Nym
no flags Details | Diff
Fix jsoncpp build with python 3 (2.22 KB, patch)
2019-09-03 18:32 UTC, Renato Botelho
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Lukes 2018-03-06 19:58:52 UTC
Created attachment 191258 [details]
scons->cmake patch for  head/devel/jsoncpp/Makefile 462353 2018-02-19 22:25:14Z yuri

== Issue ==

1. From README.md: "The SCons-based build system is deprecated. Please use CMake"

2. From SConstruct: "shared library support is buggy: it assumes that a static and dynamic library can be build from the same object files. This is not true on many platforms"

3. With python 3.* claimed system default it doesn't build because of several syntax errors in SConstruct and undefined functions called

 == Solution (all three issues) ==

Follow README.md and use CMake instead of scons. It require simple change in Makefile only, see attachment. Moreover, devel/jsoncpp/files/patch-SConstruct and devel/jsoncpp/files/patch-src_lib__json_sconscript become obsolete and can be removed.

Brief summary of Makefile changes:

1: scons replaced by cmake:noninja in USES
2: scons related args PLATFORM and MAKE_ARGS replaced by CMAKE_ARGS
3: paths in "do_install" modified to follow CMAKE flavor of build tree
4: "do-test" modified to follow CMAKE flavor of test
Comment 1 Steve Wills freebsd_committer freebsd_triage 2018-03-21 15:23:38 UTC
(In reply to Dan Lukes from comment #0)

This causes a dependency loop because cmake requires jsoncpp.

One way to avoid the loop might be to create a port for cmake without jsoncpp support and use that to build jsoncpp. Then the regular cmake port can depend on jsoncpp.
Comment 2 Yuri Victorovich freebsd_committer freebsd_triage 2018-03-21 16:29:35 UTC
(In reply to Steve Wills from comment #1)

They also support meson build. This is another possible solution.
Comment 3 Dan Lukes 2018-03-21 17:01:47 UTC
(In reply to Steve Wills from comment #1)
Or use --no-system-jsoncpp option during configuration phase of devel/cmake. It's the solution I'm using now. 

I will take whatever solution that will work. 

As mentioned already, SCons doesn't compile on system with python 3.* claimed default and even worse, it seems it create broken binaries on some platforms (i didn't verified it by self).
Comment 4 Yuri Victorovich freebsd_committer freebsd_triage 2018-03-21 17:03:46 UTC
(In reply to Dan Lukes from comment #3)

Ok, I will update within a few days.
Comment 5 Yuri Victorovich freebsd_committer freebsd_triage 2018-03-21 17:20:38 UTC
Created attachment 191711 [details]
patch

This patch uses meson.
Comment 6 Yuri Victorovich freebsd_committer freebsd_triage 2018-03-21 17:30:45 UTC
It'll take me a while to make sure all dependencies work with this new version. Chromium is a dependency.
Comment 7 Yuri Victorovich freebsd_committer freebsd_triage 2018-03-21 17:36:44 UTC
math/pdal fails: https://github.com/PDAL/PDAL/issues/1866
Comment 8 Dan Lukes 2018-03-21 22:53:09 UTC
(In reply to Yuri Victorovich from comment #7)
math/pdal (current version, e.g. 1.6_2) doesn't compile even now, if PYTHON option is unset during config phase. It seems PYNUMPY is required to compile PDAL all the times, just RUN dependency to Python can be avoided by -DBUILD_PLUGIN_PYTHON:BOOL=FALSE

But bug #226401 (this bug) is not dedicated to math/pdal bugs, of course - I would just like to note that PDAL port is broken regardless JSONCPP version

 =================

according https://github.com/PDAL/PDAL/issues/1866

you may consider not to wait for next PDAL release. The issue has been patched by very simple patch - all five occurrences of

Json::Value name = dim.removeMember(".....");

has been replaced by

Json::Value name = dim.get(".....", empty);
dim.removeMember(".....");

You may consider to use 1.8.4 even with current PDAL if following patch will placed in math/pdal/files/ :

https://github.com/PDAL/PDAL/commit/f717a4ceabf2c23fcb03838945865cd54a4698c7
Comment 9 Yuri Victorovich freebsd_committer freebsd_triage 2018-03-22 02:32:05 UTC
PDAL python bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226838
Comment 10 Eir Nym 2018-08-18 17:07:28 UTC
Created attachment 196322 [details]
Fixed SConstruct to support Python3

This is patch for SConstruct build file to match python support as do SCons itself (current version supports Python2.7 and Python 3.5+)
Comment 11 Eir Nym 2018-08-18 17:08:18 UTC
Please also refer the issuse https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230734 on SCons itself
Comment 12 Val Packett 2018-09-25 09:27:23 UTC
Is it possible to install cmake config files for jsoncpp when building with scons/meson somehow?
Comment 13 Daniel Gerzo freebsd_committer freebsd_triage 2018-12-28 12:41:42 UTC
(In reply to Eir Nym from comment #11)
the attached patch to SConstruct is no different to what we have in svn now (and doesn't allow to build with python3), maybe you have attached a wrong file?
Comment 14 Eir Nym 2019-05-05 16:40:21 UTC
(In reply to Daniel Gerzo from comment #13)
Indeed. The jsoncpp was updated to drop scons as build system (update was requested in another issue)

BTW, The jsoncpp 1.8.4 works fine for me with all my apps without additional patches.
Comment 15 Radim Kolar 2019-08-16 10:53:47 UTC
It is not true that SCons builds shared library from the same object files as static library. Unless they have really heavily hacked SCons build system standard version:

libshared = env.SharedLibrary(target = 'libname', source = Split("a.c b.c"))

will do the right thing.

Python 2/3 compatibility for scons_site scripts needs just minor adjustments, I did it for my two projects yesterday.
Comment 16 Renato Botelho freebsd_committer freebsd_triage 2019-09-03 18:32:47 UTC
Created attachment 207161 [details]
Fix jsoncpp build with python 3

I needed to test a port that depends of jsoncpp and it was broken on my poudriere session so I did the changes contained in this attachment to SConstruct to make it build and be able to finish my tests.
Comment 17 Daniel Engberg freebsd_committer freebsd_triage 2020-01-14 22:26:26 UTC
Can be closed as of r522975?
Comment 18 Yuri Victorovich freebsd_committer freebsd_triage 2020-01-14 22:43:18 UTC
The port update has been committed.