Bug 218178

Summary: devel/jsoncpp: Faila to build on sparc64: snprintf is not a member of std
Product: Ports & Packages Reporter: Michał "phoe" Herda <phoe>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed Overcome By Events    
Severity: Affects Only Me CC: brooks, emaste, linimon, w.schwarzenfeld, yuri
Priority: --- Keywords: needs-qa
Version: LatestFlags: bugzilla: maintainer-feedback? (yuri)
koobs: merge-quarterly?
Hardware: sparc64   
OS: Any   

Description Michał "phoe" Herda 2017-03-28 08:08:56 UTC
Requires patches to build on 11.0-RELEASE on sparc64.

For making it compile, I needed to comment out the preprocessor lines which "#define snprintf std::snprintf" in the following files:

src/lib_json/json_writer.cpp
src/lib_json/json_reader.cpp

The errors generated are like:
src/lib_json/json_writer.cpp: In function 'std::__cxx11::string Json::valueToString(double, bool, unsigned int)':
src/lib_json/json_writer.cpp:61:18: error: 'snprintf' is not a member of 'std'
 #define snprintf std::snprintf 
                  ^          
src/lib_json/json_writer.cpp:151:11: note: in expansion of macro 'snprintf'
     len = snprintf(buffer, sizeof(buffer), formatString, value);  
           ^ 
src/lib_json/json_writer.cpp:61:18: note: suggested alternative: 
 #define snprintf
Comment 1 Yuri Victorovich freebsd_committer freebsd_triage 2017-03-28 08:36:07 UTC
I don't have sparc, and didn't know it is still in use.

Patches are welcome!
Comment 2 Michał "phoe" Herda 2017-03-28 08:43:20 UTC
Hi Yuri,

I will need some help with making the patch - I am not proficient with C/C++ enough to do it on my own.

I suggest I will need some help with the preprocessor directives, like adding one more check for sparc64 in the ifdefs. Once it is done, I will need some kind of CI check to make sure this package still builds on all other architectures.

~phoe
Comment 3 Yuri Victorovich freebsd_committer freebsd_triage 2017-03-28 08:55:35 UTC
1. Create a copy of each file that you need to change with .orig extension
2. Modify the files
3. Run 'make patch' to generate corresponding patches (under files/)
4. Run 'svn add file/patch-...' to add the patches
5. Run 'svn patch' to generate a patch
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2017-03-28 11:52:51 UTC
(In reply to Yuri Victorovich from comment #1)

I have several machines here, one of which is dedicated to building packages (see https://wiki.freebsd.org/Sparc64Packages).  I can test package builds for anyone that needs it on one of the spares.
Comment 5 Yuri Victorovich freebsd_committer freebsd_triage 2017-04-16 22:18:10 UTC
I think this is a problem of C++ support on FreeBSD.
Comment 6 Yuri Victorovich freebsd_committer freebsd_triage 2017-04-17 00:08:31 UTC
CCed to clang maintainer, because this looks like a generic C++ support problem.
Comment 7 Ed Maste freebsd_committer freebsd_triage 2017-07-06 13:13:38 UTC
Is this building using a clang port or package, or is it using the in-tree (for sparc64) GCC 4.2.1?
Comment 8 Michał "phoe" Herda 2017-07-22 15:57:10 UTC
I no longer have a FreeBSD installation available to work on this bug.
Comment 9 Walter Schwarzenfeld 2018-02-02 16:57:32 UTC
Is this overcome by events?
Comment 10 Yuri Victorovich freebsd_committer freebsd_triage 2018-02-02 17:24:24 UTC
(In reply to w.schwarzenfeld from comment #9)

I didn't hear people complain.
Michał, please reopen this if this is still a problem.