TA的每日心情 | 衰 2020-5-18 12:26 |
---|
签到天数: 3 天 [LV.2]偶尔看看I |
本帖最后由 156****2525 于 2020-5-15 23:35 编辑
环境:树莓派4b+Ubuntu Server 20.04
.so文件是提交工单申请的树莓派库文件
之前在VMware虚拟机(Ubuntu 16.04)里可以正常编译。
刚开始是这样报错的:- gcc -g -Wall -I./include robot.o file_str_handle.o iat_record.o request.o linuxrec.o speech_recognizer.o xtts.o cJSON.o awake.o -o bin/hr_robot -L./libs/RaspberryPi -lmsc -lrt -ldl -lpthread -lasound -lstdc++ -lcurl
- /usr/bin/ld: skipping incompatible ./libs/RaspberryPi/libmsc.so when searching for -lmsc
- /usr/bin/ld: skipping incompatible /usr/local/lib/libmsc.so when searching for -lmsc
- /usr/bin/ld: cannot find -lmsc
- collect2: error: ld returned 1 exit status
- make: *** [Makefile:28: bin/hr_robot] Error 1
复制代码
我将libmsc.so这个文件放入./libs/RaspberryPi/目录下,然后将./libs/RaspberryPi/目录下的libmsc.so拷贝到/usr/local/lib/libmsc.so目录下,依然报错- gcc -g -Wall -I./include robot.o file_str_handle.o iat_record.o request.o linuxrec.o speech_recognizer.o xtts.o cJSON.o awake.o -o bin/hr_robot -L./libs/RaspberryPi -lmsc -lrt -ldl -lpthread -lasound -lstdc++ -lcurl
- /usr/bin/ld: skipping incompatible ./libs/RaspberryPi/libmsc.so when searching for -lmsc
- /usr/bin/ld: skipping incompatible /usr/local/lib/libmsc.so when searching for -lmsc
- /usr/bin/ld: cannot find -lmsc
- collect2: error: ld returned 1 exit status
- make: *** [Makefile:28: bin/hr_robot] Error 1
复制代码
两个文件是存在的:
- ubuntu@ubuntu:~/robot_with_awake$ ls -l /usr/local/lib/
- total 28348
- -rwxrwxrwx 1 root root 3823588 May 15 22:48 libmsc.so
- -rwxr-xr-x 1 root root 25195313 May 15 21:37 libw_ivw.so
- drwxrwsr-x 3 root staff 4096 Apr 23 23:03 python3.8
- ubuntu@ubuntu:~/robot_with_awake$ ls -l ./libs/RaspberryPi/
- total 3736
- -rwxrwxrwx 1 ubuntu ubuntu 3823588 May 15 21:52 libmsc.so
复制代码
Makefile文件内容如(前面的行号是vim的):- #common makefile header
- LDLIBS = $(shell curl-config --libs)
- DIR_INC = ./include
- DIR_BIN = ./bin
- DIR_LIB = ./libs
- TARGET = hr_robot
- BIN_TARGET = $(DIR_BIN)/$(TARGET)
- CROSS_COMPILE =
- CFLAGS = -g -Wall -I$(DIR_INC)
- #可根据实际需要修改,选择所需平台SDK,默认为x64或x86平台。
- ifdef RaspberryPi
- LDFLAGS := -L$(DIR_LIB)/RaspberryPi
- else
- LDFLAGS := -L$(DIR_LIB)/x64
- endif
- LDFLAGS += -lmsc -lrt -ldl -lpthread -lasound -lstdc++
- OBJECTS := $(patsubst %.c,%.o,$(wildcard *.c))
- $(BIN_TARGET) : $(OBJECTS)
- $(CROSS_COMPILE)gcc $(CFLAGS) $^ -o $@ $(LDFLAGS) $(LDLIBS)
- %.o : %.c
- $(CROSS_COMPILE)gcc -c $(CFLAGS) $(LDLIBS) [ DISCUZ_CODE_15 ]lt; -o $@
- clean:
- @rm -f *.o $(BIN_TARGET)
- .PHONY:clean
- #common makefile foot
复制代码
重启了好几遍都无效。
求大神支招。
|
|