When I try building cpprestsdk with a cross compiler gcc I've the following issue:
cd /home/ubuntu/projects/cpprestsdk/Release/build_qamf-dev/src && /opt/qamf-dev/x86_64-qamf/bin/x86_64-qamf-linux-gnu-g++ -DCPPREST_EXCLUDE_BROTLI=1 -DCPPREST_FORCE_HTTP_CLIENT_ASIO -DCPPREST_FORCE_HTTP_LISTENER_ASIO -DCPPREST_NO_SSL_LEAK_SUPPRESS -Dcpprest_EXPORTS -I/home/ubuntu/projects/cpprestsdk/Release/include -I/home/ubuntu/projects/cpprestsdk/Release/src/pch -I/home/ubuntu/projects/cpprestsdk/Release/libs/websocketpp -isystem /opt/qamf-dev/x86_64-qamf/x86_64-qamf-linux-gnu/sysroot/usr/include -std=c++11 -fno-strict-aliasing -O3 -DNDEBUG -fPIC -Werror -pedantic -Wall -Wextra -Wunused-parameter -Wcast-align -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls -Wunreachable-code -o CMakeFiles/cpprest.dir/http/oauth/oauth2.cpp.o -c /home/ubuntu/projects/cpprestsdk/Release/src/http/oauth/oauth2.cpp
cd /home/ubuntu/projects/cpprestsdk/Release/build_qamf-dev/src && /opt/qamf-dev/x86_64-qamf/bin/x86_64-qamf-linux-gnu-g++ -DCPPREST_EXCLUDE_BROTLI=1 -DCPPREST_FORCE_HTTP_CLIENT_ASIO -DCPPREST_FORCE_HTTP_LISTENER_ASIO -DCPPREST_NO_SSL_LEAK_SUPPRESS -Dcpprest_EXPORTS -I/home/ubuntu/projects/cpprestsdk/Release/include -I/home/ubuntu/projects/cpprestsdk/Release/src/pch -I/home/ubuntu/projects/cpprestsdk/Release/libs/websocketpp -isystem /opt/qamf-dev/x86_64-qamf/x86_64-qamf-linux-gnu/sysroot/usr/include -std=c++11 -fno-strict-aliasing -O3 -DNDEBUG -fPIC -Werror -pedantic -Wall -Wextra -Wunused-parameter -Wcast-align -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls -Wunreachable-code -o CMakeFiles/cpprest.dir/json/json.cpp.o -c /home/ubuntu/projects/cpprestsdk/Release/src/json/json.cpp
[ 7%] Building CXX object src/CMakeFiles/cpprest.dir/http/oauth/oauth1.cpp.o
cd /home/ubuntu/projects/cpprestsdk/Release/build_qamf-dev/src && /opt/qamf-dev/x86_64-qamf/bin/x86_64-qamf-linux-gnu-g++ -DCPPREST_EXCLUDE_BROTLI=1 -DCPPREST_FORCE_HTTP_CLIENT_ASIO -DCPPREST_FORCE_HTTP_LISTENER_ASIO -DCPPREST_NO_SSL_LEAK_SUPPRESS -Dcpprest_EXPORTS -I/home/ubuntu/projects/cpprestsdk/Release/include -I/home/ubuntu/projects/cpprestsdk/Release/src/pch -I/home/ubuntu/projects/cpprestsdk/Release/libs/websocketpp -isystem /opt/qamf-dev/x86_64-qamf/x86_64-qamf-linux-gnu/sysroot/usr/include -std=c++11 -fno-strict-aliasing -O3 -DNDEBUG -fPIC -Werror -pedantic -Wall -Wextra -Wunused-parameter -Wcast-align -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls -Wunreachable-code -o CMakeFiles/cpprest.dir/http/oauth/oauth1.cpp.o -c /home/ubuntu/projects/cpprestsdk/Release/src/http/oauth/oauth1.cpp
[ 10%] Building CXX object src/CMakeFiles/cpprest.dir/uri/uri_builder.cpp.o
[ 7%] Building CXX object src/CMakeFiles/cpprest.dir/json/json_serialization.cpp.o
[ 8%] Building CXX object src/CMakeFiles/cpprest.dir/uri/uri.cpp.o
In file included from /opt/qamf-dev/x86_64-qamf/x86_64-qamf-linux-gnu/include/c++/8.2.0/ext/string_conversions.h:41,
from /opt/qamf-dev/x86_64-qamf/x86_64-qamf-linux-gnu/include/c++/8.2.0/bits/basic_string.h:6391,
from /opt/qamf-dev/x86_64-qamf/x86_64-qamf-linux-gnu/include/c++/8.2.0/string:52,
from /home/ubuntu/projects/cpprestsdk/Release/src/pch/stdafx.h:55,
from /home/ubuntu/projects/cpprestsdk/Release/src/http/client/http_client_msg.cpp:13:
/opt/qamf-dev/x86_64-qamf/x86_64-qamf-linux-gnu/include/c++/8.2.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
#include_next <stdlib.h>
^~~~~~~~~~
In file included from /opt/qamf-dev/x86_64-qamf/x86_64-qamf-linux-gnu/include/c++/8.2.0/ext/string_conversions.h:41,
from /opt/qamf-dev/x86_64-qamf/x86_64-qamf-linux-gnu/include/c++/8.2.0/bits/basic_string.h:6391,
from /opt/qamf-dev/x86_64-qamf/x86_64-qamf-linux-gnu/include/c++/8.2.0/string:52,
from /home/ubuntu/projects/cpprestsdk/Release/src/pch/stdafx.h:55,
from /home/ubuntu/projects/cpprestsdk/Release/src/http/client/http_client.cpp:16:
/opt/qamf-dev/x86_64-qamf/x86_64-qamf-linux-gnu/include/c++/8.2.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
#include_next <stdlib.h>
^~~~~~~~~~
compilation terminated.
In file included from /opt/qamf-dev/x86_64-qamf/x86_64-qamf-linux-gnu/include/c++/8.2.0/ext/string_conversions.h:41,
from /opt/qamf-dev/x86_64-qamf/x86_64-qamf-linux-gnu/include/c++/8.2.0/bits/basic_string.h:6391,
from /opt/qamf-dev/x86_64-qamf/x86_64-qamf-linux-gnu/include/c++/8.2.0/string:52,
from /home/ubuntu/projects/cpprestsdk/Release/src/pch/stdafx.h:55,
from /home/ubuntu/projects/cpprestsdk/Release/src/http/common/http_compression.cpp:14:
/opt/qamf-dev/x86_64-qamf/x86_64-qamf-linux-gnu/include/c++/8.2.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
#include_next <stdlib.h>
^~~~~~~~~~
compilation terminated.
If I replace -isystem with a simple -I everything works well...
I know the gcc is working well cos I already built zlib openssl opencv and boost 1.69.
EDIT
To avoid the problem I edited the Makefile generated by cmake and removed -isystem from cxx flags
Related
i am trying to compile this git https://github.com/yapb/yapb locally
i am using ubuntu 64bit, and it says i must compile 32bit
i am using now
CC=clang CXX=clang meson build-clang
but get this error
FAILED: yapb.so.p/src_chatlib.cpp.o
clang -Iyapb.so.p -I. -I.. -fvisibility=hidden -flto
-fcolor-diagnostics -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall
-Winvalid-pch -Wnon-virtual-dtor -Wextra -Wpedantic -Werror -std=c++14
-fno-exceptions -O3 -DVERSION_GENERATED -fno-threadsafe-statics
-fno-exceptions -fno-rtti -m32 -pedantic -fdata-sections
-ffunction-sections -mtune=generic -fno-builtin -funroll-loops
-fomit-frame-pointer -fno-stack-protector -fvisibility=hidden
-fvisibility-inlines-hidden -msse2 -mfpmath=sse -fPIC
-isystem../ext/crlib -isystem../ext -isystem../inc -isystem..
-isystem. -MD -MQ yapb.so.p/src_chatlib.cpp.o -MF
yapb.so.p/src_chatlib.cpp.o.d -o yapb.so.p/src_chatlib.cpp.o -c
../src/chatlib.cpp
In file included from ../src/chatlib.cpp:8:
In file included from ../inc/yapb.h:10:
In file included from ../ext/hlsdk/extdll.h:28:
In file included from ../ext/crlib/crlib/string.h:17:
../ext/crlib/crlib/array.h:15:10: fatal error: 'initializer_list' file not found
#include <initializer_list>```
Double-check the pre-requisites mentioned in YaPB Building the Bot page.
Try and open a regular CMD (instead of Powershell), making sure it inherits all your previous setups (meaning its %PATH% does reference g++.exe, pip.exe, and so on.
I have a simple setup where CMake produces the following compile command:
cd /workspaces/cmake-general/tests/project/build/examples/hello-world && /usr/local/bin/cmake -E __run_co_compile
--iwyu=/usr/local/bin/include-what-you-use
--tidy="/usr/bin/clang-tidy;-extra-arg=-Wno-unknown-warning-option;-warnings-as-errors=*;--extra-arg-before=--driver-mode=g++"
--source=/workspaces/cmake-general/tests/project/build/examples/hello-world/CMakeFiles/example-hello-world.dir/cmake_pch.hxx.cxx --
/usr/bin/c++
-I/workspaces/cmake-general/tests/project/examples/hello-world/src
-I/workspaces/cmake-general/tests/project/build -O3 -DNDEBUG -stdlib=libc++
-fcolor-diagnostics -Wall -Wextra -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion
-Wsign-conversion -Wnull-dereference -Wdouble-promotion
-Wformat=2 -Werror -std=c++20 -Winvalid-pch -fpch-instantiate-templates
-Xclang -emit-pch -Xclang -include
-Xclang /workspaces/cmake-general/tests/project/build/examples/hello-world/CMakeFiles/example-hello-world.dir/cmake_pch.hxx
-x c++-header -MD -MT examples/hello-world/CMakeFiles/example-hello-world.dir/cmake_pch.hxx.pch -MF
CMakeFiles/example-hello-world.dir/cmake_pch.hxx.pch.d -o CMakeFiles/example-hello-world.dir/cmake_pch.hxx.pch
-c /workspaces/cmake-general/tests/project/build/examples/hello-world/CMakeFiles/example-hello-world.dir/cmake_pch.hxx.cxx
which errors our with not finding
/workspaces/cmake-general/tests/project/build/examples/example-sanitizer/CMakeFiles/example-sanitizer-address.dir/cmake_pch.hxx:5:10: error: 'iostream' file not found [clang-diagnostic-error]
#include <iostream>
^
3 errors generated.
When I take --tidy="..." stuff out of the command. It fully compiles, (also if I dont specify PCHs in the CMakeLists.txt) it works.
I am not sure what the problem is exactly.
Do PCH and clang-tidy somehow not work? Why are the include directories somehow missing? I am using LLVM-12, clang-12 on Ubuntu.
Also adding -I/usr/lib/llvm-12/include/c++/v1 does not help.
Sort of related to my other question here, since this is also about building llvm.
When trying to get around a build failure in llvm, I noticed the following:
Output in terminal when building a single object file through make:
rp% make asan_posix.o
cd /tmp/llvm20150917-93899-y384cu && /Applications/Xcode-beta.app/Contents/Developer/usr/bin/make -f projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.iossim.dir/build.make projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o
Building CXX object projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o
cd /tmp/llvm20150917-93899-y384cu/projects/compiler-rt/lib/asan && /usr/local/Library/ENV/4.3/clang++ -DASAN_DYNAMIC=1 -DASAN_HAS_EXCEPTIONS=1 -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/tmp/llvm20150917-93899-y384cu/projects/compiler-rt/lib/asan -I/tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan -I/tmp/llvm20150917-93899-y384cu/include -I/tmp/llvm20150917-93899-1jg6jdx/include -I/tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan/.. -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -Wall -std=c++11 -arch i386 -arch x86_64 -UNDEBUG -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -Wall -std=c++11 -stdlib=libc++ -mios-simulator-version-min=7.0 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.1.sdk -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-function-sections -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fno-rtti -ftls-model=initial-exec -o CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o -c /tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan/asan_posix.cc
cd /tmp/llvm20150917-93899-y384cu && /Applications/Xcode-beta.app/Contents/Developer/usr/bin/make -f projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.osx.dir/build.make projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o
Building CXX object projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o
cd /tmp/llvm20150917-93899-y384cu/projects/compiler-rt/lib/asan && /usr/local/Library/ENV/4.3/clang++ -DASAN_DYNAMIC=1 -DASAN_HAS_EXCEPTIONS=1 -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/tmp/llvm20150917-93899-y384cu/projects/compiler-rt/lib/asan -I/tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan -I/tmp/llvm20150917-93899-y384cu/include -I/tmp/llvm20150917-93899-1jg6jdx/include -I/tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan/.. -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -Wall -std=c++11 -arch i386 -arch x86_64 -UNDEBUG -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -Wall -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.9 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-function-sections -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fno-rtti -ftls-model=initial-exec -o CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o -c /tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan/asan_posix.cc
rp% file CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o
CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o: Mach-O 64-bit object x86_64
rp% file CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o
CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o: Mach-O 64-bit object x86_64
Output when the same commands are entered manually:
rp% cd /tmp/llvm20150917-93899-y384cu/projects/compiler-rt/lib/asan && /usr/local/Library/ENV/4.3/clang++ -DASAN_DYNAMIC=1 -DASAN_HAS_EXCEPTIONS=1 -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/tmp/llvm20150917-93899-y384cu/projects/compiler-rt/lib/asan -I/tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan -I/tmp/llvm20150917-93899-y384cu/include -I/tmp/llvm20150917-93899-1jg6jdx/include -I/tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan/.. -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -Wall -std=c++11 -arch i386 -arch x86_64 -UNDEBUG -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -Wall -std=c++11 -stdlib=libc++ -mios-simulator-version-min=7.0 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.1.sdk -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-function-sections -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fno-rtti -ftls-model=initial-exec -o CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o -c /tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan/asan_posix.cc
rp% cd /tmp/llvm20150917-93899-y384cu/projects/compiler-rt/lib/asan && /usr/local/Library/ENV/4.3/clang++ -DASAN_DYNAMIC=1 -DASAN_HAS_EXCEPTIONS=1 -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/tmp/llvm20150917-93899-y384cu/projects/compiler-rt/lib/asan -I/tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan -I/tmp/llvm20150917-93899-y384cu/include -I/tmp/llvm20150917-93899-1jg6jdx/include -I/tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan/.. -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -Wall -std=c++11 -arch i386 -arch x86_64 -UNDEBUG -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -Wall -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.9 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-function-sections -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fno-rtti -ftls-model=initial-exec -o CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o -c /tmp/llvm20150917-93899-1jg6jdx/projects/compiler-rt/lib/asan/asan_posix.cc
rp% file CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o
CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o: Mach-O universal binary with 2 architectures
CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o (for architecture i386): Mach-O object i386
CMakeFiles/RTAsan_dynamic.iossim.dir/asan_posix.cc.o (for architecture x86_64): Mach-O 64-bit object x86_64
rp% file CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o
CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o: Mach-O universal binary with 2 architectures
CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o (for architecture i386): Mach-O object i386
CMakeFiles/RTAsan_dynamic.osx.dir/asan_posix.cc.o (for architecture x86_64): Mach-O 64-bit object x86_64
The searching I did didn't really help; I didn't write the makefile myself (cmake generated), and at least to my eyes there wasn't reason for make to print something that it wasn't executing.
Anyone have any idea what is going on?
Reproduction steps:
install homebrew if it isn't already installed
replace homebrew's llvm formula with the WIP one here
Run brew install llvm --with-clang --with-lldb --verbose --debug
wait for the build to fail and ask you what to do
Drop into a debug shell
cd to projects/compiler-rt/lib/asan
run make clean
run make asan_posix.o (or any of the other *.o files listed in make help
run file on the output file (in CMakeFiles/RTAsan_dynamic.(osx|iossim).dir/asan_posix.cc.o for me)
Repeat the above 3 steps, but copy-pasting the command instead of running make
Edit: Link to my environment in the shell and during the make process.
The solution to this question ended up being the same as the linked question. homebrew was changing compiler flags, so the commands that were printed weren't the ones being executed. The fix in the other question also happened to fix this.
I'm trying to compile a program I found on the web using Clang++. The Makefile generates this command:
clang++ -c -arch x86_64 -msse3 -std=c++11 -stdlib=libstdc++
-Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type
-Wno-non-virtual-dtor -Wno-exit-time-destructors -Wformat -Wmissing-braces
-Wparentheses -Wno-switch -Wunused-function -Wunused-label -Wno-unused-parameter
-Wunused-variable -Wunused-value -Wno-empty-body -Wuninitialized -Wunknown-pragmas
-Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion
-Wint-conversion -Wno-shorten-64-to-32 -Wenum-conversion -Wno-newline-eof
-Wno-c++11-extensions -Wno-logical-op-parentheses -Wno-trigraphs
-Wno-invalid-offsetof -Wno-sign-conversion -Wdeprecated-declarations
-fmessage-length=0 -fno-exceptions -fstrict-aliasing -fvisibility=hidden
-fvisibility-inlines-hidden -funsafe-math-optimizations -ftrapping-math -fno-rtti
-fpascal-strings -fasm-blocks -O3 -Iinclude/ src/main.cpp
But I get
src/main.cpp:23:10: fatal error: 'unordered_map' file not found
#include <unordered_map>
^
1 error generated.
If I compile a simple program that includes <unordered_map> running clang++ test.cpp, it compiles fine.
I'm on
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix
I had the same issue when compiling glogg.
As the comments have pointed out. it was stdlib.
In the makefile after running qmake. Change this line from
CXXFLAGS = -g -Wextra -std=c++11 -DGLOGG_VERSION=\"`cat .tarball-version`\" -O2 -arch x86_64 -Wall -W $(DEFINES)
To this line below
CXXFLAGS = -g -Wextra -std=c++11 -stdlib=libc++ -DGLOGG_VERSION=\"`cat .tarball-version`\" -O2 -arch x86_64 -Wall -W $(DEFINES)
notice "-stdlib=libc++" was specified in the cxxflags. It's autospecified in the linker flags, I guess it also needs to be specified in for the C++ flags.
It says -Wno-c++11-extensions. What wrote that makefile?
I am using xcode 4.2.1, Apple LLVM compiler 3.0.
Project cleans successfully in xcode and builds successfully from the command line. The problem is the project fails to build in xcode. I feel like I am missing something in my xcode configuration. I have made no edits to the original source I pulled down.
From the log navigator:
CompileC /Developer/Code/blender-build/cmake/source/blender/blenkernel/Blender.build/Debug/bf_blenkernel.build/Objects-normal/x86_64/idcode.o source/blender/blenkernel/intern/idcode.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
cd /Developer/Code/blender-build/blender
setenv LANG en_US.US-ASCII
/Developer/usr/bin/clang -x c -arch x86_64 -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs -fpascal-strings -O0 -Wno-return-type -Wparentheses -Wswitch -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-shorten-64-to-32 "-DCMAKE_INTDIR=\"Debug\"" -DHAVE_STDBOOL_H -D__SSE__ -D__MMX__ -D__SSE2__ -D__LITTLE_ENDIAN__ -DOPJ_STATIC -DGLEW_STATIC -DWITH_AUDASPACE -DWITH_BULLET -DWITH_OPENEXR -DWITH_TIFF -DWITH_OPENJPEG -DWITH_DDS -DWITH_CINEON -DWITH_FRAMESERVER -DWITH_HDR -DWITH_AVI -DWITH_QUICKTIME -DWITH_PYTHON -DWITH_PYTHON_SECURITY -DWITH_MOD_FLUID -DWITH_SMOKE -DWITH_LZO -DWITH_LZMA -DWITH_GAMEENGINE -DWITH_LIBMV -DFFTW3=1 -DWITH_INTERNATIONAL -DWITH_FREESTYLE -DDEBUG -D_DEBUG -isysroot /Developer/SDKs/MacOSX10.7.sdk -fasm-blocks -mmacosx-version-min=10.6 -gdwarf-2 -Wno-sign-conversion -I/Developer/Code/blender-build/cmake/lib/Debug/include -I/Developer/Code/blender-build/blender/source/blender/blenkernel -I/Developer/Code/blender-build/blender/source/blender/blenfont -I/Developer/Code/blender-build/blender/source/blender/blenlib -I/Developer/Code/blender-build/blender/source/blender/blenloader -I/Developer/Code/blender-build/blender/source/blender/gpu -I/Developer/Code/blender-build/blender/source/blender/ikplugin -I/Developer/Code/blender-build/blender/source/blender/imbuf -I/Developer/Code/blender-build/blender/source/blender/makesdna -I/Developer/Code/blender-build/blender/source/blender/makesrna -I/Developer/Code/blender-build/blender/source/blender/bmesh -I/Developer/Code/blender-build/blender/source/blender/modifiers -I/Developer/Code/blender-build/blender/source/blender/nodes -I/Developer/Code/blender-build/blender/source/blender/render/extern/include -I/Developer/Code/blender-build/blender/intern/guardedalloc -I/Developer/Code/blender-build/blender/intern/iksolver/extern -I/Developer/Code/blender-build/blender/intern/memutil -I/Developer/Code/blender-build/blender/intern/mikktspace -I/Developer/Code/blender-build/blender/intern/raskter -I/Developer/Code/blender-build/blender/intern/smoke/extern -I/Developer/Code/blender-build/blender/extern/libmv -I/Developer/Code/blender-build/blender/intern/atomic -I/Developer/Code/blender-build/blender/source/blender/windowmanager -I/Developer/Code/blender-build/blender/intern/audaspace/intern -I/Developer/Code/blender-build/blender/intern/rigidbody -I/Developer/Code/blender-build/blender/source/blender/avi -I/Developer/Code/blender-build/blender/source/blender/quicktime -I/Developer/Code/blender-build/blender/source/blender/python -I/Developer/Code/blender-build/blender/intern/elbeem/extern -I/Developer/Code/blender-build/blender/extern/glew/include -I/Developer/Code/blender-build/blender/extern/bullet2/src -I/Developer/Code/blender-build/blender/extern/lzo/minilzo -I/Developer/Code/blender-build/blender/extern/lzma -I/Developer/Code/blender-build/blender/extern/recastnavigation -I/Developer/Code/blender-build/lib/darwin-9.x.universal/fftw3/include -I/Developer/Code/blender-build/cmake/source/blender/blenkernel/Blender.build/Debug/bf_blenkernel.build/DerivedSources/x86_64 -I/Developer/Code/blender-build/cmake/source/blender/blenkernel/Blender.build/Debug/bf_blenkernel.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Developer/Code/blender-build/cmake/lib/Debug -F/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks -Wall -Wcast-align -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=return-type -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts -Wno-unknown-pragmas -Wpointer-arith -Wunused-parameter -Wwrite-strings -Wundef -Winit-self -Wnonnull -Wmissing-include-dirs -Wno-div-by-zero -Wtype-limits -msse2 -msse -pipe -funsigned-char -fno-strict-aliasing -MMD -MT dependencies -MF /Developer/Code/blender-build/cmake/source/blender/blenkernel/Blender.build/Debug/bf_blenkernel.build/Objects-normal/x86_64/idcode.d -c /Developer/Code/blender-build/blender/source/blender/blenkernel/intern/idcode.c -o /Developer/Code/blender-build/cmake/source/blender/blenkernel/Blender.build/Debug/bf_blenkernel.build/Objects-normal/x86_64/idcode.o
Error:
/Developer/Code/blender-build/blender/source/blender/blenkernel/intern/idcode.c:90:10:{90:10-90:29}: error: expression is not an integer constant expression [3]
int i = ARRAY_SIZE(idtypes);
^~~~~~~~~~~~~~~~~~~
/Developer/Code/blender-build/blender/source/blender/blenlib/BLI_utildefines.h:353:36: note: instantiated from:
((sizeof(struct {int isnt_array : ((void *)&(arr) == &(arr)[0]);}) * 0) + \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
What can I do to get a clean build?
I upgraded xcode to version 4.6.3. The compiler updated to LLVM 4.2 and these problems were resolved. Otherwise I don't know why the previous version was failing.