Clang optimization levels - clang

For gcc, the manual explains what -O3, -Os, etc. translate to in terms of specific optimisation arguments (-funswitch-loops, -fcompare-elim, etc.)
I'm looking for the same info for clang.
I've looked online and in man clang which only gives general information (-O2 optimises more aggressively than -O1, -Os optimises for size, ...) and also looked here on Stack Overflow and found this, but I haven't found anything relevant in the cited source files.
Edit: I found an answer but I'm still interested if anyone has a link to a user-manual documenting all optimisation passes and the passes selected by -Ox. Currently I just found this list of passes, but nothing on optimisation levels.

I found this related question.
To sum it up, to find out about compiler optimization passes:
llvm-as < /dev/null | opt -O3 -disable-output -debug-pass=Arguments
As pointed out in Geoff Nixon's answer (+1), clang additionally runs some higher level optimizations, which we can retrieve with:
echo 'int;' | clang -xc -O3 - -o /dev/null -\#\#\#
Documentation of individual passes is available here.
You can compare the effect of changing high-level flags such as -O like this:
diff -wy --suppress-common-lines \
<(echo 'int;' | clang -xc - -o /dev/null -\#\#\# 2>&1 | tr " " "\n" | grep -v /tmp) \
<(echo 'int;' | clang -xc -O0 - -o /dev/null -\#\#\# 2>&1 | tr " " "\n" | grep -v /tmp)
# will tell you that -O0 is indeed the default.
With version 6.0 the passes are as follow:
baseline (-O0):
opt sets: -tti -verify -ee-instrument -targetlibinfo -assumption-cache-tracker -profile-summary-info -forceattrs -basiccg -always-inline -barrier
clang adds : -mdisable-fp-elim -mrelax-all
-O1 is based on -O0
opt adds: -targetlibinfo -tti -tbaa -scoped-noalias -assumption-cache-tracker -profile-summary-info -forceattrs -inferattrs -ipsccp -called-value-propagation -globalopt -domtree -mem2reg -deadargelim -basicaa -aa -loops -lazy-branch-prob -lazy-block-freq -opt-remark-emitter -instcombine -simplifycfg -basiccg -globals-aa -prune-eh -always-inline -functionattrs -sroa -memoryssa -early-cse-memssa -speculative-execution -lazy-value-info -jump-threading -correlated-propagation -libcalls-shrinkwrap -branch-prob -block-freq -pgo-memop-opt -tailcallelim -reassociate -loop-simplify -lcssa-verification -lcssa -scalar-evolution -loop-rotate -licm -loop-unswitch -indvars -loop-idiom -loop-deletion -loop-unroll -memdep -memcpyopt -sccp -demanded-bits -bdce -dse -postdomtree -adce -barrier -rpo-functionattrs -globaldce -float2int -loop-accesses -loop-distribute -loop-vectorize -loop-load-elim -alignment-from-assumptions -strip-dead-prototypes -loop-sink -instsimplify -div-rem-pairs -verify -ee-instrument -early-cse -lower-expect
clang adds : -momit-leaf-frame-pointer
clang drops : -mdisable-fp-elim -mrelax-all
-O2 is based on -O1
opt adds: -inline -mldst-motion -gvn -elim-avail-extern -slp-vectorizer -constmerge
opt drops: -always-inline
clang adds: -vectorize-loops -vectorize-slp
-O3 is based on -O2
opt adds: -callsite-splitting -argpromotion
-Ofast is based on -O3, valid in clang but not in opt
clang adds: -fno-signed-zeros -freciprocal-math -ffp-contract=fast -menable-unsafe-fp-math -menable-no-nans -menable-no-infs -mreassociate -fno-trapping-math -ffast-math -ffinite-math-only
-Os is similar to -O2
opt drops: -libcalls-shrinkwrap and -pgo-memopt-opt
-Oz is based on -Os
opt drops: -slp-vectorizer
With version 3.8 the passes are as follow:
baseline (-O0):
opt sets : -targetlibinfo -tti -verify
clang adds : -mdisable-fp-elim -mrelax-all
-O1 is based on -O0
opt adds: -globalopt -demanded-bits -branch-prob -inferattrs -ipsccp -dse -loop-simplify -scoped-noalias -barrier -adce -deadargelim -memdep -licm -globals-aa -rpo-functionattrs -basiccg -loop-idiom -forceattrs -mem2reg -simplifycfg -early-cse -instcombine -sccp -loop-unswitch -loop-vectorize -tailcallelim -functionattrs -loop-accesses -memcpyopt -loop-deletion -reassociate -strip-dead-prototypes -loops -basicaa -correlated-propagation -lcssa -domtree -always-inline -aa -block-freq -float2int -lower-expect -sroa -loop-unroll -alignment-from-assumptions -lazy-value-info -prune-eh -jump-threading -loop-rotate -indvars -bdce -scalar-evolution -tbaa -assumption-cache-tracker
clang adds : -momit-leaf-frame-pointer
clang drops : -mdisable-fp-elim -mrelax-all
-O2 is based on -O1
opt adds: -elim-avail-extern -mldst-motion -slp-vectorizer -gvn -inline -globaldce -constmerge
opt drops: -always-inline
clang adds: -vectorize-loops -vectorize-slp
-O3 is based on -O2
opt adds: -argpromotion
-Ofast is based on -O3, valid in clang but not in opt
clang adds: -fno-signed-zeros -freciprocal-math -ffp-contract=fast -menable-unsafe-fp-math -menable-no-nans -menable-no-infs
-Os is the same as -O2
-Oz is based on -Os
opt drops: -slp-vectorizer
clang drops: -vectorize-loops
----------
With version 3.7 the passes are as follow (parsed output of the command above):
default (-O0): -targetlibinfo -verify -tti
-O1 is based on -O0
adds: -sccp -loop-simplify -float2int -lazy-value-info -correlated-propagation -bdce -lcssa -deadargelim -loop-unroll -loop-vectorize -barrier -memcpyopt -loop-accesses -assumption-cache-tracker -reassociate -loop-deletion -branch-prob -jump-threading -domtree -dse -loop-rotate -ipsccp -instcombine -scoped-noalias -licm -prune-eh -loop-unswitch -alignment-from-assumptions -early-cse -inline-cost -simplifycfg -strip-dead-prototypes -tbaa -sroa -no-aa -adce -functionattrs -lower-expect -basiccg -loops -loop-idiom -tailcallelim -basicaa -indvars -globalopt -block-freq -scalar-evolution -memdep -always-inline
-O2 is based on -01
adds: -elim-avail-extern -globaldce -inline -constmerge -mldst-motion -gvn -slp-vectorizer
removes: -always-inline
-O3 is based on -O2
adds: -argpromotion -verif
-Os is identical to -O2
-Oz is based on -Os
removes: -slp-vectorizer
----------
For version 3.6 the passes are as documented in GYUNGMIN KIM's post.
----------
With version 3.5 the passes are as follow (parsed output of the command above):
default (-O0): -targetlibinfo -verify -verify-di
-O1 is based on -O0
adds: -correlated-propagation -basiccg -simplifycfg -no-aa -jump-threading -sroa -loop-unswitch -ipsccp -instcombine -memdep -memcpyopt -barrier -block-freq -loop-simplify -loop-vectorize -inline-cost -branch-prob -early-cse -lazy-value-info -loop-rotate -strip-dead-prototypes -loop-deletion -tbaa -prune-eh -indvars -loop-unroll -reassociate -loops -sccp -always-inline -basicaa -dse -globalopt -tailcallelim -functionattrs -deadargelim -notti -scalar-evolution -lower-expect -licm -loop-idiom -adce -domtree -lcssa
-O2 is based on -01
adds: -gvn -constmerge -globaldce -slp-vectorizer -mldst-motion -inline
removes: -always-inline
-O3 is based on -O2
adds: -argpromotion
-Os is identical to -O2
-Oz is based on -Os
removes: -slp-vectorizer
----------
With version 3.4 the passes are as follow (parsed output of the command above):
-O0: -targetlibinfo -preverify -domtree -verify
-O1 is based on -O0
adds: -adce -always-inline -basicaa -basiccg -correlated-propagation -deadargelim -dse -early-cse -functionattrs -globalopt -indvars -inline-cost -instcombine -ipsccp -jump-threading -lazy-value-info -lcssa -licm -loop-deletion -loop-idiom -loop-rotate -loop-simplify -loop-unroll -loop-unswitch -loops -lower-expect -memcpyopt -memdep -no-aa -notti -prune-eh -reassociate -scalar-evolution -sccp -simplifycfg -sroa -strip-dead-prototypes -tailcallelim -tbaa
-O2 is based on -01
adds: -barrier -constmerge -domtree -globaldce -gvn -inline -loop-vectorize -preverify -slp-vectorizer -targetlibinfo -verify
removes: -always-inline
-O3 is based on -O2
adds: -argpromotion
-Os is identical to -O2
-Oz is based on -O2
removes: -barrier -loop-vectorize -slp-vectorizer
----------
With version 3.2 the passes are as follow (parsed output of the command above):
-O0: -targetlibinfo -preverify -domtree -verify
-O1 is based on -O0
adds: -sroa -early-cse -lower-expect -no-aa -tbaa -basicaa -globalopt -ipsccp -deadargelim -instcombine -simplifycfg -basiccg -prune-eh -always-inline -functionattrs -simplify-libcalls -lazy-value-info -jump-threading -correlated-propagation -tailcallelim -reassociate -loops -loop-simplify -lcssa -loop-rotate -licm -loop-unswitch -scalar-evolution -indvars -loop-idiom -loop-deletion -loop-unroll -memdep -memcpyopt -sccp -dse -adce -strip-dead-prototypes
-O2 is based on -01
adds: -inline -globaldce -constmerge
removes: -always-inline
-O3 is based on -O2
adds: -argpromotion
-Os is identical to -O2
-Oz is identical to -Os
-------------
Edit [march 2014] removed duplicates from lists.
Edit [april 2014] added documentation link + options for 3.4
Edit [september 2014] added options for 3.5
Edit [december 2015] added options for 3.7 and mention existing answer for 3.6
Edit [may 2016] added options for 3.8, for both opt and clang and mention existing answer for clang (versus opt)
Edit [nov 2018] add options for 6.0

#Antoine's answer (and the other question linked) accurately describe the LLVM optimizations that are enabled, but there are a few other Clang-specific options (i.e., those that affect lowering to the AST) that affected by the -O[0|1|2|3|fast] flags.
You can take a look at these with:
echo 'int;' | clang -xc -O0 - -o /dev/null -\#\#\#
echo 'int;' | clang -xc -O1 - -o /dev/null -\#\#\#
echo 'int;' | clang -xc -O2 - -o /dev/null -\#\#\#
echo 'int;' | clang -xc -O3 - -o /dev/null -\#\#\#
echo 'int;' | clang -xc -Ofast - -o /dev/null -\#\#\#
For example, -O0 enables -mrelax-all, -O1 enables -vectorize-loops and -vectorize-slp, and -Ofast enables -menable-no-infs, -menable-no-nans, -menable-unsafe-fp-math, -ffp-contract=fast and -ffast-math.
#Techogrebo:
Yes, no don't necessarily need the other LLVM tools. Try:
echo 'int;' | clang -xc - -o /dev/null -mllvm -print-all-options
Also, there are a lot more detailed options you can examine/modify with Clang alone... you just need to know how to get to them!
Try a few of:
clang -help
clang -cc1 -help
clang -cc1 -mllvm -help
clang -cc1 -mllvm -help-list-hidden
clang -cc1as -help

Starting with clang / LLVM 13.0.0, the legacy pass manager has been deprecated and the new pass manager is used by default.
This means that the previous solution for printing the optimization passes used for the different optimization levels in opt will only work if the legacy pass manager is explicitly enabled with -enable-new-pm=0. So as long as the legacy pass manager is around (expected until LLVM 14), one can use the following command
llvm-as < /dev/null | opt -O3 -disable-output -debug-pass=Arguments -enable-new-pm=0
Alternatively, the execution order of the optimization passes with the new pass manager can be extracted with --debug-pass-manager (instead of -debug-pass=Arguments).
Unfortunately the output is very verbose and some processing needs to be done to reconstruct the behavior manually with -passes=.
If only transformation passes are of interest, one can use the option -debug-pass-manager=quiet to skip information about analyses.
There is a user guide on how to use the new pass manager with opt on the LLVM Website.

LLVM 3.6
-O1
Pass Arguments: -targetlibinfo -no-aa -tbaa -scoped-noalias -assumption-cache-tracker -basicaa -notti -verify-di -ipsccp -globalopt -deadargelim -domtree -instcombine -simplifycfg -basiccg -prune-eh -inline-cost -always-inline -functionattrs -sroa -domtree -early-cse -lazy-value-info -jump-threading -correlated-propagation -simplifycfg -domtree -instcombine -tailcallelim -simplifycfg -reassociate -domtree -loops -loop-simplify -lcssa -loop-rotate -licm -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -indvars -loop-idiom -loop-deletion -function_tti -loop-unroll -memdep -memcpyopt -sccp -domtree -instcombine -lazy-value-info -jump-threading -correlated-propagation -domtree -memdep -dse -adce -simplifycfg -domtree -instcombine -barrier -domtree -loops -loop-simplify -lcssa -branch-prob -block-freq -scalar-evolution -loop-vectorize -instcombine -simplifycfg -domtree -instcombine -loops -loop-simplify -lcssa -scalar-evolution -function_tti -loop-unroll -alignment-from-assumptions -strip-dead-prototypes -verify -verify-di
-O2 base on -O1
add : -inline -mldst-motion -domtree -memdep -gvn -memdep -scalar-evolution -slp-vectorizer -globaldce -constmerge
and removes: -always-inline
-O3 based on -O2
add: -argpromotion

Related

build failed when trying to instal OpenCV-iOS cocoapod

I an trying to install the OpenCV-iOS cocoapod. When I ran pod install it give me a big error message.
Error Message: (part of it)
Trying OpenCV-iOS
[!] /bin/bash -c
set -e
mkdir build-iphoneos
cd build-iphoneos
cmake -GXcode -DBUILD_SHARED_LIBS=ON -DCMAKE_MACOSX_BUNDLE=ON -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=NO -DAPPLE_FRAMEWORK=ON -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../platforms/ios/cmake/Toolchains/Toolchain-iPhoneOS_Xcode.cmake -DENABLE_NEON=ON ../
xcodebuild -arch armv7 -arch armv7s -arch arm64 -sdk iphoneos -configuration Release -parallelizeTargets -jobs 4 ONLY_ACTIVE_ARCH=NO -target ALL_BUILD build OTHER_CFLAGS="$(inherited) -Wno-implicit-function-declaration"
cmake -DCMAKE_INSTALL_PREFIX=install -P cmake_install.cmake
mkdir ../build-iphonesimulator
cd ../build-iphonesimulator
cmake -GXcode -DBUILD_SHARED_LIBS=ON -DCMAKE_MACOSX_BUNDLE=ON -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=NO -DAPPLE_FRAMEWORK=ON -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../platforms/ios/cmake/Toolchains/Toolchain-iPhoneSimulator_Xcode.cmake ../
xcodebuild -arch x86_64 -arch i386 -sdk iphonesimulator -configuration Release -parallelizeTargets -jobs 4 ONLY_ACTIVE_ARCH=NO -target ALL_BUILD build OTHER_CFLAGS="$(inherited) -Wno-implicit-function-declaration"
mv ../build-iphoneos/install/ ../
cd ../install
lipo -create lib/libopencv_world.dylib ../build-iphonesimulator/lib/Release/libopencv_world.dylib -output lib/libopencv2.dylib
install_name_tool -id #rpath/libopencv2.dylib lib/libopencv2.dylib
-- Setting up iPhoneOS toolchain
-- iPhoneOS toolchain loaded
-- Setting up iPhoneOS toolchain
-- iPhoneOS toolchain loaded
-- The CXX compiler identification is AppleClang 9.0.0.9000039
-- The C compiler identification is AppleClang 9.0.0.9000039
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Detecting CXX compile features
-- Detecting CXX compile features - failed
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Detecting C compile features
-- Detecting C compile features - failed
-- Performing Test HAVE_CXX_FSIGNED_CHAR
-- Performing Test HAVE_CXX_FSIGNED_CHAR - Failed
-- Performing Test HAVE_C_FSIGNED_CHAR
...
-- Performing Test HAVE_CXX_FVISIBILITY_INLINES_HIDDEN - Failed
-- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN
-- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN - Failed
-- FP16: Compiler support is not available
-- Looking for fseeko
-- Looking for fseeko - not found
-- Looking for unistd.h
-- Looking for unistd.h - not found
-- Looking for sys/types.h
-- Looking for sys/types.h - not found
-- Looking for stdint.h
-- Looking for stdint.h - not found
-- Looking for stddef.h
-- Looking for stddef.h - not found
-- Check size of off64_t
-- Check size of off64_t - failed
-- Performing Test HAVE_C_WNO_SHORTEN_64_TO_32
-- Performing Test HAVE_C_WNO_SHORTEN_64_TO_32 - Failed
-- Performing Test HAVE_C_WNO_ATTRIBUTES
-- Performing Test HAVE_C_WNO_ATTRIBUTES - Failed
-- Performing Test HAVE_C_WNO_STRICT_PROTOTYPES
-- Performing Test HAVE_C_WNO_STRICT_PROTOTYPES - Failed
-- Performing Test HAVE_C_WNO_MISSING_PROTOTYPES
...
--
-- General configuration for OpenCV 3.1.0-dev =====================================
-- Version control: unknown
--
-- Platform:
-- Timestamp: 2018-01-17T00:03:59Z
-- Host: Darwin 17.3.0 x86_64
-- Target: iOS
-- CMake: 3.10.1
-- CMake generator: Xcode
-- CMake build tool: /usr/bin/xcodebuild
-- Xcode: 9.2
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ (ver 9.0.0.9000039)
-- C++ flags (Release): -stdlib=libc++ -fvisibility=hidden -fvisibility-inlines-hidden -Wno-unused-function -Wno-overloaded-virtual -DNDEBUG -O3 -fomit-frame-pointer -ffast-math -DNDEBUG
-- C++ flags (Debug): -stdlib=libc++ -fvisibility=hidden -fvisibility-inlines-hidden -Wno-unused-function -Wno-overloaded-virtual -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- C flags (Release): -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release):
-- Linker flags (Debug):
-- Precompiled headers: NO
-- Extra dependencies: -framework Accelerate -framework AVFoundation -framework CoreGraphics -framework CoreImage -framework CoreMedia -framework CoreVideo -framework QuartzCore -framework AssetsLibrary -framework UIKit
-- 3rdparty dependencies: libjpeg libpng zlib
--
-- OpenCV modules:
-- To be built: core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect features2d calib3d stitching videostab world
-- Disabled: -
-- Disabled by dependency: -
-- Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 superres ts viz
--
-- GUI:
-- Cocoa: YES
-- OpenGL support: NO
-- VTK support: NO
--
-- Media I/O:
-- ZLib: build (ver 1.2.8)
-- JPEG: build (ver 90)
-- WEBP: NO
-- PNG: build (ver 1.6.19)
-- TIFF: NO
-- JPEG 2000: NO
-- OpenEXR: NO
-- GDAL: NO
-- GDCM: NO
--
-- Video I/O:
-- AVFoundation: YES
-- GStreamer: NO
-- QuickTime: NO
-- QTKit: NO
-- V4L/V4L2: NO/NO
-- XIMEA: NO
-- gPhoto2: NO
--
-- Parallel framework: GCD
--
-- Other third-party libraries:
-- Use IPP: NO
-- Use VA: NO
-- Use Intel VA-API/OpenCL: NO
-- Use Lapack: NO
-- Use Eigen: NO
-- Use Cuda: NO
-- Use OpenCL: NO
-- Use custom HAL: NO
--
-- Python 2:
-- Interpreter: NO
--
-- Python 3:
-- Interpreter: NO
--
-- Python (for build): NO
--
-- Java:
-- ant: NO
-- JNI: NO
-- Java wrappers: NO
-- Java tests: NO
--
-- Matlab: NO
--
-- Documentation:
-- Doxygen: NO
-- PlantUML: NO
--
-- Tests and samples:
-- Tests: NO
-- Performance tests: NO
-- C/C++ Examples: NO
--
-- Install path: /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/install
--
-- cvconfig.h is in: /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos
User defaults from command line:
IDEBuildOperationMaxNumberOfConcurrentCompileTasks = 4
Build settings from command line:
ARCHS = armv7 armv7s arm64
ONLY_ACTIVE_ARCH = NO
OTHER_CFLAGS = -Wno-implicit-function-declaration
SDKROOT = iphoneos11.2
Build Preparation
Build task concurrency set to 4 via user default IDEBuildOperationMaxNumberOfConcurrentCompileTasks
=== BUILD AGGREGATE TARGET ZERO_CHECK OF PROJECT OpenCV WITH CONFIGURATION Release ===
Check dependencies
warning: iOS 11.2.0 does not support armv7
warning: iOS 11.2.0 does not support armv7s
Write auxiliary files
write-file /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/OpenCV.build/Release-iphoneos/ZERO_CHECK.build/Script-7DAC25DC952F47CE8C67268C.sh
chmod 0755 /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/OpenCV.build/Release-iphoneos/ZERO_CHECK.build/Script-7DAC25DC952F47CE8C67268C.sh
PhaseScriptExecution CMake\ Rules /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/OpenCV.build/Release-iphoneos/ZERO_CHECK.build/Script-7DAC25DC952F47CE8C67268C.sh
cd /var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS
/bin/sh -c /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/OpenCV.build/Release-iphoneos/ZERO_CHECK.build/Script-7DAC25DC952F47CE8C67268C.sh
echo ""
make -f /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/CMakeScripts/ReRunCMake.make
make[1]: `/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/CMakeFiles/cmake.check_cache' is up to date.
=== BUILD TARGET zlib OF PROJECT OpenCV WITH CONFIGURATION Release ===
Check dependencies
warning: iOS 11.2.0 does not support armv7
warning: iOS 11.2.0 does not support armv7s
Write auxiliary files
/bin/mkdir -p /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/arm64
write-file /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/arm64/zlib.LinkFileList
/bin/mkdir -p /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7
write-file /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7/zlib.LinkFileList
/bin/mkdir -p /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7s
write-file /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7s/zlib.LinkFileList
CompileC /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7/adler32.o 3rdparty/zlib/adler32.c normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler
cd /var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O3 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -DCMAKE_INTDIR=\"Release-iphoneos\" -DNO_FSEEKO -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk -fstrict-aliasing -Wdeprecated-declarations -miphoneos-version-min=11.2 -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -fembed-bitcode-marker -I/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/lib/Release/include -I/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib -I/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/3rdparty/zlib -I/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos -I/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/DerivedSources/armv7 -I/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/lib/Release -Wno-implicit-function-declaration -MMD -MT dependencies -MF /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7/adler32.d --serialize-diagnostics /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7/adler32.dia -c /var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/3rdparty/zlib/adler32.c -o /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7/adler32.o
clang: error: invalid iOS deployment version '-miphoneos-version-min=11.2', iOS 10 is the maximum deployment target for 32-bit targets [-Winvalid-ios-deployment-target]
CompileC /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7/compress.o 3rdparty/zlib/compress.c normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler
cd /var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O3 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -DCMAKE_INTDIR=\"Release-iphoneos\" -DNO_FSEEKO -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk -fstrict-aliasing -Wdeprecated-declarations -miphoneos-version-min=11.2 -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -fembed-bitcode-marker -I/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/lib/Release/include -I/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib -I/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/3rdparty/zlib -I/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos -I/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/DerivedSources/armv7 -I/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/lib/Release -Wno-implicit-function-declaration -MMD -MT dependencies -MF /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7/compress.d --serialize-diagnostics /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7/compress.dia -c /var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/3rdparty/zlib/compress.c -o /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7/compress.o
clang: error: invalid iOS deployment version '-miphoneos-version-min=11.2', iOS 10 is the maximum deployment target for 32-bit targets [-Winvalid-ios-deployment-target]
CompileC /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7/crc32.o 3rdparty/zlib/crc32.c normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler
cd /var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -Wno-trigraphs -fpascal-strings -O3 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -DCMAKE_INTDIR=\"Release-iphoneos\" -DNO_FSEEKO -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk -fstrict-aliasing -Wdeprecated-declarations -miphoneos-version-min=11.2 -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -fembed-bitcode-marker -I/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/lib/Release/include -I/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib -I/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/3rdparty/zlib -I/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos -I/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/DerivedSources/armv7 -I/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/lib/Release -Wno-implicit-function-declaration -MMD -MT dependencies -MF /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7/crc32.d --serialize-diagnostics /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7/crc32.dia -c /var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/3rdparty/zlib/crc32.c -o /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7/crc32.o
clang: error: invalid iOS deployment version '-miphoneos-version-min=11.2', iOS 10 is the maximum deployment target for 32-bit targets [-Winvalid-ios-deployment-target]
CompileC /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7/deflate.o 3rdparty/zlib/deflate.c normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler
cd /var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
...
=== BUILD TARGET libjpeg OF PROJECT OpenCV WITH CONFIGURATION Release ===
Check dependencies
warning: iOS 11.2.0 does not support armv7
warning: iOS 11.2.0 does not support armv7s
Write auxiliary files
/bin/mkdir -p /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/libjpeg/OpenCV.build/Release-iphoneos/libjpeg.build/Objects-normal/armv7
write-file /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/libjpeg/OpenCV.build/Release-iphoneos/libjpeg.build/Objects-normal/armv7/libjpeg.LinkFileList
/bin/mkdir -p /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/libjpeg/OpenCV.build/Release-iphoneos/libjpeg.build/Objects-normal/armv7s
write-file /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/libjpeg/OpenCV.build/Release-iphoneos/libjpeg.build/Objects-normal/armv7s/libjpeg.LinkFileList
/bin/mkdir -p /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/libjpeg/OpenCV.build/Release-iphoneos/libjpeg.build/Objects-normal/arm64
write-file /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/libjpeg/OpenCV.build/Release-iphoneos/libjpeg.build/Objects-normal/arm64/libjpeg.LinkFileList
CMake Deprecation Warning at CMakeLists.txt:72 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at CMakeLists.txt:76 (cmake_policy):
The OLD behavior for policy CMP0022 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at CMakeLists.txt:81 (cmake_policy):
The OLD behavior for policy CMP0026 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
/bin/bash: line 5: inherited: command not found
** BUILD FAILED **
The following build commands failed:
CompileC /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7/adler32.o 3rdparty/zlib/adler32.c normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7/compress.o 3rdparty/zlib/compress.c normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7/crc32.o 3rdparty/zlib/crc32.c normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /private/var/folders/lb/2_dfvxbj1bz6jl33bdhktfy40000gq/T/CocoaPods/Try/OpenCV-iOS/build-iphoneos/3rdparty/zlib/OpenCV.build/Release-iphoneos/zlib.build/Objects-normal/armv7/deflate.o 3rdparty/zlib/deflate.c normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler
(4 failures)
I have installed make using the CMake installer and then install the command line tools by pasting this in terminal sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install. I have also run the Xcode-select --install command. I am staring to believe that the there is something wrong with how I installed cmake. I tried reinstalling using homebrew which did not work.
Is there anything I need to do after running the install command?
Could there be another problem?

Why clang produced "argument unused" warning for -nostdinc++ for executables, but not for libraries

I'm needing to use custom libc++ so I'm passing -nostdinc++ for CMAKE_CXX_FLAGS. This works fine for libraries but for executables, I get this warning:
clang: warning: argument unused during compilation: '-nostdinc++' [-Wunused-command-line-argument]
Question: Why?
More details
My CMAKE_CXX_FLAGS flags passed to compiler are:
set(CMAKE_CXX_FLAGS "-nostdinc++ -isystem ${LIBCXX_INC_PATH}")
My CMAKE_EXE_LINKER_FLAGS flags passed to linked are:
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++ -lc++abi -lm -lc -lgcc_s -lgcc -ldl -Wl,-rpath,${LIBCXX_LIB_PATH}")
Clang verbos output:
Scanning dependencies of target DroneServer
[ 98%] Building CXX object DroneServer/CMakeFiles/DroneServer.dir/home/shitals/GitHubSrc/AirSim/DroneServer/main.cpp.o
clang version 3.9.1-4ubuntu3~16.04.1 (tags/RELEASE_391/rc2)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.0.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;#m64
Selected multilib: .;#m64
"/usr/lib/llvm-3.9/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -v -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -coverage-file /home/shitals/GitHubSrc/AirSim/build_debug/DroneServer/CMakeFiles/DroneServer.dir/home/shitals/GitHubSrc/AirSim/DroneServer/main.cpp.o -nostdinc++ -resource-dir /usr/lib/llvm-3.9/bin/../lib/clang/3.9.1 -isystem /home/shitals/GitHubSrc/AirSim/llvm-build/output/include/c++/v1 -I /home/shitals/GitHubSrc/AirSim/eigen/eigen3 -I /home/shitals/GitHubSrc/AirSim/DroneServer -I /home/shitals/GitHubSrc/AirSim/MavLinkCom/include -I /home/shitals/GitHubSrc/AirSim/external/rpclib/include -I /home/shitals/GitHubSrc/AirSim/AirLib/include -D __CLANG__ -D MSGPACK_PP_VARIADICS_MSVC=0 -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-3.9/bin/../lib/clang/3.9.1/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wall -Wextra -Wstrict-aliasing -Wunreachable-code -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-include-dirs -Wswitch-default -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-variadic-macros -Wno-parentheses -Wno-unused-function -Wno-unused -Wno-documentation -std=c++14 -fdeprecated-macro -fdebug-compilation-dir /home/shitals/GitHubSrc/AirSim/build_debug/DroneServer -ferror-limit 10 -fmessage-length 286 -pthread -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o CMakeFiles/DroneServer.dir/home/shitals/GitHubSrc/AirSim/DroneServer/main.cpp.o -x c++ /home/shitals/GitHubSrc/AirSim/DroneServer/main.cpp
clang -cc1 version 3.9.1 based upon LLVM 3.9.1 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/home/shitals/GitHubSrc/AirSim/eigen/eigen3
/home/shitals/GitHubSrc/AirSim/DroneServer
/home/shitals/GitHubSrc/AirSim/MavLinkCom/include
/home/shitals/GitHubSrc/AirSim/external/rpclib/include
/home/shitals/GitHubSrc/AirSim/AirLib/include
/home/shitals/GitHubSrc/AirSim/llvm-build/output/include/c++/v1
/usr/local/include
/usr/lib/llvm-3.9/bin/../lib/clang/3.9.1/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
[100%] Linking CXX executable ../output/bin/DroneServer
clang version 3.9.1-4ubuntu3~16.04.1 (tags/RELEASE_391/rc2)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.0.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;#m64
Selected multilib: .;#m64
clang: warning: argument unused during compilation: '-nostdinc++' [-Wunused-command-line-argument]
"/usr/bin/ld" -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o ../output/bin/DroneServer /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crt1.o /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crti.o /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/crtbegin.o -L/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../.. -L/usr/lib/llvm-3.9/bin/../lib -L/lib -L/usr/lib -lc++ -lc++abi -lm -lc -lgcc_s -lgcc -ldl -rpath /home/shitals/GitHubSrc/AirSim/llvm-build/output/lib CMakeFiles/DroneServer.dir/home/shitals/GitHubSrc/AirSim/DroneServer/main.cpp.o -lpthread ../output/lib/libAirLib.a ../output/lib/libMavLinkCom.a ../output/lib/libAirSim-rpclib.a -lpthread -lpthread -lc++ -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/crtend.o /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../x86_64-linux-gnu/crtn.o
[100%] Built target DroneServer

No such file or directory #include "opencv2/face.hpp" while compiling facerec_fisherfaces with c++ in ubuntu?

I'm new to Opencv version 3.1.0 and trying to compile the code of facerec_fisherfaces.cpp http://docs.opencv.org/3.0-last-rst/_downloads/facerec_fisherfaces.cpp
using this compile.sh file
LIBS="-lopencv_imgproc -lopencv_highgui -lopencv_core -lopencv_objdetect -lopencv_contrib"
g++ -I/usr/local/include/opencv -I/usr/local/include/opencv2 -L/usr/lib -L/usr/local/lib -fpic -Wall -c "untitled.cpp" $LIBS
g++ -shared -I/usr/local/include/opencv -I/usr/local/include/opencv2 -o libuntitled.so untitled.o -L/usr/local/lib $LIBS
g++ -I/usr/local/include/opencv -I/usr/local/include/opencv2 -o untitled untitled.o -L/usr/local/lib $LIBS
exit 0
the error in the terminal is :
No such file or directory
#include "opencv2/face.hpp"
A proper answer to my question :)
you need to download so extra modules from :
https://github.com/Itseez/opencv_contrib

clang -S -emit-llvm and then compile

I want to get exe with clang and llvm with two ways:
clang -O2 1.c -o 1.exe
clang -S -emit-llvm 1.c
llc 1.ll -filetype=obj
link 1.obj -defaultlib: ??? (MSVCRT or libcmt)
but exe files will different and first exe will faster, how to do it equal?
Or how to see what clang use like defaultlib?
hard: windows 64.
You can add the -v flag on your first command line to see the linker invocation clang will use to build your program. As to the first executable being faster, that could be because you didn't pass any optimization flags in your second case.
I don't have a Windows machine handy, but here's some example output from my mac:
$ clang -v -O2 1.c -o 1.exe
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -disable-free -disable-llvm-verifier -main-file-name 1.c -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 236.3 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1 -O2 -fdebug-compilation-dir /Users/carl/Desktop/example -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o /var/folders/mk/0mblc5810cjgs0nylrkjxqbm0000gq/T/1-7ac5d9.o -x c 1.c
clang -cc1 version 5.1 based upon LLVM 3.4svn default target x86_64-apple-darwin13.3.0
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.9.0 -o 1.exe /var/folders/mk/0mblc5810cjgs0nylrkjxqbm0000gq/T/1-7ac5d9.o -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/lib/darwin/libclang_rt.osx.a
You can see the link line down at the bottom. Broken down for readability, its:
ld
-demangle
-dynamic
-arch x86_64
-macosx_version_min 10.9.0
-o 1.exe
$(OBJECT_FILE)
-lSystem
libclang_rt.osx.a

How to find if llvm-* commands are being used in clang

I have both clang and gcc installed on my Debian system. I wanted to try clang and gave
the following command. From the output it seems like clang is using lot more of gcc than
just the front end. How do I confirm that clang is actually using llvm-as, llvm-ld and
other llvm commands while compiling this simple program? I have installed most of llvm-*
commands. Thanks for any information.
clang -v c.c
Debian clang version 3.0-6 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
"/usr/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name c.c -mrelocation-model static -mdisable-fp-elim
-masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-
version 2.22 -momit-leaf-frame-pointer -v -resource-dir /usr/bin/../lib/clang/3.0
-fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem /usr/local/include
-internal-isystem /usr/bin/../lib/clang/3.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /usr/include -ferror-limit 19
-fmessage-length 198 -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak
-fobjc-fragile-abi -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/c-MLrq5I.o -x
c c.c
clang -cc1 version 3.0 based upon llvm 3.0 hosted on x86_64-pc-linux-gnu
ignoring nonexistent directory "/usr/bin/../lib/clang/3.0/include"
ignoring nonexistent directory "/usr/bin/../lib/clang/3.0/include"
ignoring duplicate directory "/usr/local/include"
ignoring duplicate directory "/usr/include/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include/x86_64-linux-gnu"
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include
/usr/include/clang/3.0/include/
/usr/lib/gcc/x86_64-linux-gnu/4.6/include/
/usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed/
End of search list.
"/usr/bin/ld" --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2
-o a.out /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o /usr/lib
/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-
gnu/4.6/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.6 -L/usr/lib/gcc/x86_64-linux-
gnu/4.6/../../../x86_64-linux-gnu -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr
/lib/x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../.. -L/lib/x86_64-linux-gnu -L/lib -L/usr
/lib/x86_64-linux-gnu -L/usr/lib /tmp/c-MLrq5I.o -lgcc --as-needed -lgcc_s --no-as-
needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/4.6
/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crtn.o
You can pass -### to clang to see all programs it invokes. On most systems, clang links to the assembler library directly and calls it in-process in the cc1 process instead of shelling out to an external as program.

Resources