Я пытаюсь скомпилировать свой код на своем ноутбуке Ubuntu x64 для Raspberry Pi.
Я могу без проблем скомпилировать и запустить код на ноутбуке Ubuntu. Однако, когда я пытаюсь скомпилировать его для Raspberry Pi, я получаю следующую ошибку:
$make
/home/nmohan/Development/arm-bcm2708-linux-gnueabi/bin/arm-bcm2708-linux-gnueabi-gcc -g -Wall -Wextra -I /home/nmohan/github/NiRobot/inc -fPIC -shared -L/home/nmohan/github/NiRobot/Obj_arm -Wl,-rpath=/home/nmohan/github/NiRobot/Obj -o /home/nmohan/github/NiRobot/Obj_arm/libRSXA.so /home/nmohan/github/NiRobot/lib/RSXA.c -lNMT_stdlib -lNMT_log -ljson-c -lc -Ljson-c
/home/nmohan/github/NiRobot/lib/RSXA.c:11:25: fatal error: json-c/json.h: No such file or directory
compilation terminated.
Makefile:101: recipe for target '/home/nmohan/github/NiRobot/Obj_arm/libRSXA.so' failed
make: *** [/home/nmohan/github/NiRobot/Obj_arm/libRSXA.so] Error 1
#---------------------------------------#
# #
# Global Varibles #
# #
#---------------------------------------#
PROJ_DIR = /home/nmohan/github/NiRobot
BIN_DIR = $(PROJ_DIR)/bin
OBJ_DIR = $(PROJ_DIR)/Obj
OBJ_DIR_ARM = $(PROJ_DIR)/Obj_arm
INC_DIR = $(PROJ_DIR)/inc
LIB_DIR = $(PROJ_DIR)/lib
OUT_DIR = $(PROJ_DIR)/bld
OUT_DIR_ARM = $(PROJ_DIR)/bld_arm
CFLAGS = -g -Wall -Wextra -I $(INC_DIR)
SFLAGS = -fPIC -shared
RPATH = -L$(OBJ_DIR) -Wl,-rpath=$(OBJ_DIR)
RPATH_ARM = -L$(OBJ_DIR_ARM) -Wl,-rpath=$(OBJ_DIR)
GCC_DIR = /home/nmohan/Development/arm-bcm2708-linux-gnueabi/bin/arm-bcm2708-linux-gnueabi-gcc
#---------------------------------------#
# #
# Targets #
# #
#---------------------------------------#
OBJS = NMT_stdlib.so \
NMT_log.so \
RSXA.so \
PCA9685.so \
MTDR.so \
CAM_MOTOR_CTRL.so \
HCxSR04.so
#---------------------------------------#
# #
# Dependancies #
# #
#---------------------------------------#
NMT_STDLIB_LIBS = -lc
NMT_LOG_LIBS = -lc \
-lNMT_stdlib \
RSXA_LIBS = -lNMT_stdlib \
-lNMT_log \
-ljson-c \
-lc
PCA9685_LIBS = -lNMT_stdlib \
-lNMT_log \
-lc \
-lwiringPi \
-lcrypt \
-lm \
-lrt \
-lRSXA
MTDR_LIBS = -lNMT_stdlib \
-lNMT_log \
-lwiringPi \
-lPCA9685 \
-lcrypt \
-lm \
-lrt \
-lRSXA
CAM_MOTOR_CTRL_LIBS = -lNMT_stdlib \
-lNMT_log \
-lwiringPi \
-lMTDR \
-lPCA9685 \
-lcrypt \
-lm \
-lrt \
-lRSXA
HCxSR04_LIBS = -lNMT_log \
-lNMT_stdlib \
-lRSXA \
-lwiringPi \
-lcrypt \
-lm \
-lrt
TARGET_OBJS := $(foreach OBJ,$(OBJS),$(OBJ_DIR)/lib$(OBJ))
TARGET_OBJS_ARM := $(foreach OBJ,$(OBJS),$(OBJ_DIR_ARM)/lib$(OBJ))
all: $(TARGET_OBJS) \
$(TARGET_OBJS_ARM)
.PHONY: all
$(OBJ_DIR)/lib%.so: $(LIB_DIR)/%.c $(INC_DIR)/%.h
gcc $(CFLAGS) $(SFLAGS) $(RPATH) -o $@ $< $($(*)_LIBS)
$(OBJ_DIR_ARM)/lib%.so: $(LIB_DIR)/%.c $(INC_DIR)/%.h
$(GCC_DIR) $(CFLAGS) $(SFLAGS) $(RPATH_ARM) -o $@ $< $($(*)_LIBS)
$(OBJ_DIR)/lib%.so: $(LIB_DIR)/%.cpp $(INC_DIR)/%.hpp
g++ $(CFLAGS) $(SFLAGS) $(RPATH) -o $@ $< $($(*)_LIBS)