Flags for enabling JSON_INTEGER_IS_LONG_LONG

62 views
Skip to first unread message

Ertan Küçükoglu

unread,
Aug 26, 2019, 4:36:14 AM8/26/19
to Jansson users
Hello,

I have an embedded highly modified Linux OS. I cannot access it as shell or GUI for doing development on it. I am provided a VM running Linux x86_64 and some development environment for cross compiling for the embedded system. After I do cross compilation, I upload generated binary using a software and a USB cable.

Provided development environment was lacking json support. I have already integrated Jansson in it successfully. It is working fine on installed applications.

Recently, I needed long long support for a new application I am working on.
On my PC, I see JSON_INTEGER_IS_LONG_LONG *not* defined.
On Embedded system I see JSON_INTEGER_IS_LONG_LONG *not* defined.

Jansson was cross compiled on my Raspberry Pi 3 Model B+ for embedded system and also on my PC running Windows 10 64Bit for Visual Studio for before deployment testing.

I wonder if there is some Jansson compile time parameter to force long long checks or some other workaround.

Version I am using is 2.12.0

Thanks & regards,
Ertan

Graeme Smecher

unread,
Aug 26, 2019, 12:32:59 PM8/26/19
to jansso...@googlegroups.com
Hi Ertan,

The relevant checks in configure are

- ac_cv_type_long_long_int
- ac_cv_func_strtoll

You should be able to browse your "configure" long to figure out which
of these tests are failing. You can bypass them as follows:

$ ac_cv_type_long_long_int=yes \
ac_cv_func_strtoll=yes \
./configure

[...]
checking for long long int... (cached) yes
checking for strtoll... (cached) yes
[...]

Bypassing the tests is probably not enough without follow-up, and the
follow-up may be complicated -- these tests are present for a reason,
and you may find the build fails, or the resulting library doesn't work.

best,
Graeme

On 2019-08-26 1:36 a.m., Ertan Küçükoglu wrote:
> Hello,
>
> I have an embedded highly modified Linux OS. I cannot access it as shell
> or GUI for doing development on it. I am provided a VM running Linux
> x86_64 and some development environment for cross compiling for the
> embedded system. After I do cross compilation, I upload generated binary
> using a software and a USB cable.
>
> Provided development environment was lacking json support. I have
> already integrated Jansson in it successfully. It is working fine on
> installed applications.
>
> Recently, I needed long long support for a new application I am working on.
> On my PC, I see JSON_INTEGER_IS_LONG_LONG **not** defined.
> On Embedded system I see JSON_INTEGER_IS_LONG_LONG **not** defined.
>
> Jansson was cross compiled on my Raspberry Pi 3 Model B+ for embedded
> system and also on my PC running Windows 10 64Bit for Visual Studio for
> before deployment testing.
>
> I wonder if there is some Jansson compile time parameter to force long
> long checks or some other workaround.
>
> Version I am using is 2.12.0
>
> Thanks & regards,
> Ertan
>
> --
> --
> Jansson users mailing list
> jansso...@googlegroups.com
> http://groups.google.com/group/jansson-users
> ---
> You received this message because you are subscribed to the Google
> Groups "Jansson users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to jansson-user...@googlegroups.com
> <mailto:jansson-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jansson-users/43ebf3e4-b8cd-41fa-9ae3-eb1a27e09d28%40googlegroups.com
> <https://groups.google.com/d/msgid/jansson-users/43ebf3e4-b8cd-41fa-9ae3-eb1a27e09d28%40googlegroups.com?utm_medium=email&utm_source=footer>.
pEpkey.asc

Ertan Küçükoglu

unread,
Sep 2, 2019, 12:12:11 AM9/2/19
to Jansson users
Hello Graeme,

Thank you for providing all these details.

I am most likely not going to compile Jansson with such by-passes. In the mean time embedded device producer responded me saying that device has 32Bit CPU and OS and is not supporting "long long" for that reason. This is quite doubtful for me and I will be following that up with them.

Anyway, that rest web service I need to communicate is sending me a "transaction id" as long long. This is the only value I have to deal as long long. I need to communicate back with the service including transaction id in my own json strings. I would like to be sure if I can do following with Jansson;
1) if I can read that long long as a string value using Jansson functions.
2) Assuming I could read long long as a string, I will be doing some tests like sending them back that long long as a json string value. In the mean time, I wonder if there is a way I can write that string as a number (without double quotes) while I am constructing my own json string.

I am aware this is not a proper way of using Jansson for parsing/constructing a json string. It seems that I will have difficulties having modifications on that embedded device so I am searching all my possibilities. I really do not want to do my own json string manipulations if I can avoid.

Thanks & regards,
Ertan


26 Ağustos 2019 Pazartesi 11:36:14 UTC+3 tarihinde Ertan Küçükoglu yazdı:

Graeme Smecher

unread,
Sep 3, 2019, 12:44:52 PM9/3/19
to jansso...@googlegroups.com
Hi Ertan,

We're straying a little bit out of the scope of this mailing list. Here
are some ideas, but ultimately, you're probably on your own. It sounds
like you're chasing the right leads.

Comments inline.

On 2019-09-01 9:12 p.m., Ertan Küçükoglu wrote:
> Hello Graeme,
>
> Thank you for providing all these details.
>
> I am most likely not going to compile Jansson with such by-passes. In
> the mean time embedded device producer responded me saying that device
> has 32Bit CPU and OS and is not supporting "long long" for that reason.
> This is quite doubtful for me and I will be following that up with them.

What compiler are you using, and how old is it? Likewise, what libc are
you using? With a relatively up-to-date gcc and glibc/eglibc/musl, it is
reasonable to expect "long long" and associated machinery to work just
fine. The fact that it's a 32-bit CPU and OS is irrelevant.

> Anyway, that rest web service I need to communicate is sending me a
> "transaction id" as long long. This is the only value I have to deal as
> long long. I need to communicate back with the service including
> transaction id in my own json strings. I would like to be sure if I can
> do following with Jansson;
> 1) if I can read that long long as a string value using Jansson functions.
> 2) Assuming I could read long long as a string, I will be doing some
> tests like sending them back that long long as a json string value. In
> the mean time, I wonder if there is a way I can write that string as a
> number (without double quotes) while I am constructing my own json string.

Some callback hooks like this have been proposed on the Jansson mailing
list a few times over the past years. For example:

https://github.com/akheron/jansson/issues/69

Short story: the hooks you need aren't present in Jansson right now, and
there isn't an up-to-date branch you can confidently borrow code from. A
clean implementation has a good chance of being accepted, but is
probably a bigger project than you want.

> I am aware this is not a proper way of using Jansson for
> parsing/constructing a json string. It seems that I will have
> difficulties having modifications on that embedded device so I am
> searching all my possibilities. I really do not want to do my own json
> string manipulations if I can avoid.

I agree -- I don't know anything about your situation, but here are the
approaches I would take:

0. If your team also develops the code that creates these IDs, they
should be aware that 64-bit integers are problematic for JSON in
general, and not just Jansson.
(https://tools.ietf.org/html/rfc7159#section-6) They may wish to
consider the long-term implications of 64-bit integers on a standard
that does not guarantee them. Patching Jansson does not resolve the
underlying problem.

1. Go back to your vendor and push for a better explanation why they
can't support strtoll. Best case: they flip a configuration switch, and
you get the strtoll/long long support you need. More likely: when
pushed, they'll say "sorry, it's possible but you're on your own."

2. If your compiler gives you "long long" support, but your libc doesn't
give you strtoll, perhaps you can borrow an implementation of strtoll
(e.g. from musl?) to compile within jansson.

best,
Graeme

> 26 Ağustos 2019 Pazartesi 11:36:14 UTC+3 tarihinde Ertan Küçükoglu yazdı:
>
> Hello,
>
> I have an embedded highly modified Linux OS. I cannot access it as
> shell or GUI for doing development on it. I am provided a VM running
> Linux x86_64 and some development environment for cross compiling
> for the embedded system. After I do cross compilation, I upload
> generated binary using a software and a USB cable.
>
> Provided development environment was lacking json support. I have
> already integrated Jansson in it successfully. It is working fine on
> installed applications.
>
> Recently, I needed long long support for a new application I am
> working on.
> On my PC, I see JSON_INTEGER_IS_LONG_LONG **not** defined.
> On Embedded system I see JSON_INTEGER_IS_LONG_LONG **not** defined.
>
> Jansson was cross compiled on my Raspberry Pi 3 Model B+ for
> embedded system and also on my PC running Windows 10 64Bit for
> Visual Studio for before deployment testing.
>
> I wonder if there is some Jansson compile time parameter to force
> long long checks or some other workaround.
>
> Version I am using is 2.12.0
>
> Thanks & regards,
> Ertan
>
> --
> --
> Jansson users mailing list
> jansso...@googlegroups.com
> http://groups.google.com/group/jansson-users
> ---
> You received this message because you are subscribed to the Google
> Groups "Jansson users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to jansson-user...@googlegroups.com
> <mailto:jansson-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jansson-users/1a9ee026-ec90-4d6e-8338-08b85e8b4857%40googlegroups.com
> <https://groups.google.com/d/msgid/jansson-users/1a9ee026-ec90-4d6e-8338-08b85e8b4857%40googlegroups.com?utm_medium=email&utm_source=footer>.
pEpkey.asc
Reply all
Reply to author
Forward
0 new messages