I tried:
cd ~
git clone git://github.com/stephane/libmodbus
cd libmodbus
./autogen.sh
./configure --enable-static
make
sudo make install
sudo cp ./src/.libs/libmodbus.a /usr/local/lib/
to download, compile and install the libmodbus library. Now I have a libmodbus.a file in /usr/local/lib/.
Now I want to install mbrtu:
cd ~
git clone https://github.com/gitaeuber/mbrtu
cd mbrtu
make
sudo make install
Strangely, after make I get the error:
In file included from mbrtu.c:22:
mbrtu.h:25:12: fatal error: modbus.h: No such file or directory
25 | #include <modbus.h>
| ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:9: mbrtu] Error 1
I tried adding the library path /usr/local/lib/ to $LD_LIBRARY_PATH, but that did not help at all.
Can someone explain me how I can compile and install the libmodbus library correctly?
It is not a library that is not found by the linker but an include file which is not found by the compiler. Look at the make file
install
to see how include files are searched. It is likely a variableINC
orINCLUDE
.