I am facing a problem while trying to link opencv to CPP project generated by Matlab Coder. In the auto generated Makefile of the project, I added pkg-config --cflags opencv to CFLAGS and pkg-config --libs opencv to LIBS (opencv 3.4), which then gives the error "No rule to make target '-L/usr/local/lib'". Any ideas how to fix ther error?
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."
And a part of the corresponding messages after make command.
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.
Also, the error message when I am removing $LIBS from
$(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)"
Last few lines of messages
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
Your makefile has the variable assignment (edited for brevity)...
LIBS = $(MATLAB_ROOT)/bin/glnxa64/libmwjpegreader.so ... $(shell pkg-config --libs opencv)
Where the $(shell pkg-config --libs opencv) component will expand to something like...
-L/usr/local/lib -lopencv
But you then use $(LIBS) as a dependency for several targets, e.g...
$(PRODUCT) : $(OBJS) $(PREBUILT_OBJS) $(LIBS)
which expands to (again, edited for brevity)...
$(PRODUCT) : $(OBJS) $(PREBUILT_OBJS) -L/usr/local/lib -lopencv
Hence, when make attempts to process the target $(PRODUCT) it will see that the target seemingly depends on -L/usr/local/lib and act accordingly.
It's difficult to provide a more complete answer without more context but $(LIBS) probably shouldn't be listed as a dependency for this or any other targets.
Related
Because of the need of the project, we have changed the core/chaincode/shim of fabric1.0.0. The tree structure of shim is:
shim
├── chaincode.go
├── handler.go
├── inprocstream.go
├── interfaces.go
├── java
│ └── ···
├── mockstub.go
├── mockstub_test.go
├── response.go
├── myxxxutil.go
├── shim_test.go
└── myxxx.go
Some of these functions require cgo, which is writen in c++, there is some code snippet:
//myxxx.go
package shim
/*
#cgo CFLAGS: -I/opt/xxxsrc
#cgo LDFLAGS: -L/usr/lib -lmyxxx
#include "interface.hpp"
#include <stdlib.h>
*/
import "C"
func SomeFucn(){
··· //the C++ source code is in /opt/xxxsrc folder,so is interface.hpp file,the libmyxxx.so file is in /usr/lib folder
}
The, I used the make docker command to create a peer image based on hyperledger/fabric-baseimage:x86_64-0.3.1 under fabric directory. This hyperledger/fabric-baseimage:x86_64-0.3.1 has been modified by me. I put the libmyxxx. so file into /usr/lib folder of this "baseimage", and put the c++ soure code into /opt/xxxsrc, Then the execution log is:
Building build/docker/bin/peer
(the docker command line is:
docker run -i --rm --user=0 -v /home/my/gopath/src/github.com/hyperledger/fabric:/opt/gopath/src/github.com/hyperledger/fabric -w /opt/gopath/src/github.com/hyperledger/fabric -v /home/my/gopath/src/github.com/hyperledger/fabric/build/docker/bin:/opt/gopath/bin -v /home/my/gopath/src/github.com/hyperledger/fabric/build/docker/peer/pkg:/opt/gopath/pkg hyperledger/fabric-baseimage:x86_64-0.3.1
go install -ldflags "-X github.com/hyperledger/fabric/common/metadata.Version=1.0.0 -X github.com/hyperledger/fabric/common/metadata.BaseVersion=0.3.1 -X github.com/hyperledger/fabric/common/metadata.BaseDockerLabel=org.hyperledger.fabric -X github.com/hyperledger/fabric/common/metadata.DockerNamespace=hyperledger -X github.com/hyperledger/fabric/common/metadata.BaseDockerNamespace=hyperledger -linkmode external -extldflags -static -lpthread" github.com/hyperledger/fabric/peer
)
github.com/hyperledger/fabric/core/chaincode/shim
mkdir -p $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/
cd /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim
CGO_LDFLAGS="-g" "-O2" "-L/usr/lib" "-lmyxxx" "-L/usr/lib" "-lmyxxx" /opt/go/pkg/tool/linux_amd64/cgo -objdir $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/ -importpath github.com/hyperledger/fabric/core/chaincode/shim – -I $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/ -I/opt/xxxsrc -I/opt/xxxsrc myxxxutil.go myxxx.go
cd /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim
gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/ -g -O2 -I/opt/xxxsrc -I/opt/xxxsrc -o $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/_cgo_main.o -c $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/_cgo_main.c
cd /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim
gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/ -g -O2 -I/opt/xxxsrc -I/opt/xxxsrc -o $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/_cgo_export.o -c $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/_cgo_export.c
gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/ -g -O2 -I/opt/xxxsrc -I/opt/xxxsrc -o $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/myxxxutil.cgo2.o -c $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/myxxxutil.cgo2.c
gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/ -g -O2 -I/opt/xxxsrc -I/opt/xxxsrc -o $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/xxx.cgo2.o -c $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/xxx.cgo2.c
cd /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim
gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -o $WORK/github.com/hyperledger/fabric/core/chaincode/shim/obj/_cgo.o $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/_cgo_main.o $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/_cgo_export.o $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/myxxxutil.cgo2.o $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/myxxx.cgo2.o -g -O2 -L/usr/lib -lmyxxx -L/usr/lib -lmyxxx
cd /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim
/opt/go/pkg/tool/linux_amd64/cgo -objdir $WORK/github.com/hyperledger/fabric/core/chaincode/shim/obj/ -dynpackage shim -dynimport $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/_cgo.o -dynout $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/_cgo_import.go
gcc I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -o $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/_all.o $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/_cgo_export.o $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/myxxxutil.cgo2.o $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/myxxx.cgo2.o -g -O2 -L/usr/lib -L/usr/lib -Wl,-r -nostdlib -no-pie -Wl,-build-id=none
/opt/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/hyperledger/fabric/core/chaincode/shim.a -trimpath $WORK -p github.com/hyperledger/fabric/core/chaincode/shim -buildid 2ee9889b3f3fdd6fc02e5029d94e8c287f977ccb -importmap github.com/golang/protobuf/proto=github.com/hyperledger/fabric/vendor/github.com/golang/protobuf/proto -importmap github.com/golang/protobuf/ptypes/timestamp=github.com/hyperledger/fabric/vendor/github.com/golang/protobuf/ptypes/timestamp -importmap github.com/looplab/fsm=github.com/hyperledger/fabric/vendor/github.com/looplab/fsm -importmap github.com/op/go-logging=github.com/hyperledger/fabric/vendor/github.com/op/go-logging -importmap github.com/spf13/viper=github.com/hyperledger/fabric/vendor/github.com/spf13/viper -importmap golang.org/x/net/context=github.com/hyperledger/fabric/vendor/golang.org/x/net/context -importmap google.golang.org/grpc=github.com/hyperledger/fabric/vendor/google.golang.org/grpc -D _/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim -I $WORK -I /opt/gopath/pkg/linux_amd64 -pack ./chaincode.go ./fileIO.go ./handler.go ./inprocstream.go ./interfaces.go ./mockstub.go ./response.go $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/_cgo_gotypes.go $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/myxxxutil.cgo1.go $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/myxxx.cgo1.go $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/_cgo_import.go
cd /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim
pack r $WORK/github.com/hyperledger/fabric/core/chaincode/shim.a $WORK/github.com/hyperledger/fabric/core/chaincode/shim/_obj/_all.o # internal
cp $WORK/github.com/hyperledger/fabric/core/chaincode/shim.a /opt/gopath/pkg/linux_amd64/github.com/hyperledger/fabric/core/chaincode/shim.a
/opt/go/pkg/tool/linux_amd64/link -o $WORK/github.com/hyperledger/fabric/peer/_obj/exe/a.out -L $WORK -L /opt/gopath/pkg/linux_amd64 -extld=gcc -buildmode=exe -buildid=c7ee3188106eddcbae7255ad032536402bc38b29 -X github.com/hyperledger/fabric/common/metadata.Version=1.0.0 -X github.com/hyperledger/fabric/common/metadata.BaseVersion=0.3.1 -X github.com/hyperledger/fabric/common/metadata.BaseDockerLabel=org.hyperledger.fabric -X github.com/hyperledger/fabric/common/metadata.DockerNamespace=hyperledger -X github.com/hyperledger/fabric/common/metadata.BaseDockerNamespace=hyperledger -linkmode external -extldflags "-static -lpthread" $WORK/github.com/hyperledger/fabric/peer.a
github.com/hyperledger/fabric/peer
/opt/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: cannot find -lmyxxx
/usr/bin/ld: cannot find -lmyxxx
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libltdl.a(dlopen.o): In function `vm_open':
(.text+0x5e): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/tmp/go-link-940349017/000001.o: In function `_cgo_7a2d42f1a351_C2func_getaddrinfo':
/tmp/workdir/go/src/net/cgo_unix.go:66: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
collect2: error: ld returned 1 exit status
Makefile:197: recipe for target 'build/docker/bin/peer' failed
make: *** [build/docker/bin/peer] Error 2
I already tried to add path (/usr/lib) in /etc/ld.so.conf file, and executed "ldconfig", and also tried to add path to environment variables LD_LIBRARY_PATH and LIBRARY_PATH, the problem still reappears, so I would like to ask if there is any solution to the problem, thank you
I am getting errors while running bundle install in CircleCI.
circle.yml
dependencies:
pre:
- sudo apt-get clean; sudo mv /var/lib/apt/lists /tmp; sudo mkdir -p /var/lib/apt/lists/partial; sudo apt-get clean; sudo apt-get update; sudo apt-get install libpango1.0-0; sudo apt-get install firefox; sudo apt-get install libxml2-dev
override:
- bundle install:
timeout: 180
Error message:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/ubuntu/.rvm/gems/ruby-2.2.3/gems/capybara-webkit-1.8.0
/home/ubuntu/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20161127-19628-guj91w.rb extconf.rb
cd src/ && /usr/bin/qmake /home/ubuntu/.rvm/gems/ruby-2.2.3/gems/capybara-webkit-1.8.0/src/webkit_server.pro -o Makefile.webkit_server
cd src/ && make -f Makefile.webkit_server
make[1]: Entering directory `/home/ubuntu/.rvm/gems/ruby-2.2.3/gems/capybara-webkit-1.8.0/src'
g++ -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtWebKit -I/usr/include/qt4 -Ibuild -x c++-header -c stable.h -o build/webkit_server.gch/c++
In file included from /usr/include/qt4/QtCore/QtCore:108:0,
from /usr/include/qt4/QtNetwork/QtNetwork:3,
from stable.h:30:
/usr/include/qt4/QtCore/qtconcurrentfilter.h: In function ‘QtConcurrent::ThreadEngineStarter<void> QtConcurrent::filterInternal(Sequence&, KeepFunctor, ReduceFunctor)’:
/usr/include/qt4/QtCore/qtconcurrentfilter.h:108:47: warning: typedef ‘Iterator’ locally defined but not used [-Wunused-local-typedefs]
typedef typename Sequence::const_iterator Iterator;
^
g++ -c -include build/webkit_server -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtWebKit -I/usr/include/qt4 -Ibuild -o build/BlockUrl.o BlockUrl.cpp
g++ -c -include build/webkit_server -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtWebKit -I/usr/include/qt4 -Ibuild -o build/AllowUrl.o AllowUrl.cpp
g++ -c -include build/webkit_server -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtWebKit -I/usr/include/qt4 -Ibuild -o build/SetUnknownUrlMode.o SetUnknownUrlMode.cpp
g++ -c -include build/webkit_server -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtWebKit -I/usr/include/qt4 -Ibuild -o build/FindModal.o FindModal.cpp
Please give me your advice!
Regards,
Anthony
Please try this
sudo apt-get install qt4-dev-tools libqt4-dev libqt4-core libqt4-gui
then
gem install capybara-webkit -v '1.8.0'
I hope this will work
I am trying to learn cpputest, so went to the cpputest manual and copied the below code in my ubuntu 14.04lts laptop, and tried to make. I am new to make files, and I got a bunch of errors - how can I correct my code?
#include "CppUTest/TestHarness.h"
#include "CppUTest/TestOutput.h"
TEST_GROUP(FirstTestGroup)
{
};
TEST(FirstTestGroup, FirstTest)
{
FAIL("Fail me!");
}
TEST(FirstTestGroup, SecondTest)
{
STRCMP_EQUAL("hello", "world");
LONGS_EQUAL(1, 2);
CHECK(false);
}
That is test.cpp, and i have main like below named test_main.cpp
#include "CppUTest/CommandLineTestRunner.h"
int main(int argc, char** argv)
{
return CommandLineTestRunner::RunAllTests(argc, argv);
}
The make file is:
all: test
export CPPUTEST_HOME=/usr/share/cpputest
CPPFLAGS += -I$(CPPUTEST_HOME)/include
LD_LIBRARIES = -L$(CPPUTEST_HOME)/lib -lCppUTest -lCppUTestExt
test: test_main.o test.o
g++ -o mytest test.o test_main.o
test_main.o: test_main.cpp
g++ -c test_main.cpp $(CPPFLAGS)
test.o: test.cpp
g++ -c test.cpp $(CPPFLAGS) $(LD_LIBRARIES)
#g++ -C -o test_main.o test_main.cpp test.o test.cpp $(CPPFLAGS)
#g++ -o mytest tet_main.o test.o $(LD_LIBRARIES)
clean:
rm -f *.o mytest
When I say make
I get a bunch of errors.
Please help me in this regard
I changed the my makefile as follows: after the changes it worked
all: mytest
export CPPUTEST_HOME=/usr/local
CPPFLAGS += -I$(CPPUTEST_HOME)/include
LD_LIBRARIES = -L$(CPPUTEST_HOME)/lib -lCppUTest -lCppUTestExt
mytest: test_main.o test.o
g++ -g -o mytest test.o test_main.o $(LD_LIBRARIES)
test_main.o: test_main.cpp
g++ -g $(CPPFLAGS) -c test_main.cpp
test.o: test.cpp
g++ -g $(CPPFLAGS) -c test.cpp
clean:
rm -f *.o mytest
I am working on Open Source ChatSecure (iOS). (https://chatsecure.org/developers/)
But while creating build I am getting error "missing required architecture x86_64 in file". This error occurs only if I am using 64-bit architecture simulator, Its working fine with other simulators.
In log I have checked that errors are because of these three libraries (libotr.a, libgcrypt.a, libgpg-error.a) which are part of OTRKit (Submodule of ChatSecure-iOS). These libraries are not building properly which compatibles with x86_64 architecture.
For building those libraries I have followed following steps,
1) $ git submodule add https://github.com/ChatSecure/OTRKit.git Submodules/OTRKit (added OTRKit as a Submodule in ChatSecure app)
2) $ bash build-libgpg-error.sh
3) $ bash build-libgcrypt.sh
4) $ bash build-libotr.sh
Following log is generated while building libgpg-error.a,
xxx-Mac-Minixxx:OTRKit xxx$ bash build-libgpg-error.sh
Building libgpg-error...
[Travis Detected] GPG verification disabled - Compiling for i386 only
Downloading libgpg-error-1.12.tar.bz2
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 477k 100 477k 0 0 13777 0 0:00:35 0:00:35 --:--:-- 19253
Building without ccache
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for i386-apple-darwin-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking build system type... x86_64-apple-darwin12.5.0
checking host system type... i386-apple-darwin
configure: autobuild project... libgpg-error
configure: autobuild revision... 1.12
configure: autobuild hostname... xxx-Mac-Minixxx.local
configure: autobuild timestamp... 20140830-194606
checking for i386-apple-darwin-gcc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking whether gcc and cc understand -c and -o together... rm: conftest.dSYM: is a directory
yes
checking how to run the C preprocessor... gcc -E
checking for gawk... (cached) awk
checking for i386-apple-darwin-ar... no
checking for ar... ar
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... no
checking for i386-apple-darwin-dumpbin... no
checking for i386-apple-darwin-link... no
checking for dumpbin... no
checking for link... link -dump
checking the name lister (nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-apple-darwin12.5.0 file names to i386-apple-darwin format... func_convert_file_noop
checking how to convert x86_64-apple-darwin12.5.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for i386-apple-darwin-objdump... no
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for i386-apple-darwin-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for i386-apple-darwin-ar... ar
checking for archiver #FILE support... no
checking for i386-apple-darwin-strip... strip
checking for i386-apple-darwin-ranlib... no
checking for ranlib... ranlib
checking command to parse nm output from gcc object... ok
checking for sysroot... /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk
checking for i386-apple-darwin-mt... no
checking for mt... no
checking if : is a manifest tool... no
checking for i386-apple-darwin-dsymutil... no
checking for dsymutil... dsymutil
checking for i386-apple-darwin-nmedit... no
checking for nmedit... nmedit
checking for i386-apple-darwin-lipo... no
checking for lipo... lipo
checking for i386-apple-darwin-otool... no
checking for otool... otool
checking for i386-apple-darwin-otool64... no
checking for otool64... no
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin dyld
checking how to hardcode library paths into programs... immediate
checking for i386-apple-darwin-windres... no
checking for windres... no
checking for cc for build... gcc
checking whether NLS is requested... yes
checking for msgfmt... no
checking for gmsgfmt... :
checking for xgettext... no
checking for msgmerge... no
checking for ld used by GCC... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for shared library run path origin... done
checking for CFPreferencesCopyAppValue... yes
checking for CFLocaleCopyCurrent... yes
checking for GNU gettext in libc... no
checking for iconv... yes
checking for working iconv... yes
checking how to link with libiconv... -liconv
checking for GNU gettext in libintl... no
checking whether to use NLS... no
checking for ANSI C header files... (cached) yes
checking for stdlib.h... (cached) yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char *... no
checking for strerror_r... (cached) yes
checking for an ANSI C-conforming const... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/gpg-error-config
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
libgpg-error-1.12 prepared for make
Revision: 12243ce (4644)
Platform: i386-apple-darwin
make all-recursive
Making all in m4
make[2]: Nothing to be done for `all'.
Making all in src
awk -f ./mkerrnos.awk ./errnos.in >code-to-errno.h
awk -f ./mkerrcodes1.awk ./errnos.in >_mkerrcodes.h
gcc -E _mkerrcodes.h | grep GPG_ERR_ | \
awk -f ./mkerrcodes.awk >mkerrcodes.h
awk -f ./mkstrtable.awk -v textidx=2 -v nogettext=1 \
./err-sources.h.in >err-sources-sym.h
awk -f ./mkstrtable.awk -v textidx=2 -v nogettext=1 \
./err-codes.h.in >err-codes-sym.h
awk -f ./mkstrtable.awk -v textidx=2 -v nogettext=1 \
-v prefix=GPG_ERR_ -v namespace=errnos_ \
./errnos.in >errnos-sym.h
rm extra-h.in
rm: extra-h.in: No such file or directory
make[2]: [extra-h.in] Error 1 (ignored)
echo "/* The version string of this header. */" >>extra-h.in
rm _mkerrcodes.h
echo "#define GPG_ERROR_VERSION \"1.12\"" >>extra-h.in
cat ./gpg-error.def.in >_gpg-error.def.h
echo >>extra-h.in
echo "/* The version number of this header. */" >>extra-h.in
gcc -E -I. -I.. _gpg-error.def.h | \
grep -v '^#' >gpg-error.def
echo "#define GPG_ERROR_VERSION_NUMBER 0x010c00" >>extra-h.in
echo >>extra-h.in
echo EOF >>extra-h.in
echo "/*dummy*/" > mkw32errmap.map.c
gcc -I. -I. -o mkerrcodes ./mkerrcodes.c
rm _gpg-error.def.h
awk -f ./mkheader.awk \
./err-sources.h.in \
./err-codes.h.in \
./errnos.in \
extra-h.in \
./gpg-error.h.in > gpg-error.h
./mkerrcodes | awk -f ./mkerrcodes2.awk >code-from-errno.h
make all-am
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/locale\" -g -arch i386 -fPIE -miphoneos-version-min=6.0 -I/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -MT libgpg_error_la-init.lo -MD -MP -MF .deps/libgpg_error_la-init.Tpo -c -o libgpg_error_la-init.lo `test -f 'init.c' || echo './'`init.c
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/locale\" -g -arch i386 -fPIE -miphoneos-version-min=6.0 -I/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -MT libgpg_error_la-version.lo -MD -MP -MF .deps/libgpg_error_la-version.Tpo -c -o libgpg_error_la-version.lo `test -f 'version.c' || echo './'`version.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/locale\" -g -arch i386 -miphoneos-version-min=6.0 -I/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -MT libgpg_error_la-version.lo -MD -MP -MF .deps/libgpg_error_la-version.Tpo -c version.c -fno-common -DPIC -o libgpg_error_la-version.o
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/locale\" -g -arch i386 -miphoneos-version-min=6.0 -I/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -MT libgpg_error_la-init.lo -MD -MP -MF .deps/libgpg_error_la-init.Tpo -c init.c -fno-common -DPIC -o libgpg_error_la-init.o
mv -f .deps/libgpg_error_la-init.Tpo .deps/libgpg_error_la-init.Plo
mv -f .deps/libgpg_error_la-version.Tpo .deps/libgpg_error_la-version.Plo
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/locale\" -g -arch i386 -fPIE -miphoneos-version-min=6.0 -I/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -MT libgpg_error_la-strsource.lo -MD -MP -MF .deps/libgpg_error_la-strsource.Tpo -c -o libgpg_error_la-strsource.lo `test -f 'strsource.c' || echo './'`strsource.c
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/locale\" -g -arch i386 -fPIE -miphoneos-version-min=6.0 -I/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -MT libgpg_error_la-strerror.lo -MD -MP -MF .deps/libgpg_error_la-strerror.Tpo -c -o libgpg_error_la-strerror.lo `test -f 'strerror.c' || echo './'`strerror.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/locale\" -g -arch i386 -miphoneos-version-min=6.0 -I/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -MT libgpg_error_la-strsource.lo -MD -MP -MF .deps/libgpg_error_la-strsource.Tpo -c strsource.c -fno-common -DPIC -o libgpg_error_la-strsource.o
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/locale\" -g -arch i386 -miphoneos-version-min=6.0 -I/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -MT libgpg_error_la-strerror.lo -MD -MP -MF .deps/libgpg_error_la-strerror.Tpo -c strerror.c -fno-common -DPIC -o libgpg_error_la-strerror.o
mv -f .deps/libgpg_error_la-strsource.Tpo .deps/libgpg_error_la-strsource.Plo
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/locale\" -g -arch i386 -fPIE -miphoneos-version-min=6.0 -I/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -MT libgpg_error_la-code-to-errno.lo -MD -MP -MF .deps/libgpg_error_la-code-to-errno.Tpo -c -o libgpg_error_la-code-to-errno.lo `test -f 'code-to-errno.c' || echo './'`code-to-errno.c
mv -f .deps/libgpg_error_la-strerror.Tpo .deps/libgpg_error_la-strerror.Plo
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/locale\" -g -arch i386 -fPIE -miphoneos-version-min=6.0 -I/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -MT libgpg_error_la-code-from-errno.lo -MD -MP -MF .deps/libgpg_error_la-code-from-errno.Tpo -c -o libgpg_error_la-code-from-errno.lo `test -f 'code-from-errno.c' || echo './'`code-from-errno.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/locale\" -g -arch i386 -miphoneos-version-min=6.0 -I/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -MT libgpg_error_la-code-to-errno.lo -MD -MP -MF .deps/libgpg_error_la-code-to-errno.Tpo -c code-to-errno.c -fno-common -DPIC -o libgpg_error_la-code-to-errno.o
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/locale\" -g -arch i386 -miphoneos-version-min=6.0 -I/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -MT libgpg_error_la-code-from-errno.lo -MD -MP -MF .deps/libgpg_error_la-code-from-errno.Tpo -c code-from-errno.c -fno-common -DPIC -o libgpg_error_la-code-from-errno.o
mv -f .deps/libgpg_error_la-code-to-errno.Tpo .deps/libgpg_error_la-code-to-errno.Plo
gcc -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/locale\" -g -arch i386 -fPIE -miphoneos-version-min=6.0 -I/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -MT gpg_error-strsource-sym.o -MD -MP -MF .deps/gpg_error-strsource-sym.Tpo -c -o gpg_error-strsource-sym.o `test -f 'strsource-sym.c' || echo './'`strsource-sym.c
mv -f .deps/libgpg_error_la-code-from-errno.Tpo .deps/libgpg_error_la-code-from-errno.Plo
gcc -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/locale\" -g -arch i386 -fPIE -miphoneos-version-min=6.0 -I/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -MT gpg_error-strerror-sym.o -MD -MP -MF .deps/gpg_error-strerror-sym.Tpo -c -o gpg_error-strerror-sym.o `test -f 'strerror-sym.c' || echo './'`strerror-sym.c
mv -f .deps/gpg_error-strsource-sym.Tpo .deps/gpg_error-strsource-sym.Po
gcc -DHAVE_CONFIG_H -I. -I.. -DLOCALEDIR=\"/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/locale\" -g -arch i386 -fPIE -miphoneos-version-min=6.0 -I/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -MT gpg_error-gpg-error.o -MD -MP -MF .deps/gpg_error-gpg-error.Tpo -c -o gpg_error-gpg-error.o `test -f 'gpg-error.c' || echo './'`gpg-error.c
mv -f .deps/gpg_error-strerror-sym.Tpo .deps/gpg_error-strerror-sym.Po
/bin/sh ../libtool --tag=CC --mode=link gcc -g -arch i386 -fPIE -miphoneos-version-min=6.0 -I/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -version-info 10:0:10 -arch i386 -fPIE -miphoneos-version-min=6.0 -L/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/lib -o libgpg-error.la -rpath /Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/lib libgpg_error_la-init.lo libgpg_error_la-version.lo libgpg_error_la-strsource.lo libgpg_error_la-strerror.lo libgpg_error_la-code-to-errno.lo libgpg_error_la-code-from-errno.lo
t-version.c:86:42: warning: data argument not used by format string
[-Wformat-extra-args]
" for a newer version\n", logpfx);
~~~~~~~~~~~~~~~~~~~~~~~~ ^
1 warning generated.
mv -f .deps/t-version.Tpo .deps/t-version.Po
gcc -DHAVE_CONFIG_H -I. -I.. -I../src -g -arch i386 -fPIE -miphoneos-version-min=6.0 -I/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -MT t-syserror.o -MD -MP -MF .deps/t-syserror.Tpo -c -o t-syserror.o t-syserror.c
mv -f .deps/t-strerror.Tpo .deps/t-strerror.Po
/bin/sh ../libtool --tag=CC --mode=link gcc -g -arch i386 -fPIE -miphoneos-version-min=6.0 -I/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -arch i386 -fPIE -miphoneos-version-min=6.0 -L/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/dependencies/lib -o t-syserror t-syserror.o ../src/libgpg-error.la
make install-am
.././install-sh -c -d '/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/lib'
/bin/sh ../libtool --mode=install /usr/bin/install -c libgpg-error.la '/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/lib'
libtool: install: /usr/bin/install -c .libs/libgpg-error.lai /Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/lib/libgpg-error.la
libtool: install: /usr/bin/install -c .libs/libgpg-error.a /Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/lib/libgpg-error.a
libtool: install: chmod 644 /Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/lib/libgpg-error.a
libtool: install: ranlib /Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/lib/libgpg-error.a
.././install-sh -c -d '/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/bin'
/bin/sh ../libtool --mode=install /usr/bin/install -c gpg-error '/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/bin'
libtool: install: /usr/bin/install -c gpg-error /Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/bin/gpg-error
.././install-sh -c -d '/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/bin'
/usr/bin/install -c gpg-error-config '/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/bin'
.././install-sh -c -d '/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/include'
/usr/bin/install -c -m 644 gpg-error.h '/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/include'
.././install-sh -c -d '/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/aclocal'
/usr/bin/install -c -m 644 gpg-error.m4 '/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/aclocal'
Making install in tests
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
Making install in po
if test "libgpg-error" = "gettext-tools"; then \
.././install-sh -c -d /Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/gettext/po; \
for file in Makefile.in.in remove-potcdate.sin quot.sed boldquot.sed en#quot.header en#boldquot.header insert-header.sin Rules-quot Makevars.template; do \
/usr/bin/install -c -m 644 ./$file \
/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/gettext/po/$file; \
done; \
for file in Makevars; do \
rm -f /Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/gettext/po/$file; \
done; \
else \
: ; \
fi
Making install in lang
Making install in cl
make[3]: Nothing to be done for `install-exec-am'.
../.././install-sh -c -d '/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/common-lisp/source/gpg-error'
/usr/bin/install -c -m 644 gpg-error.asd gpg-error-package.lisp gpg-error.lisp '/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/common-lisp/source/gpg-error'
../.././install-sh -c -d '/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/common-lisp/source/gpg-error'
/usr/bin/install -c -m 644 gpg-error-codes.lisp '/Users/xxx/Desktop/ChatSecure-iOS/27-08-2014/ChatSecure-iOS/Submodules/OTRKit/build/built/iPhoneSimulator7.1-i386.sdk/share/common-lisp/source/gpg-error'
Making clean in tests
rm -rf .libs _libs
rm -f t-version t-strerror t-syserror
rm -f *.o
rm -f *.lo
Making clean in src
rm -f gpg-error
test -z "err-sources.h err-codes.h code-to-errno.h code-from-errno.h gpg-error.h mkerrcodes mkerrcodes.h gpg-error.def mkw32errmap.tab.h mkw32errmap.map.c err-sources-sym.h err-codes-sym.h errnos-sym.h gpg-extra/errno.h extra-h.in _mkerrcodes.h _gpg-error.def.h mkw32errmap.tab.h mkw32errmap.map.c" || rm -f err-sources.h err-codes.h code-to-errno.h code-from-errno.h gpg-error.h mkerrcodes mkerrcodes.h gpg-error.def mkw32errmap.tab.h mkw32errmap.map.c err-sources-sym.h err-codes-sym.h errnos-sym.h gpg-extra/errno.h extra-h.in _mkerrcodes.h _gpg-error.def.h mkw32errmap.tab.h mkw32errmap.map.c
I have also post same issue in GitHub but didn't get any update. Hopefully expecting here. Thanks!
I am new in iOS development, Any help would be appreciated !
In order to use a library, the library has to be built with the same architecture as the code you're linking it into. In this case, it looks like those three libraries (libotr.a, libgcrypt.a, libgpg-error.a) were built in 32 bit, so you can't link them into a 64 bit build.
You need to get the x86_64 builds of those three libraries. This might involve rebuilding them yourself. Ideally, you would get/rebuild them in "universal" format, which means the library would contain both architectures, so you can link the same files into both 32bit and 64bit builds.
Notice that the OTRKit build script output says:
[Travis Detected] GPG verification disabled - Compiling for i386 only
i386 is the Intel 32bit architecture. The build script for OTR think's you're Travis, so you need to do export TRAVIS=0 before you build, in order to get the x86_64 arch built.
Someone has already submitted the bug here: https://github.com/ChatSecure/OTRKit/issues/15
I want to create a mime / multipart parser for IMAP messages. I got few links which says mimetic can do this, but I am unable to compile it for iOS. Any help would be greatly appreciated.
It's old post. But maybe it will help somebody
How I built mimetic in my project (shell-script).
# Building mimetic
pushd mimetic
# i368
export CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc"
export CXX="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-g++"
export AR="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/ar"
export CFLAGS="-pipe -miphoneos-version-min=4.0 -fpascal-strings -fmessage-length=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -arch i386 -O2 -fPIC -DDARWIN_NO_CARBON -Wall -W"
export CXXFLAGS="-pipe -miphoneos-version-min=4.0 -fpascal-strings -fmessage-length=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -arch i386 -O2 -fPIC -DDARWIN_NO_CARBON -Wall -W"
mkdir build_i386
pushd build_i386
../configure -prefix=`pwd`
make clean
pushd mimetic
make || exit 1
make install
popd
popd
# armv7
export CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc"
export CXX="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++"
export AR="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar"
export CFLAGS="-pipe -miphoneos-version-min=4.0 -fpascal-strings -fmessage-length=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -arch armv7 -mthumb -O2 -fPIC -Wall -W -DDARWIN_NO_CARBON -D__ARM_ARCH_7__ -D__MARM_THUMB__ -D__ARM_NEON__"
export CXXFLAGS="-pipe -miphoneos-version-min=4.0 -fpascal-strings -fmessage-length=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -arch armv7 -mthumb -O2 -fPIC -Wall -W -DDARWIN_NO_CARBON -D__ARM_ARCH_7__ -D__MARM_THUMB__ -D__ARM_NEON__"
mkdir build_armv7
pushd build_armv7
../configure --host=i386 --prefix=`pwd`
make clean
pushd mimetic
make || exit 1
make install
popd
popd
# bundle
lipo build_i386/lib/libmimetic.a build_armv7/lib/libmimetic.a -create -output libmimetic.a
popd
Please find an updated build script for mimetic C++ library for iOS.
#!/bin/bash
echo "$(tput setaf 2)"
echo "###################################################################"
echo "# Preparing to build libmimetic"
echo "###################################################################"
echo "$(tput sgr0)"
JOBS=$(sysctl -n hw.logicalcpu)
# The results will be stored relative to the location
# where you stored this script, **not** relative to
# the location of the protobuf git repo.
PREFIX=`pwd`/libmimetic
if [ -d ${PREFIX} ]
then
rm -rf "${PREFIX}"
fi
mkdir -p "${PREFIX}/platform"
# A "YES" value will build the latest code from GitHub on the master branch.
# A "NO" value will use the tarball downloaded from ...
USE_GIT_MASTER=NO
MIMETIC_GIT_DIRNAME=mimetic
MIMETIC_VERSION=0.9.8
MIMETIC_RELEASE_URL=http://www.codesink.org/download/mimetic-${MIMETIC_VERSION}.tar.gz
MIMETIC_RELEASE_DIRNAME=mimetic-${MIMETIC_VERSION}
LIBMIMETIC=libmimetic
BUILD_MACOSX_X86_64=YES
BUILD_I386_IOSSIM=YES
BUILD_X86_64_IOSSIM=YES
BUILD_IOS_ARMV7=YES
BUILD_IOS_ARMV7S=YES
BUILD_IOS_ARM64=YES
MIMETIC_SRC_DIR=/tmp/mimetic
DARWIN=darwin`uname -r`
XCODEDIR=`xcode-select --print-path`
IOS_SDK_VERSION=`xcrun --sdk iphoneos --show-sdk-version`
MIN_SDK_VERSION=6.0
MACOSX_PLATFORM=${XCODEDIR}/Platforms/MacOSX.platform
MACOSX_SYSROOT=${MACOSX_PLATFORM}/Developer/SDKs/MacOSX10.10.sdk
IPHONEOS_PLATFORM=`xcrun --sdk iphoneos --show-sdk-platform-path`
IPHONEOS_SYSROOT=`xcrun --sdk iphoneos --show-sdk-path`
IPHONESIMULATOR_PLATFORM=`xcrun --sdk iphonesimulator --show-sdk-platform-path`
IPHONESIMULATOR_SYSROOT=`xcrun --sdk iphonesimulator --show-sdk-path`
# Uncomment if you want to see more information about each invocation
# of clang as the builds proceed.
# CLANG_VERBOSE="--verbose"
CC="xcrun clang"
CXX="xcrun clang"
CFLAGS="${CLANG_VERBOSE} -DNDEBUG -g -O0 -pipe -fPIC -fcxx-exceptions"
CXXFLAGS="${CLANG_VERBOSE} ${CFLAGS} -std=c++11 -stdlib=libc++"
LDFLAGS="-stdlib=libc++"
LIBS="-lc++ -lc++abi"
echo "PREFIX ..................... ${PREFIX}"
echo "USE_GIT_MASTER ............. ${USE_GIT_MASTER}"
echo "MIMETIC_GIT_DIRNAME ....... ${MIMETIC_GIT_DIRNAME}"
echo "MIMETIC_VERSION ........... ${MIMETIC_VERSION}"
echo "MIMETIC_RELEASE_URL ....... ${MIMETIC_RELEASE_URL}"
echo "MIMETIC_RELEASE_DIRNAME ... ${MIMETIC_RELEASE_DIRNAME}"
echo "BUILD_MACOSX_X86_64 ........ ${BUILD_MACOSX_X86_64}"
echo "BUILD_I386_IOSSIM .......... ${BUILD_I386_IOSSIM}"
echo "BUILD_X86_64_IOSSIM ........ ${BUILD_X86_64_IOSSIM}"
echo "BUILD_IOS_ARMV7 ............ ${BUILD_IOS_ARMV7}"
echo "BUILD_IOS_ARMV7S ........... ${BUILD_IOS_ARMV7S}"
echo "BUILD_IOS_ARM64 ............ ${BUILD_IOS_ARM64}"
echo "MIMETIC_SRC_DIR ........... ${MIMETIC_SRC_DIR}"
echo "DARWIN ..................... ${DARWIN}"
echo "XCODEDIR ................... ${XCODEDIR}"
echo "IOS_SDK_VERSION ............ ${IOS_SDK_VERSION}"
echo "MIN_SDK_VERSION ............ ${MIN_SDK_VERSION}"
echo "MACOSX_PLATFORM ............ ${MACOSX_PLATFORM}"
echo "MACOSX_SYSROOT ............. ${MACOSX_SYSROOT}"
echo "IPHONEOS_PLATFORM .......... ${IPHONEOS_PLATFORM}"
echo "IPHONEOS_SYSROOT ........... ${IPHONEOS_SYSROOT}"
echo "IPHONESIMULATOR_PLATFORM ... ${IPHONESIMULATOR_PLATFORM}"
echo "IPHONESIMULATOR_SYSROOT .... ${IPHONESIMULATOR_SYSROOT}"
echo "CC ......................... ${CC}"
echo "CFLAGS ..................... ${CFLAGS}"
echo "CXX ........................ ${CXX}"
echo "CXXFLAGS ................... ${CXXFLAGS}"
echo "LDFLAGS .................... ${LDFLAGS}"
echo "LIBS ....................... ${LIBS}"
while true; do
read -p "Proceed with build? (y/n) " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
echo "$(tput setaf 2)"
echo "###################################################################"
echo "# Fetch Mimetic"
echo "###################################################################"
echo "$(tput sgr0)"
(
if [ -d ${MIMETIC_SRC_DIR} ]
then
rm -rf ${MIMETIC_SRC_DIR}
fi
cd `dirname ${MIMETIC_SRC_DIR}`
if [ -d ${MIMETIC_RELEASE_DIRNAME} ]
then
rm -rf "${MIMETIC_RELEASE_DIRNAME}"
fi
curl --location ${MIMETIC_RELEASE_URL} --output ${MIMETIC_RELEASE_DIRNAME}.tar.gz
tar xvf ${MIMETIC_RELEASE_DIRNAME}.tar.gz
mv "${MIMETIC_RELEASE_DIRNAME}" "${MIMETIC_SRC_DIR}"
rm ${MIMETIC_RELEASE_DIRNAME}.tar.gz
cd ${MIMETIC_SRC_DIR}
sed -i '' '/test\/Makefile/d' configure.in
sed -i '' '/test win32/ c\
SUBDIRS = mimetic
' /tmp/mimetic/Makefile.in
)
echo "$(tput setaf 2)"
echo "###################################################################"
echo "# x86_64 for Mac OS X"
echo "###################################################################"
echo "$(tput sgr0)"
if [ "${BUILD_MACOSX_X86_64}" == "YES" ]
then
(
cd ${MIMETIC_SRC_DIR}
make distclean
./configure --disable-shared --prefix=${PREFIX} --exec-prefix=${PREFIX}/platform/x86_64-mac "CC=${CC}" "CFLAGS=${CFLAGS} -arch x86_64" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -arch x86_64" "LDFLAGS=${LDFLAGS}" "LIBS=${LIBS}"
make -j${JOBS}
# make check
make install
)
fi
MIMETICC=${PREFIX}/platform/x86_64-mac/bin/mimetic
###################################################################
# This section contains the build commands for each of the
# architectures that will be included in the universal binaries.
###################################################################
echo "$(tput setaf 2)"
echo "###########################"
echo "# i386 for iPhone Simulator"
echo "###########################"
echo "$(tput sgr0)"
if [ "${BUILD_I386_IOSSIM}" == "YES" ]
then
(
cd ${MIMETIC_SRC_DIR}
make distclean
./configure --build=x86_64-apple-${DARWIN} --host=i386-apple-${DARWIN} --disable-shared --prefix=${PREFIX} --exec-prefix=${PREFIX}/platform/i386-sim "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch i386 -isysroot ${IPHONESIMULATOR_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -arch i386 -isysroot ${IPHONESIMULATOR_SYSROOT}" LDFLAGS="-arch i386 -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" "LIBS=${LIBS}"
make -j${JOBS}
make install
)
fi
echo "$(tput setaf 2)"
echo "#############################"
echo "# x86_64 for iPhone Simulator"
echo "#############################"
echo "$(tput sgr0)"
if [ "${BUILD_X86_64_IOSSIM}" == "YES" ]
then
(
cd ${MIMETIC_SRC_DIR}
make distclean
./configure --build=x86_64-apple-${DARWIN} --host=x86_64-apple-${DARWIN} --disable-shared --prefix=${PREFIX} --exec-prefix=${PREFIX}/platform/x86_64-sim "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch x86_64 -isysroot ${IPHONESIMULATOR_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -arch x86_64 -isysroot ${IPHONESIMULATOR_SYSROOT}" LDFLAGS="-arch x86_64 -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" "LIBS=${LIBS}"
make -j${JOBS}
make install
)
fi
echo "$(tput setaf 2)"
echo "##################"
echo "# armv7 for iPhone"
echo "##################"
echo "$(tput sgr0)"
if [ "${BUILD_IOS_ARMV7}" == "YES" ]
then
(
cd ${MIMETIC_SRC_DIR}
make distclean
./configure --build=x86_64-apple-${DARWIN} --host=armv7-apple-${DARWIN} --disable-shared --prefix=${PREFIX} --exec-prefix=${PREFIX}/platform/armv7-ios "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch armv7 -isysroot ${IPHONEOS_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -arch armv7 -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS="-arch armv7 -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" "LIBS=${LIBS}"
make -j${JOBS}
make install
)
fi
echo "$(tput setaf 2)"
echo "###################"
echo "# armv7s for iPhone"
echo "###################"
echo "$(tput sgr0)"
if [ "${BUILD_IOS_ARMV7S}" == "YES" ]
then
(
cd ${MIMETIC_SRC_DIR}
make distclean
./configure --build=x86_64-apple-${DARWIN} --host=armv7s-apple-${DARWIN} --disable-shared --prefix=${PREFIX} --exec-prefix=${PREFIX}/platform/armv7s-ios "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch armv7s -isysroot ${IPHONEOS_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -arch armv7s -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS="-arch armv7s -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" "LIBS=${LIBS}"
make -j${JOBS}
make install
)
fi
echo "$(tput setaf 2)"
echo "##################"
echo "# arm64 for iPhone"
echo "##################"
echo "$(tput sgr0)"
if [ "${BUILD_IOS_ARM64}" == "YES" ]
then
(
cd ${MIMETIC_SRC_DIR}
make distclean
./configure --build=x86_64-apple-${DARWIN} --host=arm --disable-shared --prefix=${PREFIX} --exec-prefix=${PREFIX}/platform/arm64-ios "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch arm64 -isysroot ${IPHONEOS_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -arch arm64 -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS="-arch arm64 -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" "LIBS=${LIBS}"
make -j${JOBS}
make install
)
fi
echo "$(tput setaf 2)"
echo "###################################################################"
echo "# Create Universal Libraries and Finalize the packaging"
echo "###################################################################"
echo "$(tput sgr0)"
(
cd ${PREFIX}/platform
mkdir universal
lipo x86_64-sim/lib/${LIBMIMETIC}.a i386-sim/lib/${LIBMIMETIC}.a arm64-ios/lib/${LIBMIMETIC}.a armv7s-ios/lib/${LIBMIMETIC}.a armv7-ios/lib/${LIBMIMETIC}.a -create -output universal/${LIBMIMETIC}.a
)
(
cd ${PREFIX}
mkdir bin
mkdir lib
cp -r platform/x86_64-mac/lib/* lib
cp -r platform/universal/* lib
rm -rf platform
lipo -info lib/${LIBMIMETIC}.a
)
if [ -d "${PREFIX}-${MIMETIC_VERSION}" ]
then
rm -rf "${PREFIX}-${MIMETIC_VERSION}"
fi
mv "${PREFIX}" "${PREFIX}-${MIMETIC_VERSION}"
echo Done!
Courtesy of ytain of #iphonedev in freenode irc.