JSON-C

178 views
Skip to first unread message

Tamarindo

unread,
Dec 14, 2019, 11:58:50 PM12/14/19
to LDMud Talk
Having some trouble with the "JSON-C 0.12 or later is required for JSON support" to run the latest version of the driver.

Platform: Amazon Linux 2, JSON-C from https://github.com/json-c/json-c.  I installed 0.13 and like similar versions, inside of pkg-json.c we fail here:

pkg-json.c: In function ‘push_json_error_handler’:

pkg-json.c:233:16: error: FALSE’ undeclared (first use in this function); did you mean ‘FILE’?

         return FALSE;

                ^~~~~

                FILE

pkg-json.c:233:16: note: each undeclared identifier is reported only once for each function it appears in

pkg-json.c:238:12: error: TRUE’ undeclared (first use in this function)

     return TRUE;

            ^~~~


If we grep the whole src directory, we find MY_FALSE and MY_TRUE used elsewhere, which seems to help.  Should that change be made?


After that, having some issues with finding the references for functions like json_object_new_double_s as well during the build, too.  Have some tips?


gcc -O2 -g    access_check.o actions.o array.o arraylist.o backend.o bitstrings.o call_out.o closure.o comm.o dumpstat.o ed.o efuns.o files.o gcollect.o hash.o heartbeat.o interpret.o lex.o main.o mapping.o md5.o mempools.o mregex.o mstrings.o object.o otable.o parser.o parse.o pkg-iksemel.o pkg-xml2.o pkg-idna.o pkg-mccp.o pkg-mysql.o pkg-gcrypt.o pkg-json.o pkg-python.o pkg-pgsql.o pkg-sqlite.o pkg-tls.o pkg-openssl.o pkg-gnutls.o port.o ptrtable.o random.o regexp.o sha1.o simulate.o simul_efun.o stdstrings.o strfuns.o structs.o sprintf.o swap.o types.o wiz_list.o xalloc.o   -o ldmud -lnsl -lm  -lcrypt  -lssl -lcrypto -lpcre -ljson-c -lxml2  

pkg-json.o: In function `ldmud_json_serialize':

/home/game/ldmud/src/pkg-json.c:452: undefined reference to `json_object_new_double_s'

collect2: error: ld returned 1 exit status

make: *** [ldmud] Error 1


-Tamarindo@StickMUD

Gnomi

unread,
Dec 15, 2019, 7:36:22 AM12/15/19
to ldmud...@googlegroups.com
Hi Tamarindo,

Tamarindo wrote:
> Having some trouble with the "JSON-C 0.12 or later is required for JSON
> support" to run the latest version of the driver.
>
> Platform: Amazon Linux 2, JSON-C from https://github.com/json-c/json-c. I
> installed 0.13 and like similar versions, inside of pkg-json.c we fail here:
>
> *pkg-json.c:* In function ‘*push_json_error_handler*’:
>
> *pkg-json.c:233:16:* *error: *‘*FALSE*’ undeclared (first use in this
> function); did you mean ‘*FILE*’?

The TRUE and FALSE defines came from JSON-C, it seems they have removed
that in newer versions:
https://github.com/json-c/json-c/commit/0992aac61f8b087efd7094e9ac2b84fa9c040fcd

> If we grep the whole src directory, we find MY_FALSE and MY_TRUE used
> elsewhere, which seems to help. Should that change be made?

In newer code we use 'true' and 'false' directly.

> After that, having some issues with finding the references for functions
> like json_object_new_double_s as well during the build, too. Have some
> tips?

I have no idea, the function still exists in JSON-C 0.13.
You could verify that the compiler doesn't grab an older version
with -ljson-c. (The function does not exist in any version older than
JSON-C 0.12.)

Regards,
Gnomi

Tamarindo

unread,
Dec 15, 2019, 8:45:32 AM12/15/19
to LDMud Talk

Thanks Gnomi.  I removed json-c-devel and now just have https://github.com/json-c/json-c.  In order to get json-c to fully install, I have to do a sudo make install, so it gets the permissions it needs.  Unfortunately, after making ldmud, I get this error when the driver starts.  Do you have more ideas?


./ldmud: error while loading shared libraries: libjson-c.so.4: cannot open shared object file: No such file or directory


PS. My experience on both Amazon Linux 2 and working in MacOS is that using the json packages that could be installed with yum or homebrew behave best with the OS up until 3.5.99.  Is there a good reason we must go to 0.13?


[game@ageofelements bin]$ ls

erq  indent  ldmud  startup

[game@ageofelements bin]$ ./startup &

[1] 12456

[game@ageofelements bin]$ 

[1]+  Done                    ./startup

[game@ageofelements bin]$ ps aux | grep ldmud

game     12475  0.0  0.0 119416   908 pts/0    S+   13:31   0:00 grep --color=auto ldmud

[game@ageofelements bin]$ cd ..

[game@ageofelements ldmud]$ ls

age-of-elements  autoconf  bin  CHANGELOG  CHANGELOG.OLD  COPYRIGHT  CREDITS  doc  etc  gdb  HISTORY  include  INSTALL  mud  mudlib  README  share  src  test

[game@ageofelements ldmud]$ cd age-of-elements/

[game@ageofelements age-of-elements]$ ls

ACCESS.ALLOW  banish  doc  include  LICENSE  log  LP_SWAP.ageofelements  NEWS  obj  players  README  README.md  room  secure  sys  WELCOME  WIZLIST  WIZNEWS

[game@ageofelements age-of-elements]$ cd log

[game@ageofelements log]$ ls

driver_compiletime.log  driver_compiletime.log.old  driver_runtime.log.old  ENTER  GAME_LOG  log  NEWPLAYER  README

[game@ageofelements log]$ more driver_compiletime.log

./ldmud: error while loading shared libraries: libjson-c.so.4: cannot open shared object file: No such file or directory

[game@ageofelements log]$ ls

driver_compiletime.log  driver_compiletime.log.old  driver_runtime.log.old  ENTER  GAME_LOG  log  NEWPLAYER  README

[game@ageofelements log]$ cd /usr/local/lib

[game@ageofelements lib]$ ls

libjson-c.a  libjson-c.la  libjson-c.so  libjson-c.so.4  libjson-c.so.4.0.0  pkgconfig

[game@ageofelements lib]$ ls -la

total 552

drwxr-xr-x  3 root root    130 Dec 15 13:19 .

drwxr-xr-x 12 root root    131 Jun 18 22:23 ..

-rw-r--r--  1 root root 350898 Dec 15 13:19 libjson-c.a

-rwxr-xr-x  1 root root    931 Dec 15 13:19 libjson-c.la

lrwxrwxrwx  1 root root     18 Dec 15 13:19 libjson-c.so -> libjson-c.so.4.0.0

lrwxrwxrwx  1 root root     18 Dec 15 13:19 libjson-c.so.4 -> libjson-c.so.4.0.0

-rwxr-xr-x  1 root root 207864 Dec 15 13:19 libjson-c.so.4.0.0

drwxr-xr-x  2 root root     23 Dec 15 13:19 pkgconfig

Gnomi

unread,
Dec 15, 2019, 8:56:21 AM12/15/19
to ldmud...@googlegroups.com
Hi,

Tamarindo worte:
> Thanks Gnomi. I removed json-c-devel and now just have
> https://github.com/json-c/json-c. In order to get json-c to fully install,
> I have to do a sudo make install, so it gets the permissions it needs.
> Unfortunately, after making ldmud, I get this error when the driver
> starts. Do you have more ideas?
>
>
> *./ldmud: error while loading shared libraries: libjson-c.so.4: cannot open
> shared object file: No such file or directory*

Is /usr/local/lib listed in /etc/ld.so.conf?
Did you execute ldconfig after installation?

> PS. My experience on both Amazon Linux 2 and working in MacOS is that using
> the json packages that could be installed with yum or homebrew behave best
> with the OS up until 3.5.99. Is there a good reason we must go to 0.13?

We require 0.12, not 0.13. Older versions had problems serializing certain
floating point values. Our own test cases failed with these versions. That's
the reason for this requirement.

Regards,
Gnomi.

Tamarindo

unread,
Dec 20, 2019, 1:37:21 PM12/20/19
to LDMud Talk
Thanks Gnomi - that worked!  Got to 3.6 on a test site.
Reply all
Reply to author
Forward
0 new messages