Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynsec.c:394: undefined reference to `cJSON_ParseWithLength #2543

Closed
rgaufman opened this issue May 21, 2022 · 2 comments
Closed

dynsec.c:394: undefined reference to `cJSON_ParseWithLength #2543

rgaufman opened this issue May 21, 2022 · 2 comments
Labels
Component: mosquitto-apps Status: Needs info More information is needed before action can be taken.

Comments

@rgaufman
Copy link

Hi there, this is my Linux version:

Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.4 LTS
Release:	20.04
Codename:	focal

I installed these compile dependencies:

sudo apt-get -y install uuid-dev libsystemd-dev libssl-dev libcjson-dev checkinstall

When I try to compile, I see this:

~/mosquitto-2.0.14$ sudo checkinstall --default --backup=no --deldoc=yes --install=yes --pkgname=mosquitto --pkgversion='2.0.14'

checkinstall 1.6.3, Copyright 2010 Felipe Eduardo Sanchez Diaz Duran
           This software is released under the GNU GPL.



*****************************************
**** Debian package creation selected ***
*****************************************

This package will be built according to these values:

0 -  Maintainer: [ root@Tetherbox-debac85d9451dc0395bd ]
1 -  Summary: [ Package created with checkinstall 1.6.3 ]
2 -  Name:    [ mosquitto ]
3 -  Version: [ 2.0.14 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ checkinstall ]
7 -  Architecture: [ amd64 ]
8 -  Source location: [ mosquitto-2.0.14 ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Recommends: [  ]
12 - Suggests: [  ]
13 - Provides: [ mosquitto ]
14 - Conflicts: [  ]
15 - Replaces: [  ]

Enter a number to change any of them or press ENTER to continue:

Installing with make install...

========================= Installation results ===========================
set -e; for d in lib apps client plugins src; do make -C ${d}; done
make[1]: Entering directory '/data/deployer/mosquitto-2.0.14/lib'
make -C cpp
make[2]: Entering directory '/data/deployer/mosquitto-2.0.14/lib/cpp'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/data/deployer/mosquitto-2.0.14/lib/cpp'
make[1]: Leaving directory '/data/deployer/mosquitto-2.0.14/lib'
make[1]: Entering directory '/data/deployer/mosquitto-2.0.14/apps'
set -e; for d in db_dump mosquitto_ctrl mosquitto_passwd; do make -C ${d}; done
make[2]: Entering directory '/data/deployer/mosquitto-2.0.14/apps/db_dump'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/data/deployer/mosquitto-2.0.14/apps/db_dump'
make[2]: Entering directory '/data/deployer/mosquitto-2.0.14/apps/mosquitto_ctrl'
cc  mosquitto_ctrl.o client.o dynsec.o dynsec_client.o dynsec_group.o dynsec_role.o get_password.o memory_mosq.o memory_public.o options.o password_mosq.o ../../lib/libmosquitto.so.1 -o mosquitto_ctrl  -lcrypto   ../../lib/libmosquitto.so.1 -lcjson -ldl
/usr/bin/ld: dynsec.o: in function `dynsec__payload_callback':
/data/deployer/mosquitto-2.0.14/apps/mosquitto_ctrl/dynsec.c:394: undefined reference to `cJSON_ParseWithLength'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:45: mosquitto_ctrl] Error 1
make[2]: Leaving directory '/data/deployer/mosquitto-2.0.14/apps/mosquitto_ctrl'
make[1]: *** [Makefile:9: all] Error 2
make[1]: Leaving directory '/data/deployer/mosquitto-2.0.14/apps'
make: *** [Makefile:66: mosquitto] Error 2

****  Installation failed. Aborting package creation.

Cleaning up...OK

Bye.

Any ideas?

@ralight
Copy link
Contributor

ralight commented May 23, 2022

/data/deployer/mosquitto-2.0.14/apps/mosquitto_ctrl/dynsec.c:394: undefined reference to `cJSON_ParseWithLength'

Around line 394 looks like this:

390: #if CJSON_VERSION_FULL < 1007013
391:     UNUSED(payloadlen);
392:     tree = cJSON_Parse(payload);
393: #else
394:     tree = cJSON_ParseWithLength(payload, (size_t)payloadlen);
395: #endif

Which suggests that you have a header file which claims cJSON 1.7.14 or 1.7.15, but the library being linked against is cJSON 1.7.13 or earlier. Is it possible you've manually compiled a more recent cJSON to /usr/local, for example, but still have the Ubuntu packaged version installed?

@ralight ralight added Status: Needs info More information is needed before action can be taken. Component: mosquitto-apps labels May 23, 2022
@rgaufman
Copy link
Author

It's possible, I will try this, thank you! - I tried this on a clean Ubuntu 20.04 install and it compiled correctly, so this is something to do with my system for sure.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Component: mosquitto-apps Status: Needs info More information is needed before action can be taken.
Projects
None yet
Development

No branches or pull requests

2 participants