sshoecraft / jbdtool

JBD BMS Linux utility
BSD 3-Clause "New" or "Revised" License
46 stars 10 forks source link

Error compiling on Debian 11 #7

Closed spilegi closed 2 years ago

spilegi commented 2 years ago

I believe I have the requirements correct. I'm thinking it might be a python issue

root@PM03:~/jbdtool-main# make gcc -Wall -g -DDEBUG=1 -DBLUETOOTH -o jbdtool main.o jbd_info.o jbd.o parson.o list.o utils.o cfg.o daemon.o module.o ip.o serial.o bt.o can.o -lgattlib -lgobject-2.0 -lgio-2.0 -lglib-2.0 -lpthread /usr/bin/ld: warning: libpython3.5m.so.1.0, needed by /usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib/libgattlib.so, not found (try using -rpath or -rpath-link) /usr/bin/ld: main.o: in function main': /root/jbdtool-main/main.c:940: undefined reference tomqtt_new' /usr/bin/ld: /root/jbdtool-main/main.c:944: undefined reference to mqtt_connect' /usr/bin/ld: /root/jbdtool-main/main.c:945: undefined reference tomqtt_disconnect' /usr/bin/ld: /root/jbdtool-main/main.c:1246: undefined reference to mqtt_connect' /usr/bin/ld: /root/jbdtool-main/main.c:1247: undefined reference tomqtt_pub' /usr/bin/ld: /root/jbdtool-main/main.c:1248: undefined reference to mqtt_disconnect' /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib/libgattlib.so: undefined reference toPyGILState_Release' /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib/libgattlib.so: undefined reference to PyEval_CallObjectWithKeywords' /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib/libgattlib.so: undefined reference toPyGILState_Ensure' /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib/libgattlib.so: undefined reference to `Py_BuildValue' collect2: error: ld returned 1 exit status make: *** [Makefile:72: jbdtool] Error 1

sshoecraft commented 2 years ago

In the makefile, set MQTT=yes. You'll need the paho-mqtt-c library: https://github.com/eclipse/paho.mqtt.c for the gattlib (bluetooth) errors, I'll have to check that out. You could always grab it from github and compile it yourself: https://github.com/labapart/gattlib

Here's the command I use to build it (note the no python interface): rm -rf build; mkdir -p build && cd build || exit 1 cmake -DGATTLIB_BUILD_EXAMPLES=NO -DGATTLIB_SHARED_LIB=NO -DGATTLIB_BUILD_DOCS=NO -DGATTLIB_PYTHON_INTERFACE=NO .. make -j 9 && make install

spilegi commented 2 years ago

I though I had installed the two dependencies correctly. I don't see a CMakeLists.txt file, but i'm not super familiar with the process vs make

root@PM03:~/jbdtool-main# rm -rf build; mkdir -p build && cd build || exit 1 cmake -DGATTLIB_BUILD_EXAMPLES=NO -DGATTLIB_SHARED_LIB=NO -DGATTLIB_BUILD_DOCS=NO -DGATTLIB_PYTHON_INTERFACE=NO .. make -j 9 && make install CMake Error: The source directory "/root/jbdtool-main" does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI. make: *** No targets specified and no makefile found. Stop.

sshoecraft commented 2 years ago

My apologies - the commands I gave were what I use to build gattlib.

Generally, you want to build paho, then build gattlib, then jbdtool.

Here's the commands I use to build paho: cd to directory where you cloned it m -rf build; mkdir -p build && cd build cmake -DPAHO_WITH_SSL=TRUE -DPAHO_BUILD_SHARED=TRUE -DPAHO_BUILD_STATIC=TRUE -DPAHO_ENABLE_TESTING=FALSE -DPAHO_BUILD_SAMPLES=TRUE .. make && make install

Here's the commands I use to build gattlib: cd to directory where you cloned it m -rf build; mkdir -p build && cd build cmake -DGATTLIB_BUILD_EXAMPLES=NO -DGATTLIB_SHARED_LIB=NO -DGATTLIB_BUILD_DOCS=NO -DGATTLIB_PYTHON_INTERFACE=NO .. make && make install

then I build jbdtool simply by running make (make sure MQTT=yes and BLUETOOTH=yes in Makefile) I'll need to fix it so that if MQTT isn't enabled it doesn't try and use it...

What platform you want this for? d11 x86_64? I'll see if I can build a static version for you tomorrow if you're still stuck.

spilegi commented 2 years ago

Hi, yes it is for x86_64. I attempted to rebuild the dependencies using your commands. Same issue I'm afraid. If you could build a static version that would be great. Thanks!

This is my first JBD BMS. So far I like ti much better than the Daly BMS it's replacing

sshoecraft commented 2 years ago

ok give this a try jbdtool_static.zip

spilegi commented 2 years ago

your compiled version worked thanks.