没有规则使目标'-L/usr/local/lib'
Posted
技术标签:
【中文标题】没有规则使目标\'-L/usr/local/lib\'【英文标题】:No rule to make target '-L/usr/local/lib'没有规则使目标'-L/usr/local/lib' 【发布时间】:2020-12-30 17:54:52 【问题描述】:我在尝试将 opencv 链接到 Matlab Coder 生成的 CPP 项目时遇到问题。在项目的自动生成的 Makefile 中,我将 pkg-config --cflags opencv
添加到 CFLAGS 并将 pkg-config --libs opencv
添加到 LIBS(opencv 3.4),然后给出错误“No rule to make target '-L/usr/local/lib'”。任何想法如何解决错误?
PRODUCT_NAME = runeef
MAKEFILE = runeef_rtw.mk
MATLAB_ROOT = /usr/local/Polyspace/R2020a
MATLAB_BIN = /usr/local/Polyspace/R2020a/bin
MATLAB_ARCH_BIN = $(MATLAB_BIN)/glnxa64
MASTER_ANCHOR_DIR =
START_DIR = /home/dell/Documents/purefusion/codegen/exe/runeef
TGT_FCN_LIB = ISO_C++11
SOLVER_OBJ =
CLASSIC_INTERFACE = 0
MODEL_HAS_DYNAMICALLY_LOADED_SFCNS =
RELATIVE_PATH_TO_ANCHOR = .
C_STANDARD_OPTS = -fwrapv -ansi -pedantic -Wno-long-long
CPP_STANDARD_OPTS = -fwrapv -std=c++11 -pedantic
###########################################################################
## TOOLCHAIN SPECIFICATIONS
###########################################################################
# Toolchain Name: GNU gcc/g++ | gmake (64-bit Linux)
# Supported Version(s):
# ToolchainInfo Version: 2020a
# Specification Revision: 1.0
#
#-------------------------------------------
# Macros assumed to be defined elsewhere
#-------------------------------------------
# C_STANDARD_OPTS
# CPP_STANDARD_OPTS
#-----------
# MACROS
#-----------
WARN_FLAGS = -Wall -W -Wwrite-strings -Winline -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Wcast-align
WARN_FLAGS_MAX = $(WARN_FLAGS) -Wcast-qual -Wshadow
CPP_WARN_FLAGS = -Wall -W -Wwrite-strings -Winline -Wpointer-arith -Wcast-align
CPP_WARN_FLAGS_MAX = $(CPP_WARN_FLAGS) -Wcast-qual -Wshadow
TOOLCHAIN_SRCS =
TOOLCHAIN_INCS =
TOOLCHAIN_LIBS =
#------------------------
# BUILD TOOL COMMANDS
#------------------------
# C Compiler: GNU C Compiler
CC = gcc
# Linker: GNU Linker
LD = g++
# C++ Compiler: GNU C++ Compiler
CPP = g++
# C++ Linker: GNU C++ Linker
CPP_LD = g++
# Archiver: GNU Archiver
AR = ar
# MEX Tool: MEX Tool
MEX_PATH = $(MATLAB_ARCH_BIN)
MEX = "$(MEX_PATH)/mex"
# Download: Download
DOWNLOAD =
# Execute: Execute
EXECUTE = $(PRODUCT)
# Builder: GMAKE Utility
MAKE_PATH = %MATLAB%/bin/glnxa64
MAKE = "$(MAKE_PATH)/gmake"
#-------------------------
# Directives/Utilities
#-------------------------
CDEBUG = -g
C_OUTPUT_FLAG = -o
LDDEBUG = -g
OUTPUT_FLAG = -o
CPPDEBUG = -g
CPP_OUTPUT_FLAG = -o
CPPLDDEBUG = -g
OUTPUT_FLAG = -o
ARDEBUG =
STATICLIB_OUTPUT_FLAG =
MEX_DEBUG = -g
RM = @rm -f
ECHO = @echo
MV = @mv
RUN =
#--------------------------------------
# "Faster Runs" Build Configuration
#--------------------------------------
ARFLAGS = ruvs
CFLAGS = $(shell pkg-config --cflags opencv) -c $(C_STANDARD_OPTS) -fPIC \
-O3 -fno-loop-optimize -fno-aggressive-loop-optimizations
CPPFLAGS = $(shell pkg-config --cflags opencv) -c $(CPP_STANDARD_OPTS) -fPIC \
-O3 -fno-loop-optimize -fno-aggressive-loop-optimizations
CPP_LDFLAGS = -Wl,-rpath,"$(MATLAB_ARCH_BIN)",-L"$(MATLAB_ARCH_BIN)"
CPP_SHAREDLIB_LDFLAGS = -shared -Wl,-rpath,"$(MATLAB_ARCH_BIN)",-L"$(MATLAB_ARCH_BIN)" -Wl,--no-undefined
DOWNLOAD_FLAGS =
EXECUTE_FLAGS =
LDFLAGS = -Wl,-rpath,"$(MATLAB_ARCH_BIN)",-L"$(MATLAB_ARCH_BIN)"
MEX_CPPFLAGS =
MEX_CPPLDFLAGS =
MEX_CFLAGS =
MEX_LDFLAGS =
MAKE_FLAGS = -f $(MAKEFILE)
SHAREDLIB_LDFLAGS = -shared -Wl,-rpath,"$(MATLAB_ARCH_BIN)",-L"$(MATLAB_ARCH_BIN)" -Wl,--no-undefined
###########################################################################
## OUTPUT INFO
###########################################################################
PRODUCT = /home/dell/Documents/purefusion/runeef
PRODUCT_TYPE = "executable"
BUILD_TYPE = "Executable"
###########################################################################
## INCLUDE PATHS
###########################################################################
INCLUDES_BUILDINFO = -I$(START_DIR) -I/home/dell/Documents/purefusion -I$(MATLAB_ROOT)/extern/include -I$(MATLAB_ROOT)/toolbox/vision/builtins/src/ocv/include -I$(MATLAB_ROOT)/toolbox/vision/builtins/src/ocvcg/opencv/include -I/home/dell/Documents/purefusion/codegen/exe
INCLUDES = $(INCLUDES_BUILDINFO)
###########################################################################
## DEFINES
###########################################################################
DEFINES_CUSTOM =
DEFINES_STANDARD = -DMODEL=runeef
DEFINES = $(DEFINES_CUSTOM) $(DEFINES_STANDARD)
###########################################################################
## SOURCE FILES
###########################################################################
SRCS = $(START_DIR)/rt_nonfinite.cpp $(START_DIR)/rtGetNaN.cpp $(START_DIR)/rtGetInf.cpp $(MATLAB_ROOT)/toolbox/vision/builtins/src/ocv/detectFASTCore.cpp $(MATLAB_ROOT)/toolbox/vision/builtins/src/ocv/cgCommon.cpp $(MATLAB_ROOT)/toolbox/vision/builtins/src/ocv/extractFreakCore.cpp $(MATLAB_ROOT)/toolbox/vision/builtins/src/ocv/mwfreak.cpp /home/dell/Documents/purefusion/codegen/exe/main.cpp $(START_DIR)/runeef_rtwutil.cpp $(START_DIR)/runeef_data.cpp $(START_DIR)/runeef_initialize.cpp $(START_DIR)/runeef_terminate.cpp $(START_DIR)/runeef.cpp $(START_DIR)/colon.cpp $(START_DIR)/string1.cpp $(START_DIR)/rgb2gray.cpp $(START_DIR)/abs.cpp $(START_DIR)/histeq.cpp $(START_DIR)/minOrMax.cpp $(START_DIR)/sum.cpp $(START_DIR)/imhist.cpp $(START_DIR)/bsxfun.cpp $(START_DIR)/cornerPoints_cg.cpp $(START_DIR)/FeaturePointsImpl.cpp $(START_DIR)/repmat.cpp $(START_DIR)/extractFeatures.cpp $(START_DIR)/mod.cpp $(START_DIR)/eef.cpp $(START_DIR)/remapFun.cpp $(START_DIR)/prod.cpp $(START_DIR)/imfilter.cpp $(START_DIR)/padarray.cpp $(START_DIR)/multiscaleBlendingColor.cpp $(START_DIR)/gaussian_pyramid.cpp $(START_DIR)/laplacian_pyramid.cpp $(START_DIR)/upsample.cpp $(START_DIR)/reconstruct_laplacian_pyramid.cpp $(START_DIR)/robustNormalization.cpp $(START_DIR)/sort.cpp $(START_DIR)/sortIdx.cpp
ALL_SRCS = $(SRCS)
###########################################################################
## OBJECTS
###########################################################################
OBJS = rt_nonfinite.o rtGetNaN.o rtGetInf.o detectFASTCore.o cgCommon.o extractFreakCore.o mwfreak.o main.o runeef_rtwutil.o runeef_data.o runeef_initialize.o runeef_terminate.o runeef.o colon.o string1.o rgb2gray.o abs.o histeq.o minOrMax.o sum.o imhist.o bsxfun.o cornerPoints_cg.o FeaturePointsImpl.o repmat.o extractFeatures.o mod.o eef.o remapFun.o prod.o imfilter.o padarray.o multiscaleBlendingColor.o gaussian_pyramid.o laplacian_pyramid.o upsample.o reconstruct_laplacian_pyramid.o robustNormalization.o sort.o sortIdx.o
ALL_OBJS = $(OBJS)
###########################################################################
## PREBUILT OBJECT FILES
###########################################################################
PREBUILT_OBJS =
###########################################################################
## LIBRARIES
###########################################################################
LIBS = $(MATLAB_ROOT)/bin/glnxa64/libmwjpegreader.so $(MATLAB_ROOT)/bin/glnxa64/libopencv_calib3d.so.3.4 $(MATLAB_ROOT)/bin/glnxa64/libopencv_core.so.3.4 $(MATLAB_ROOT)/bin/glnxa64/libopencv_features2d.so.3.4 $(MATLAB_ROOT)/bin/glnxa64/libopencv_flann.so.3.4 $(MATLAB_ROOT)/bin/glnxa64/libopencv_imgproc.so.3.4 $(MATLAB_ROOT)/bin/glnxa64/libopencv_ml.so.3.4 $(MATLAB_ROOT)/bin/glnxa64/libopencv_objdetect.so.3.4 $(MATLAB_ROOT)/bin/glnxa64/libopencv_video.so.3.4 $(MATLAB_ROOT)/bin/glnxa64/libopencv_cudaarithm.so.3.4 $(MATLAB_ROOT)/bin/glnxa64/libopencv_cudabgsegm.so.3.4 $(MATLAB_ROOT)/bin/glnxa64/libopencv_cudafeatures2d.so.3.4 $(MATLAB_ROOT)/bin/glnxa64/libopencv_cudafilters.so.3.4 $(MATLAB_ROOT)/bin/glnxa64/libopencv_cudaimgproc.so.3.4 $(MATLAB_ROOT)/bin/glnxa64/libopencv_cudalegacy.so.3.4 $(MATLAB_ROOT)/bin/glnxa64/libopencv_cudaobjdetect.so.3.4 $(MATLAB_ROOT)/bin/glnxa64/libopencv_cudaoptflow.so.3.4 $(MATLAB_ROOT)/bin/glnxa64/libopencv_cudastereo.so.3.4 $(MATLAB_ROOT)/bin/glnxa64/libopencv_cudawarping.so.3.4 $(MATLAB_ROOT)/bin/glnxa64/libopencv_cudev.so.3.4 $(shell pkg-config --libs opencv)
#/usr/local/lib/libopencv_core.so.4.5.1 /usr/local/lib/libopencv_imgcodecs.so.4.5.1 /usr/local/lib/libopencv_highgui.so.4.5.1
###########################################################################
## SYSTEM LIBRARIES
###########################################################################
SYSTEM_LIBS = -L"$(MATLAB_ROOT)/bin/glnxa64" -lmwrgb2gray_tbb -lmwgetnumcores -lmwtbbhist -lmwgrayxform_tbb -lmwgrayto8 -lmwippfilter -lmwipp -lmwimfilter -lmwnhood -lm -lstdc++
###########################################################################
## ADDITIONAL TOOLCHAIN FLAGS
###########################################################################
#---------------
# C Compiler
#---------------
CFLAGS_ = -Wno-variadic-macros -Wno-variadic-macros
CFLAGS_BASIC = $(DEFINES) $(INCLUDES)
CFLAGS += $(CFLAGS_) $(CFLAGS_BASIC)
#-----------------
# C++ Compiler
#-----------------
CPPFLAGS_ = -Wno-variadic-macros -Wno-variadic-macros
CPPFLAGS_BASIC = $(DEFINES) $(INCLUDES)
CPPFLAGS += $(CPPFLAGS_) $(CPPFLAGS_BASIC)
###########################################################################
## INLINED COMMANDS
###########################################################################
###########################################################################
## PHONY TARGETS
###########################################################################
.PHONY : all build buildobj clean info prebuild download execute
all : build
@echo "### Successfully generated all binary outputs."
build : prebuild $(PRODUCT)
buildobj : prebuild $(OBJS) $(PREBUILT_OBJS) $(LIBS)
@echo "### Successfully generated all binary outputs."
prebuild :
download : $(PRODUCT)
execute : download
@echo "### Invoking postbuild tool "Execute" ..."
$(EXECUTE) $(EXECUTE_FLAGS)
@echo "### Done invoking postbuild tool."
###########################################################################
## FINAL TARGET
###########################################################################
#-------------------------------------------
# Create a standalone executable
#-------------------------------------------
$(PRODUCT) : $(OBJS) $(PREBUILT_OBJS) $(LIBS)
@echo "### Creating standalone executable "$(PRODUCT)" ..."
$(CPP_LD) $(CPP_LDFLAGS) -o $(PRODUCT) $(OBJS) -Wl,--start-group $(LIBS) -Wl,--end-group $(SYSTEM_LIBS) $(TOOLCHAIN_LIBS)
@echo "### Created: $(PRODUCT)"
###########################################################################
## INTERMEDIATE TARGETS
###########################################################################
#---------------------
# SOURCE-TO-OBJECT
#---------------------
%.o : %.c
$(CC) $(CFLAGS) -o "$@" "$<"
%.o : %.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
%.o : $(RELATIVE_PATH_TO_ANCHOR)/%.c
$(CC) $(CFLAGS) -o "$@" "$<"
%.o : $(RELATIVE_PATH_TO_ANCHOR)/%.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
%.o : $(START_DIR)/%.c
$(CC) $(CFLAGS) -o "$@" "$<"
%.o : $(START_DIR)/%.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
%.o : /home/dell/Documents/purefusion/%.c
$(CC) $(CFLAGS) -o "$@" "$<"
%.o : /home/dell/Documents/purefusion/%.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
%.o : $(MATLAB_ROOT)/toolbox/vision/builtins/src/ocv/%.c
$(CC) $(CFLAGS) -o "$@" "$<"
%.o : $(MATLAB_ROOT)/toolbox/vision/builtins/src/ocv/%.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
%.o : /home/dell/Documents/purefusion/codegen/exe/%.c
$(CC) $(CFLAGS) -o "$@" "$<"
%.o : /home/dell/Documents/purefusion/codegen/exe/%.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
rt_nonfinite.o : $(START_DIR)/rt_nonfinite.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
rtGetNaN.o : $(START_DIR)/rtGetNaN.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
rtGetInf.o : $(START_DIR)/rtGetInf.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
detectFASTCore.o : $(MATLAB_ROOT)/toolbox/vision/builtins/src/ocv/detectFASTCore.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
cgCommon.o : $(MATLAB_ROOT)/toolbox/vision/builtins/src/ocv/cgCommon.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
extractFreakCore.o : $(MATLAB_ROOT)/toolbox/vision/builtins/src/ocv/extractFreakCore.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
mwfreak.o : $(MATLAB_ROOT)/toolbox/vision/builtins/src/ocv/mwfreak.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
main.o : /home/dell/Documents/purefusion/codegen/exe/main.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
runeef_rtwutil.o : $(START_DIR)/runeef_rtwutil.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
runeef_data.o : $(START_DIR)/runeef_data.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
runeef_initialize.o : $(START_DIR)/runeef_initialize.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
runeef_terminate.o : $(START_DIR)/runeef_terminate.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
runeef.o : $(START_DIR)/runeef.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
colon.o : $(START_DIR)/colon.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
string1.o : $(START_DIR)/string1.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
rgb2gray.o : $(START_DIR)/rgb2gray.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
abs.o : $(START_DIR)/abs.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
histeq.o : $(START_DIR)/histeq.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
minOrMax.o : $(START_DIR)/minOrMax.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
sum.o : $(START_DIR)/sum.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
imhist.o : $(START_DIR)/imhist.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
bsxfun.o : $(START_DIR)/bsxfun.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
cornerPoints_cg.o : $(START_DIR)/cornerPoints_cg.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
FeaturePointsImpl.o : $(START_DIR)/FeaturePointsImpl.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
repmat.o : $(START_DIR)/repmat.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
extractFeatures.o : $(START_DIR)/extractFeatures.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
mod.o : $(START_DIR)/mod.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
eef.o : $(START_DIR)/eef.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
remapFun.o : $(START_DIR)/remapFun.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
prod.o : $(START_DIR)/prod.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
imfilter.o : $(START_DIR)/imfilter.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
padarray.o : $(START_DIR)/padarray.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
multiscaleBlendingColor.o : $(START_DIR)/multiscaleBlendingColor.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
gaussian_pyramid.o : $(START_DIR)/gaussian_pyramid.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
laplacian_pyramid.o : $(START_DIR)/laplacian_pyramid.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
upsample.o : $(START_DIR)/upsample.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
reconstruct_laplacian_pyramid.o : $(START_DIR)/reconstruct_laplacian_pyramid.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
robustNormalization.o : $(START_DIR)/robustNormalization.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
sort.o : $(START_DIR)/sort.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
sortIdx.o : $(START_DIR)/sortIdx.cpp
$(CPP) $(CPPFLAGS) -o "$@" "$<"
###########################################################################
## DEPENDENCIES
###########################################################################
$(ALL_OBJS) : rtw_proj.tmw $(MAKEFILE)
clean :
$(ECHO) "### Deleting all derived files..."
$(RM) $(PRODUCT)
$(RM) $(ALL_OBJS)
$(ECHO) "### Deleted all derived files."
以及make
命令后的部分对应消息。
g++ -I/usr/local/include/opencv -I/usr/local/include -c -fwrapv -std=c++11 -pedantic -fPIC -O3 -fno-loop-optimize -fno-aggressive-loop-optimizations -Wno-variadic-macros -Wno-variadic-macros -DMODEL=runeef -I/home/dell/Documents/purefusion/codegen/exe/runeef -I/home/dell/Documents/purefusion -I/usr/local/Polyspace/R2020a/extern/include -I/usr/local/Polyspace/R2020a/toolbox/vision/builtins/src/ocv/include -I/usr/local/Polyspace/R2020a/toolbox/vision/builtins/src/ocvcg/opencv/include -I/home/dell/Documents/purefusion/codegen/exe -o "reconstruct_laplacian_pyramid.o" "/home/dell/Documents/purefusion/codegen/exe/runeef/reconstruct_laplacian_pyramid.cpp"
g++ -I/usr/local/include/opencv -I/usr/local/include -c -fwrapv -std=c++11 -pedantic -fPIC -O3 -fno-loop-optimize -fno-aggressive-loop-optimizations -Wno-variadic-macros -Wno-variadic-macros -DMODEL=runeef -I/home/dell/Documents/purefusion/codegen/exe/runeef -I/home/dell/Documents/purefusion -I/usr/local/Polyspace/R2020a/extern/include -I/usr/local/Polyspace/R2020a/toolbox/vision/builtins/src/ocv/include -I/usr/local/Polyspace/R2020a/toolbox/vision/builtins/src/ocvcg/opencv/include -I/home/dell/Documents/purefusion/codegen/exe -o "robustNormalization.o" "/home/dell/Documents/purefusion/codegen/exe/runeef/robustNormalization.cpp"
g++ -I/usr/local/include/opencv -I/usr/local/include -c -fwrapv -std=c++11 -pedantic -fPIC -O3 -fno-loop-optimize -fno-aggressive-loop-optimizations -Wno-variadic-macros -Wno-variadic-macros -DMODEL=runeef -I/home/dell/Documents/purefusion/codegen/exe/runeef -I/home/dell/Documents/purefusion -I/usr/local/Polyspace/R2020a/extern/include -I/usr/local/Polyspace/R2020a/toolbox/vision/builtins/src/ocv/include -I/usr/local/Polyspace/R2020a/toolbox/vision/builtins/src/ocvcg/opencv/include -I/home/dell/Documents/purefusion/codegen/exe -o "sort.o" "/home/dell/Documents/purefusion/codegen/exe/runeef/sort.cpp"
g++ -I/usr/local/include/opencv -I/usr/local/include -c -fwrapv -std=c++11 -pedantic -fPIC -O3 -fno-loop-optimize -fno-aggressive-loop-optimizations -Wno-variadic-macros -Wno-variadic-macros -DMODEL=runeef -I/home/dell/Documents/purefusion/codegen/exe/runeef -I/home/dell/Documents/purefusion -I/usr/local/Polyspace/R2020a/extern/include -I/usr/local/Polyspace/R2020a/toolbox/vision/builtins/src/ocv/include -I/usr/local/Polyspace/R2020a/toolbox/vision/builtins/src/ocvcg/opencv/include -I/home/dell/Documents/purefusion/codegen/exe -o "sortIdx.o" "/home/dell/Documents/purefusion/codegen/exe/runeef/sortIdx.cpp"
make: *** No rule to make target '-L/usr/local/lib', needed by '/home/dell/Documents/purefusion/runeef'. Stop.
另外,当我从中删除 $LIBS 时的错误消息
$(PRODUCT) : $(OBJS) $(PREBUILT_OBJS) $(LIBS)
@echo "### Creating standalone executable "$(PRODUCT)" ..."
$(CPP_LD) $(CPP_LDFLAGS) -o $(PRODUCT) $(OBJS) -Wl,--start-group $(LIBS) -Wl,--end-group $(SYSTEM_LIBS) $(TOOLCHAIN_LIBS)
@echo "### Created: $(PRODUCT)"
最后几行消息
g++ -I/usr/local/include/opencv -I/usr/local/include -c -fwrapv -std=c++11 -pedantic -fPIC -O3 -fno-loop-optimize -fno-aggressive-loop-optimizations -Wno-variadic-macros -Wno-variadic-macros -DMODEL=runeef -I/home/dell/Documents/purefusion/codegen/exe/runeef -I/home/dell/Documents/purefusion -I/usr/local/Polyspace/R2020a/extern/include -I/usr/local/Polyspace/R2020a/toolbox/vision/builtins/src/ocv/include -I/usr/local/Polyspace/R2020a/toolbox/vision/builtins/src/ocvcg/opencv/include -I/home/dell/Documents/purefusion/codegen/exe -o "sortIdx.o" "/home/dell/Documents/purefusion/codegen/exe/runeef/sortIdx.cpp"
### Creating standalone executable /home/dell/Documents/purefusion/runeef ...
g++ -Wl,-rpath,"/usr/local/Polyspace/R2020a/bin/glnxa64",-L"/usr/local/Polyspace/R2020a/bin/glnxa64" -o /home/dell/Documents/purefusion/runeef rt_nonfinite.o rtGetNaN.o rtGetInf.o detectFASTCore.o cgCommon.o extractFreakCore.o mwfreak.o main.o runeef_rtwutil.o runeef_data.o runeef_initialize.o runeef_terminate.o runeef.o colon.o string1.o rgb2gray.o abs.o histeq.o minOrMax.o sum.o imhist.o bsxfun.o cornerPoints_cg.o FeaturePointsImpl.o repmat.o extractFeatures.o mod.o eef.o remapFun.o prod.o imfilter.o padarray.o multiscaleBlendingColor.o gaussian_pyramid.o laplacian_pyramid.o upsample.o reconstruct_laplacian_pyramid.o robustNormalization.o sort.o sortIdx.o -Wl,--start-group /usr/local/Polyspace/R2020a/bin/glnxa64/libmwjpegreader.so /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_calib3d.so.3.4 /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_core.so.3.4 /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_features2d.so.3.4 /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_flann.so.3.4 /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_imgproc.so.3.4 /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_ml.so.3.4 /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_objdetect.so.3.4 /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_video.so.3.4 /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_cudaarithm.so.3.4 /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_cudabgsegm.so.3.4 /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_cudafeatures2d.so.3.4 /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_cudafilters.so.3.4 /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_cudaimgproc.so.3.4 /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_cudalegacy.so.3.4 /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_cudaobjdetect.so.3.4 /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_cudaoptflow.so.3.4 /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_cudastereo.so.3.4 /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_cudawarping.so.3.4 /usr/local/Polyspace/R2020a/bin/glnxa64/libopencv_cudev.so.3.4 -L/usr/local/lib -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dpm -lopencv_highgui -lopencv_videoio -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_hfs -lopencv_img_hash -lopencv_line_descriptor -lopencv_optflow -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_xfeatures2d -lopencv_shape -lopencv_video -lopencv_ml -lopencv_ximgproc -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core -Wl,--end-group -L"/usr/local/Polyspace/R2020a/bin/glnxa64" -lmwrgb2gray_tbb -lmwgetnumcores -lmwtbbhist -lmwgrayxform_tbb -lmwgrayto8 -lmwippfilter -lmwipp -lmwimfilter -lmwnhood -lm -lstdc++
/usr/bin/ld: /usr/local/lib/libopencv_imgcodecs.so: undefined reference to `cv::Mat::Mat()'
/usr/bin/ld: /usr/local/lib/libopencv_imgcodecs.so: undefined reference to `cv::detail::check_failed_auto(int, cv::detail::CheckContext const&)'
/usr/bin/ld: /usr/local/lib/libopencv_imgcodecs.so: undefined reference to `cv::Mat::Mat(int, int, int)'
/usr/bin/ld: /usr/local/lib/libopencv_imgcodecs.so: undefined reference to `cv::detail::check_failed_MatType(int, cv::detail::CheckContext const&)'
/usr/bin/ld: /usr/local/lib/libopencv_imgcodecs.so: undefined reference to `cv::detail::check_failed_MatType(int, int, cv::detail::CheckContext const&)'
/usr/bin/ld: /usr/local/lib/libopencv_imgcodecs.so: undefined reference to `cv::detail::check_failed_MatDepth(int, int, cv::detail::CheckContext const&)'
/usr/bin/ld: /usr/local/lib/libopencv_imgcodecs.so: undefined reference to `cv::detail::check_failed_auto(int, int, cv::detail::CheckContext const&)'
/usr/bin/ld: /usr/local/lib/libopencv_imgcodecs.so: undefined reference to `cv::Mat::total() const'
/usr/bin/ld: /usr/local/lib/libopencv_imgcodecs.so: undefined reference to `cv::detail::check_failed_auto(unsigned long, unsigned long, cv::detail::CheckContext const&)'
collect2: error: ld returned 1 exit status
make: *** [runeef_rtw.mk:270: /home/dell/Documents/purefusion/runeef] Error 1
【问题讨论】:
你能显示makefile吗?从错误文本中我猜测编译命令中使用的一个或多个变量扩展为一个空字符串,导致编译器认为命令中的其他标记实际上是所需的输出目标。 根据您提供的信息无法得知。您必须展示您所做的:CFLAGS
的值、使用的规则等。
我更新了将链接添加到 makefile 的问题。
请注意,您的 makefile 应作为格式化文本包含在问题中,不通过需要下载的链接引用。
【参考方案1】:
您的 makefile 具有变量分配(为简洁起见进行了编辑)...
LIBS = $(MATLAB_ROOT)/bin/glnxa64/libmwjpegreader.so ... $(shell pkg-config --libs opencv)
$(shell pkg-config --libs opencv)
组件将扩展为...
-L/usr/local/lib -lopencv
但是您随后使用 $(LIBS)
作为多个目标的依赖项,例如...
$(PRODUCT) : $(OBJS) $(PREBUILT_OBJS) $(LIBS)
扩展为(再次,为简洁起见)...
$(PRODUCT) : $(OBJS) $(PREBUILT_OBJS) -L/usr/local/lib -lopencv
因此,当make
尝试处理目标$(PRODUCT)
时,它会看到目标似乎依赖于-L/usr/local/lib
并采取相应的行动。
如果没有更多上下文,很难提供更完整的答案,但 $(LIBS)
可能不应该被列为此目标或任何其他目标的依赖项。
【讨论】:
感谢您的回答,仍然报同样的错误。 MATLAB_ROOT 包括一些 opencv 库,这些库最初包含在 makefile 中,但我需要更多 opencv 库。所以在发布这个问题之前,我首先尝试单独包含缺少的库,它产生了错误消息“usr/local/lib/make
的输出,该输出会逐字显示失败的命令和后续错误消息。
刚刚编辑添加了最后几行消息,包括make
命令之后的错误消息。
您看到的新错误来自链接器,与原始问题完全无关。请参阅this post。以上是关于没有规则使目标'-L/usr/local/lib'的主要内容,如果未能解决你的问题,请参考以下文章
Recursive makefile 没有规则使目标“全部”。停止