-
base64.c/base64.h: a util for base64.encode/decode
-
main.c: call the rest api for IoTDB
dependency: libcurl
- example: Ubuntu 16.04 STL (Ubuntu 20.04 may have some problems)
sudo apt-get install libcurl4-openssl-dev
Before build, you must install the libcurl.
build steps:
mkdir build
cd build
cmake ..
make
Eventually, you will get an executable program c_rest_iotdb
in build
directory.
- os : Ubuntu 16.04 STL
- choose and install cross compiler according to the target host
arm-linux-gnueabihf-gcc as an example.
- arm-linux-gnueabihf-gcc
sudo apt-get install gcc-arm-linux-gnueabihf
- cross compile libcurl
-
download the *.tar.gz in https://curl.haxx.se/download/, and uncompress it.
-
compile and install
./configure --host=arm-linux/arm-linux-gnueabihf/others CC=arm-linux-gnueabihf-gcc --prefix=`install dir` --enable-static --with-wolfssl
make
make install
- cross compile the example program
arm-linux-gnueabihf-gcc main.c base64.c -o c_rest -L `(libcurl install dir)/lib/` -l curl
if can't find curl/curl.h
, you can just simply change to the absolutely path or specify the include path.
Reference Materials
libcurl usage:
https://blog.csdn.net/myvest/article/details/82899788
compilation:
https://blog.csdn.net/u011641885/article/details/46900771
https://www.cnblogs.com/flyinggod/p/10148228.html
https://blog.csdn.net/fangye945a/article/details/86500817
https://www.cnblogs.com/yxh-l-0824/p/13254891.html