~alpine/devel

1

[alpine-devel] Missing 64-bit support in jsoncpp-dev build

Andrew Bell
Details
Message ID
<CACJ51z1y_eMXCx5=6cwrJL=RWWce-1rGyFMRqOMcDFRoANy_hg@mail.gmail.com>
Sender timestamp
1519497700
DKIM signature
missing
Download raw message
Hi,

It seems that there's a problem with the way that the jsoncpp-dev package
was built. It's missing support for 64-bit integer types on x86_64 and
perhaps other platforms.

Checking the contents of the library for 64 bit Json::Values, I see that
they're missing (no long long, unsinged long long)

$ readelf -W --dyn-sym libjsoncpp.so | c++filt | grep "Value::Value"
    89: 0000000000018a3a    42 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(double)
    94: 00000000000189ba    32 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(int)
    98: 00000000000189da    32 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(unsigned int)
   100: 00000000000189fa    31 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(long)
   102: 0000000000018a1a    31 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(unsigned long)
   112: 0000000000018aa6    35 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(Json::Value&&)
   148: 0000000000018a64    35 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(Json::StaticString const&)
   260: 0000000000018cb8    51 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(char const*, char const*)
   305: 0000000000018be6   210 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(char const*)
   332: 0000000000018cb8    51 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(char const*, char const*)
   392: 0000000000018aca   162 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(Json::ValueType)
   438: 000000000001ad74   627 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(Json::Value const&)
   452: 0000000000018be6   210 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(char const*)
   453: 0000000000018a64    35 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(Json::StaticString const&)
   503: 0000000000018aca   162 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(Json::ValueType)
   559: 0000000000018a88    30 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(bool)
   561: 0000000000018a3a    42 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(double)
   564: 00000000000189ba    32 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(int)
   567: 00000000000189da    32 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(unsigned int)
   572: 00000000000189fa    31 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(long)
   574: 0000000000018dc6    46 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)
   575: 0000000000018a1a    31 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(unsigned long)
   579: 000000000001ad74   627 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(Json::Value const&)
   585: 0000000000018dc6    46 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&)
   591: 0000000000018aa6    35 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(Json::Value&&)
   612: 0000000000018a88    30 FUNC    GLOBAL DEFAULT   10
Json::Value::Value(bool)

There's a place you can turn off 64-bit support off in config.h, but it's
commented out in the distribution and I don't know why 64-bit support
wouldn't be provided as part of the package on x86_64:

// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
// integer
// Storages, and 64 bits integer support is disabled.
// #define JSON_NO_INT64 1

So at a minimum, there's a mismatch between the provided header file and
library.

$ apk info jsoncpp-dev
jsoncpp-dev-1.8.1-r1 description:
JSON C++ library (development files)

jsoncpp-dev-1.8.1-r1 webpage:
https://github.com/open-source-parsers/jsoncpp

jsoncpp-dev-1.8.1-r1 installed size:
122880

-- 
Andrew Bell
andrew.bell.ia@gmail.com
A. Wilcox
Details
Message ID
<5b36c79e-dfd2-898b-e2cb-304448f4ecae@adelielinux.org>
In-Reply-To
<CACJ51z1y_eMXCx5=6cwrJL=RWWce-1rGyFMRqOMcDFRoANy_hg@mail.gmail.com> (view parent)
Sender timestamp
1519500360
DKIM signature
missing
Download raw message
On 02/24/18 12:41, Andrew Bell wrote:
> Checking the contents of the library for 64 bit Json::Values, I see that
> they're missing (no long long, unsinged long long)


There appear to be multiple problems with this statement:

- 'long long' is a C99 data type, and is not supported in C++ pre-C++11

- sizeof(unsigned long) on at least x86_64 and ppc64 = 8 bytes (64 bits)


>    100: 00000000000189fa    31 FUNC    GLOBAL DEFAULT   10
> Json::Value::Value(long)
>    102: 0000000000018a1a    31 FUNC    GLOBAL DEFAULT   10
> Json::Value::Value(unsigned long)


This therefore provides for 64-bit values.

Do you have a reason why you think it needs to be 'long long'?  Is there
some code you have that tries to use 'long long' with jsoncpp and it
doesn't compile now?  If you're using GCC, which adds 'long long' as a
GNU C++ extension, I would think it would more than likely realise it is
the same size and alias it to 'long' (but possibly not).


Best,
--arw

-- 
A. Wilcox (awilfox)
Project Lead, Adélie Linux
http://adelielinux.org