I have prepared a llvm-clang compiler targeting 32bit Windows. I used 3.7.1 and applied this patch. I get to something that almost works, apart that I have errors with boost.
If I compile my project (that normally works with mingw-gcc) using my usual boost 1.53 headers I have troubles including boost/interprocess components
In file included from [...]/Boost/include-WINDOWS/boost-1_53\boost/interprocess/sync/interprocess_semaphore.hpp:24:
In file included from [...]/Boost/include-WINDOWS/boost-1_53\boost/interprocess/exceptions.hpp:20:
In file included from [...]/Boost/include-WINDOWS/boost-1_53\boost/interprocess/errors.hpp:37:
[...]/Boost/include-WINDOWS/boost-1_53\boost/interprocess/detail/win32_api.hpp:878:48: error: conflicting types for 'VirtualProtect'
If I then try to recompile boost with:
bootstrap.bat mingw
b2 toolset=clang --with-thread --with-filesystem --with-signals --with-test --with-system --with-regex --with-program_options --with-serialization variant=release link=shared threading=multi
Depending on the various version of boost I get a lot of warnings that I could try to ignore, but also some errors:
For 1.56 and 1.57 just these: (is not much, but I don't know how to get rid of it)
In file included from libs\serialization\src\xml_wiarchive.cpp:35:
.\boost/archive/impl/archive_serializer_map.ipp:41:34: error: redeclaration of 'boost::archive::detail::archive_serializer_map::insert' cannot add 'dllexport' attribute
archive_serializer_map<Archive>::insert(const basic_serializer * bs){
^
.\boost/archive/detail/archive_serializer_map.hpp:42:17: note: previous declaration is here
static bool insert(const basic_serializer * bs);
^
In file included from libs\serialization\src\xml_wiarchive.cpp:35:
.\boost/archive/impl/archive_serializer_map.ipp:49:34: error: redeclaration of 'boost::archive::detail::archive_serializer_map::erase' cannot add 'dllexport' attribute
archive_serializer_map<Archive>::erase(const basic_serializer * bs){
^
.\boost/archive/detail/archive_serializer_map.hpp:43:17: note: previous declaration is here
static void erase(const basic_serializer * bs);
^
In file included from libs\serialization\src\xml_wiarchive.cpp:35:
.\boost/archive/impl/archive_serializer_map.ipp:61:34: error: redeclaration of 'boost::archive::detail::archive_serializer_map::find' cannot add 'dllexport' attribute
archive_serializer_map<Archive>::find(
^
.\boost/archive/detail/archive_serializer_map.hpp:44:37: note: previous declaration is here
static const basic_serializer * find(
^
For 1.59 and 1.60 a bunch of MMX related error, which is, as far as I can see, not a feature that I can control when preparing my llvm-clang:
clang-linux.compile.c++.without-pth bin.v2\libs\thread\build\clang-linux-3.7.1\debug\threading-multi\win32\thread.obj
In file included from libs\thread\src\win32\thread.cpp:17:
In file included from .\boost/thread/thread_only.hpp:15:
In file included from .\boost/thread/win32/thread_data.hpp:11:
In file included from .\boost/thread/win32/thread_primitives.hpp:18:
In file included from .\boost/detail/interlocked.hpp:154:
In file included from C:\Programs\LLVM\bin\..\lib\clang\3.7.1\include\intrin.h:26:
In file included from C:\Programs\MinGW\i686-w64-mingw32\include\Intrin.h:154:
In file included from C:\Programs\LLVM\bin\..\lib\clang\3.7.1\include\mm3dnow.h:27:
C:\Programs\LLVM\bin\..\lib\clang\3.7.1\include\mmintrin.h:28:2: error: "MMX instruction set not enabled"
#error "MMX instruction set not enabled"
^
In file included from libs\thread\src\win32\thread.cpp:17:
In file included from .\boost/thread/thread_only.hpp:15:
In file included from .\boost/thread/win32/thread_data.hpp:11:
In file included from .\boost/thread/win32/thread_primitives.hpp:18:
In file included from .\boost/detail/interlocked.hpp:154:
In file included from C:\Programs\LLVM\bin\..\lib\clang\3.7.1\include\intrin.h:26:
In file included from C:\Programs\MinGW\i686-w64-mingw32\include\Intrin.h:154:
C:\Programs\LLVM\bin\..\lib\clang\3.7.1\include\mm3dnow.h:42:41: error: use of undeclared identifier '__v8qi'
return (__m64)__builtin_ia32_pavgusb((__v8qi)__m1, (__v8qi)__m2);
^
C:\Programs\LLVM\bin\..\lib\clang\3.7.1\include\mm3dnow.h:42:55: error: use of undeclared identifier '__v8qi'
return (__m64)__builtin_ia32_pavgusb((__v8qi)__m1, (__v8qi)__m2);
^
C:\Programs\LLVM\bin\..\lib\clang\3.7.1\include\mm3dnow.h:47:38: error: cannot convert '__m64' to '__v2sf' (vector of 2 'float' values) without a conversion operator
return (__m64)__builtin_ia32_pf2id((__v2sf)__m);
^~~~~~~~~~~
C:\Programs\LLVM\bin\..\lib\clang\3.7.1\include\mm3dnow.h:52:38: error: cannot convert '__m64' to '__v2sf' (vector of 2 'float' values) without a conversion operator
return (__m64)__builtin_ia32_pfacc((__v2sf)__m1, (__v2sf)__m2);
^~~~~~~~~~~~
C:\Programs\LLVM\bin\..\lib\clang\3.7.1\include\mm3dnow.h:52:52: error: cannot convert '__m64' to '__v2sf' (vector of 2 'float' values) without a conversion operator
return (__m64)__builtin_ia32_pfacc((__v2sf)__m1, (__v2sf)__m2);
^~~~~~~~~~~~
Is there a way to get any version of boost to work with clang 32bit under Windows in a MinGW set up?
I have also tried llvm 3.8.0, but I cannot prepare it because my MinGW toolchain doesn't support some part of C++11 (and so other versions that I have tried, see here).
As to boost.thread:
After adding -msse (or whatever) (that resolves MMX instruction set not enabled error) just add -DBOOST_USE_WINDOWS_H to cxxflags to resolve different declarations of many system functions at Windows headers and at boost.date_time.
Eg:
cxxflags="-msse -DBOOST_USE_WINDOWS_H"
Related
I have a simple program where I'd like to use <boost/multiprecision/mpfr.hpp>.
ex.xpp:
#include <iostream>
#include <boost/multiprecision/mpfr.hpp>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
However, when I try to compile I get the following error:
... % g++ ex.cpp
In file included from ex.cpp:2:
In file included from /usr/local/include/boost/multiprecision/mpfr.hpp:9:
In file included from /usr/local/include/boost/multiprecision/number.hpp:25:
In file included from /usr/local/include/boost/multiprecision/detail/precision.hpp:9:
In file included from /usr/local/include/boost/multiprecision/traits/is_variable_precision.hpp:10:
/usr/local/include/boost/multiprecision/detail/number_base.hpp:38:9: warning: CAUTION: One or more C++11 features were found to be
unavailable [-W#pragma-messages]
#pragma message("CAUTION: One or more C++11 features were found to be unavailable")
^
/usr/local/include/boost/multiprecision/detail/number_base.hpp:39:9: warning: CAUTION: Compiling Boost.Multiprecision in non-C++11
or later conformance modes is now deprecated and will be removed from March 2021. [-W#pragma-messages]
#pragma message("CAUTION: Compiling Boost.Multiprecision in non-C++11 or later conformance modes is now deprecated and wil...
^
/usr/local/include/boost/multiprecision/detail/number_base.hpp:40:9: warning: CAUTION: Define
BOOST_MP_DISABLE_DEPRECATE_03_WARNING to suppress this message. [-W#pragma-messages]
#pragma message("CAUTION: Define BOOST_MP_DISABLE_DEPRECATE_03_WARNING to suppress this message.")
^
In file included from ex.cpp:2:
In file included from /usr/local/include/boost/multiprecision/mpfr.hpp:11:
In file included from /usr/local/include/boost/multiprecision/gmp.hpp:21:
In file included from /usr/local/include/boost/math/special_functions/asinh.hpp:25:
In file included from /usr/local/include/boost/math/constants/constants.hpp:11:
/usr/local/include/boost/math/tools/cxx03_warn.hpp:99:1: warning: CAUTION: One or more C++11 features were found to be unavailable
[-W#pragma-messages]
BOOST_PRAGMA_MESSAGE("CAUTION: One or more C++11 features were found to be unavailable")
^
/usr/local/include/boost/config/pragma_message.hpp:24:34: note: expanded from macro 'BOOST_PRAGMA_MESSAGE'
# define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x)))
^
<scratch space>:21:2: note: expanded from here
message("CAUTION: One or more C++11 features were found to be unavailable")
^
In file included from ex.cpp:2:
In file included from /usr/local/include/boost/multiprecision/mpfr.hpp:11:
In file included from /usr/local/include/boost/multiprecision/gmp.hpp:21:
In file included from /usr/local/include/boost/math/special_functions/asinh.hpp:25:
In file included from /usr/local/include/boost/math/constants/constants.hpp:11:
/usr/local/include/boost/math/tools/cxx03_warn.hpp:100:1: warning: CAUTION: Compiling Boost.Math in pre-C++11 conformance modes is
now deprecated and will be removed from March 2021. [-W#pragma-messages]
BOOST_PRAGMA_MESSAGE("CAUTION: Compiling Boost.Math in pre-C++11 conformance modes is now deprecated and will be removed f...
^
/usr/local/include/boost/config/pragma_message.hpp:24:34: note: expanded from macro 'BOOST_PRAGMA_MESSAGE'
# define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x)))
^
<scratch space>:24:2: note: expanded from here
message("CAUTION: Compiling Boost.Math in pre-C++11 conformance modes is now deprecated and will be removed from March 2021.")
^
In file included from ex.cpp:2:
In file included from /usr/local/include/boost/multiprecision/mpfr.hpp:11:
In file included from /usr/local/include/boost/multiprecision/gmp.hpp:21:
In file included from /usr/local/include/boost/math/special_functions/asinh.hpp:25:
In file included from /usr/local/include/boost/math/constants/constants.hpp:11:
/usr/local/include/boost/math/tools/cxx03_warn.hpp:101:1: warning: CAUTION: Define BOOST_MATH_DISABLE_DEPRECATED_03_WARNING to
suppress this message. [-W#pragma-messages]
BOOST_PRAGMA_MESSAGE("CAUTION: Define BOOST_MATH_DISABLE_DEPRECATED_03_WARNING to suppress this message.")
^
/usr/local/include/boost/config/pragma_message.hpp:24:34: note: expanded from macro 'BOOST_PRAGMA_MESSAGE'
# define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x)))
^
<scratch space>:27:2: note: expanded from here
message("CAUTION: Define BOOST_MATH_DISABLE_DEPRECATED_03_WARNING to suppress this message.")
^
In file included from ex.cpp:2:
In file included from /usr/local/include/boost/multiprecision/mpfr.hpp:11:
In file included from /usr/local/include/boost/multiprecision/gmp.hpp:21:
In file included from /usr/local/include/boost/math/special_functions/asinh.hpp:25:
In file included from /usr/local/include/boost/math/constants/constants.hpp:11:
/usr/local/include/boost/math/tools/cxx03_warn.hpp:102:1: warning: CAUTION: This message was generated due to the define:
BOOST_NO_CXX11_NOEXCEPT [-W#pragma-messages]
BOOST_PRAGMA_MESSAGE("CAUTION: This message was generated due to the define: " BOOST_MATH_CXX03_WARN_REASON)
^
/usr/local/include/boost/config/pragma_message.hpp:24:34: note: expanded from macro 'BOOST_PRAGMA_MESSAGE'
# define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x)))
^
<scratch space>:30:2: note: expanded from here
message("CAUTION: This message was generated due to the define: " "BOOST_NO_CXX11_NOEXCEPT")
^
7 warnings generated.
Undefined symbols for architecture x86_64:
"_mpfr_free_cache", referenced from:
boost::multiprecision::backends::detail::mpfr_cleanup<true>::initializer::~initializer() in ex-37ad80.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have both gmp and mpfr installed at /usr/local/include/, I can't really understand what could be the problem and I haven't find anyone in the internet with the same kind of problem, do you have any idea?
I am trying to compile a program that I have had no issues compiling with Ubuntu 18.04 and Windows 10. However, when I try to compile it on OSX High Sierra I am given errors and they are only related to boost.
This is an example:
#include <boost/process.hpp>
#include <iostream>
int main()
{
std::cout << "This is a test." << std::endl;
}
I have then tried to compile the program with both g++ and clang like this:
g++ -std=c++11 test.cpp -lpthread
I then get this massive error:
In file included from test.cpp:1:
In file included from /usr/local/include/boost/process.hpp:24:
In file included from /usr/local/include/boost/process/async_system.hpp:22:
In file included from /usr/local/include/boost/process/child.hpp:21:
In file included from /usr/local/include/boost/process/detail/child_decl.hpp:30:
/usr/local/include/boost/process/detail/posix/wait_for_exit.hpp:60:7: error: expected unqualified-id
::sigemptyset(&sigset);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/signal.h:125:26: note: expanded from macro 'sigemptyset'
#define sigemptyset(set) (*(set) = 0, 0)
^
In file included from test.cpp:1:
In file included from /usr/local/include/boost/process.hpp:24:
In file included from /usr/local/include/boost/process/async_system.hpp:22:
In file included from /usr/local/include/boost/process/child.hpp:21:
In file included from /usr/local/include/boost/process/detail/child_decl.hpp:30:
/usr/local/include/boost/process/detail/posix/wait_for_exit.hpp:61:7: error: expected unqualified-id
::sigaddset(&sigset, SIGCHLD);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/signal.h:122:31: note: expanded from macro 'sigaddset'
#define sigaddset(set, signo) (*(set) |= __sigbits(signo), 0)
^
In file included from test.cpp:1:
In file included from /usr/local/include/boost/process.hpp:24:
In file included from /usr/local/include/boost/process/async_system.hpp:22:
In file included from /usr/local/include/boost/process/child.hpp:21:
In file included from /usr/local/include/boost/process/detail/child_decl.hpp:30:
/usr/local/include/boost/process/detail/posix/wait_for_exit.hpp:87:26: error: no member named 'sigtimedwait' in the global namespace
auto ret_sig = ::sigtimedwait(&sigset, nullptr, &ts);
~~^
In file included from test.cpp:1:
In file included from /usr/local/include/boost/process.hpp:25:
In file included from /usr/local/include/boost/process/group.hpp:32:
/usr/local/include/boost/process/detail/posix/wait_group.hpp:64:7: error: expected unqualified-id
::sigemptyset(&sigset);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/signal.h:125:26: note: expanded from macro 'sigemptyset'
#define sigemptyset(set) (*(set) = 0, 0)
^
In file included from test.cpp:1:
In file included from /usr/local/include/boost/process.hpp:25:
In file included from /usr/local/include/boost/process/group.hpp:32:
/usr/local/include/boost/process/detail/posix/wait_group.hpp:65:7: error: expected unqualified-id
::sigaddset(&sigset, SIGCHLD);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/signal.h:122:31: note: expanded from macro 'sigaddset'
#define sigaddset(set, signo) (*(set) |= __sigbits(signo), 0)
^
In file included from test.cpp:1:
In file included from /usr/local/include/boost/process.hpp:25:
In file included from /usr/local/include/boost/process/group.hpp:32:
/usr/local/include/boost/process/detail/posix/wait_group.hpp:90:17: error: no member named 'sigtimedwait' in the global namespace
ret = ::sigtimedwait(&sigset, nullptr, &ts);
~~^
6 errors generated.
I could be missing a compiler flag, I have tried -lboost_system but that gave the same exact errors. If this specific library is not compatible with OSX then I will try and find a work around, but this library is already embedded in the code that I am currently working with.
Are there any known fixes for this?
You are correct. As of 1.69.0 Boost.Process is broken on MacOS. For the gritty details, follow the link to the bug report.
There is a workaround given in the bug report to get it compiling on MacOS:
Turns out that MacOS isn't the only platform that defines sigemptyset, sigaddset. That is an easy fix since all you need to do is drop the :: qualifier. As for the sigtimedwait, that too isn't common on all platforms. Strangely, stripping the :: qualifier from that one gets the code to compile. I am guessing that template is never instantiated so the fact the method does not exits isn't causing us problems.
I can supply a patch but it is nothing more than stripping :: from those 3 identifiers.
A comprehensive patch is included in the Flint project. Note that Flint is MIT licensed if you choose to include their patch in your code
EDIT2: The problem was NOT a simple typographical error. I made a typo in the logs below, which I corrected, but the problem was still there.
EDIT: I mistakenly ran with gcc instead of g++, once, after attempting below. The problem was there before with g++ and it is there now.
I am currently on a MacOS High Sierra box. I recently moved a lot of files from a MacBook Air to this machine, including what I assume were all of Xcode's junk. Now, when I try to compile a very simple C++ program:
#include <iostream>
int main()
{
// VAR_DEC
int a = 4;
// VAR_MANIP
a = a*2;
// VAR_PRINT
std::cout << a << std::endl;
return 0;
}
I get the following ridiculous error:
jrfarah#Josephs-MBP: [config_file_script] $ g++ test.cpp -o test
In file included from test.cpp:1:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/iostream:38:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/ios:216:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/__locale:15:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/string:470:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/string_view:171:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/__string:56:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/algorithm:640:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:629:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/typeinfo:61:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/exception:82:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/cstdlib:86:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:94:
In file included from /usr/include/stdlib.h:65:
In file included from /usr/include/sys/wait.h:110:
/usr/include/sys/resource.h:196:2: error: unknown type name 'uint8_t'
uint8_t ri_uuid[16];
^
/usr/include/sys/resource.h:197:2: error: unknown type name 'uint64_t'
uint64_t ri_user_time;
^
/usr/include/sys/resource.h:198:2: error: unknown type name 'uint64_t'
uint64_t ri_system_time;
^
/usr/include/sys/resource.h:199:2: error: unknown type name 'uint64_t'
uint64_t ri_pkg_idle_wkups;
^
/usr/include/sys/resource.h:200:2: error: unknown type name 'uint64_t'
uint64_t ri_interrupt_wkups;
^
/usr/include/sys/resource.h:201:2: error: unknown type name 'uint64_t'
uint64_t ri_pageins;
^
/usr/include/sys/resource.h:202:2: error: unknown type name 'uint64_t'
uint64_t ri_wired_size;
^
/usr/include/sys/resource.h:203:2: error: unknown type name 'uint64_t'
uint64_t ri_resident_size;
^
/usr/include/sys/resource.h:204:2: error: unknown type name 'uint64_t'
uint64_t ri_phys_footprint;
^
/usr/include/sys/resource.h:205:2: error: unknown type name 'uint64_t'
uint64_t ri_proc_start_abstime;
^
/usr/include/sys/resource.h:206:2: error: unknown type name 'uint64_t'
uint64_t ri_proc_exit_abstime;
^
/usr/include/sys/resource.h:210:2: error: unknown type name 'uint8_t'
uint8_t ri_uuid[16];
^
/usr/include/sys/resource.h:211:2: error: unknown type name 'uint64_t'
uint64_t ri_user_time;
^
/usr/include/sys/resource.h:212:2: error: unknown type name 'uint64_t'
uint64_t ri_system_time;
^
/usr/include/sys/resource.h:213:2: error: unknown type name 'uint64_t'
uint64_t ri_pkg_idle_wkups;
^
/usr/include/sys/resource.h:214:2: error: unknown type name 'uint64_t'
uint64_t ri_interrupt_wkups;
^
/usr/include/sys/resource.h:215:2: error: unknown type name 'uint64_t'
uint64_t ri_pageins;
^
/usr/include/sys/resource.h:216:2: error: unknown type name 'uint64_t'
uint64_t ri_wired_size;
^
/usr/include/sys/resource.h:217:2: error: unknown type name 'uint64_t'
uint64_t ri_resident_size;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
I've tried installing and reinstalling everything I could think of related to the problem, such as gcc, g++, cc, brew, Xcode, command-line-tools, etc. I've also tried all the suggestions on the following pages:
Unknown type name uint8_t?
Include search path on Mac OS X Yosemite 10.10.1
Cythonizing fails because of unknown type name 'uint64_t'
unknown type name 'uint8_t', MinGW
JT Bullitt's very comprehensive blog
and more, but those summarize it pretty well. None of the solutions have worked.
I think the last one has the most likely solution. (If you search for "unknown" on the page you'll see the fix.) According to the developer:
Fix: Remove /opt/local/include/** and /opt/local/lib/** from the "Header Search Paths" build settings. Replace them with much more specific paths to the desired include directories. In my particular case, this meant replacing them with /opt/local/include/glib-2.0 /opt/local/lib/glib-2.0/include /opt/local/include/. It's up and running again!
However, I didn't install Xcode, I only installed the command line developer tools. Therefore, I don't have an easy way to access the "Header Search Paths" build settings, and thus, I can't try out his solution.
I am looking for a solution to this problem, preferably one that doesn't require me installing the entire OS. Alternatively, if someone could kindly guide me through finding the build settings file, I would be very grateful.
Maybe you can try:
mv /usr/local/include /usr/local/include.old
then:
brew install llvm
It's fairly obvious that you borked your system GCC installation. Please note that GCC is a suite of compilers and that G++ is the C++ front-end. Package managers often have a separate package called gcc-g++, however, when compiling from source, you simply do --enable-languages=c,c++. Now if reinstalling XCode doesn't resolve the problem (you should've already done this, if "it takes up too much space" just remove it), then you can try compiling GCC from source. Adapted from the GNU wiki:
First, grab your desired GCC tar ball from here
Untar it with tar zxvf gcc*
cd gcc* then ./contrib/download_prerequisites
Do an out of source build: mkdir build && cd build
../gcc*/configure --prefix=$HOME/gcc-install --enable-languages=c,c++
make and make install
Now just add $HOME/gcc-install/bin to your path and you should be good to go.
I experienced this error during compilation of Perl-5.34.0 from source. An alternative solution that worked for me was setting the SDK environment variable:
export SDK=`xcrun --show-sdk-path`
Sometimes, you may need to set SDKROOT in the same way:
export SDKROOT=`xcrun --show-sdk-path`
Placing it into your ~/.profile file will (conveniently) make this setting permanent.
I recently bought a new MacBook on which I transferred my old session. Since then, and after i upgraded to 10.13, i can't get clang to compile anything including only iostream.
Given this program :
#include <iostream>
int main(void)
{
std::cout << "Hello world !" << std::endl;
return 0;
}
gives my this output when g++ main.cpp :
In file included from main.cpp:1:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iostream:38:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ios:216:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__locale:15:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:470:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string_view:171:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__string:56:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:640:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:629:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/typeinfo:61:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/exception:82:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:86:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:94:
In file included from /usr/include/stdlib.h:65:
In file included from /usr/include/sys/wait.h:110:
In file included from /usr/include/sys/resource.h:72:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdint.h:119:
In file included from /usr/local/include/stdint.h:82:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/inttypes.h:247:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/inttypes.h:30:
/usr/include/inttypes.h:235:8: error: unknown type name 'intmax_t'
extern intmax_t
^
/usr/include/inttypes.h:236:9: error: unknown type name 'intmax_t'
imaxabs(intmax_t j);
^
/usr/include/inttypes.h:240:2: error: unknown type name 'intmax_t'
intmax_t quot;
^
/usr/include/inttypes.h:241:2: error: unknown type name 'intmax_t'
intmax_t rem;
^
/usr/include/inttypes.h:246:9: error: unknown type name 'intmax_t'
imaxdiv(intmax_t __numer, intmax_t __denom);
^
/usr/include/inttypes.h:246:27: error: unknown type name 'intmax_t'
imaxdiv(intmax_t __numer, intmax_t __denom);
^
/usr/include/inttypes.h:250:8: error: unknown type name 'intmax_t'
extern intmax_t
^
/usr/include/inttypes.h:256:8: error: unknown type name 'uintmax_t'; did you
mean 'uintptr_t'?
extern uintmax_t
^
/usr/include/sys/_types/_uintptr_t.h:30:24: note: 'uintptr_t' declared here
typedef unsigned long uintptr_t;
^
In file included from main.cpp:1:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iostream:38:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ios:216:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__locale:15:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:470:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string_view:171:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__string:56:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:640:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:629:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/typeinfo:61:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/exception:82:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:86:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:94:
In file included from /usr/include/stdlib.h:65:
In file included from /usr/include/sys/wait.h:110:
In file included from /usr/include/sys/resource.h:72:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdint.h:119:
In file included from /usr/local/include/stdint.h:82:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/inttypes.h:247:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/inttypes.h:30:
/usr/include/inttypes.h:263:8: error: unknown type name 'intmax_t'
extern intmax_t
^
/usr/include/inttypes.h:269:8: error: unknown type name 'uintmax_t'; did you
mean 'uintptr_t'?
extern uintmax_t
^
/usr/include/sys/_types/_uintptr_t.h:30:24: note: 'uintptr_t' declared here
typedef unsigned long uintptr_t;
^
In file included from main.cpp:1:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iostream:38:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ios:216:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__locale:15:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:470:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string_view:171:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__string:56:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:640:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:629:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/typeinfo:61:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/exception:82:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:86:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:94:
In file included from /usr/include/stdlib.h:65:
In file included from /usr/include/sys/wait.h:110:
/usr/include/sys/resource.h:197:2: error: unknown type name 'uint64_t'
uint64_t ri_user_time;
^
/usr/include/sys/resource.h:198:2: error: unknown type name 'uint64_t'
uint64_t ri_system_time;
^
/usr/include/sys/resource.h:199:2: error: unknown type name 'uint64_t'
uint64_t ri_pkg_idle_wkups;
^
/usr/include/sys/resource.h:200:2: error: unknown type name 'uint64_t'
uint64_t ri_interrupt_wkups;
^
/usr/include/sys/resource.h:201:2: error: unknown type name 'uint64_t'
uint64_t ri_pageins;
^
/usr/include/sys/resource.h:202:2: error: unknown type name 'uint64_t'
uint64_t ri_wired_size;
^
/usr/include/sys/resource.h:203:2: error: unknown type name 'uint64_t'
uint64_t ri_resident_size;
^
/usr/include/sys/resource.h:204:2: error: unknown type name 'uint64_t'
uint64_t ri_phys_footprint;
^
/usr/include/sys/resource.h:205:2: error: unknown type name 'uint64_t'
uint64_t ri_proc_start_abstime;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
I tried the following :
Reset CLT with Xcode-select --reset
Reinstall CLT
Reinstall Xcode
None of these solution worked and this starting to drive me crazy. Does somebody has the same problem and found a solution ?
EDIT : Xcode C++ Projects are successfully compiling, still don't understand why it would not in a terminal.
I had exactly the same problem after transferring to macOS High Sierra (though, errors were not the same, but similar).
I found a workaround by renaming /usr/local/include to /usr/local/include_old (well, name does not really matter, just the fact that g++/clang will not search for headers in this folder anymore).
I had exactly the same problem today and after executing xcode-select --install, everything works fine!
I had the same issue after upgrading to MacOS Mojave 10.14.4 and Xcode 10.2
The issue got resolved, after installing the package
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
Same error I encountered on golang recently.
This was my solution: rm -rf /usr/local/include
I'm guessing the higher version of MacOS (I'm currently on BigSur) doesn't need that folder anymore so you might save a little bit of storage space if the folder is going to be deleted.
Check that you don't include "/usr/local/include" into headers search path of your project.
I had a similar issue that after upgrading to high sierra (and Xcode 9.1) that my standard make reported unfamiliar warnings.
It drew .h files from /usr/local/include instead from the (as I thought) standard /usr/include. For example, there was no zlib.h available.
Reinstalling Xcode (who claims to install the commandline version too) did not help.
There was no /usr/include at all but the C++ system include were available through the links reported in clang --version, but none of the C-includes.
After xcode-select --install and actually "install" of the commandline material the /usr/include was populated with the necessary C libraries, and make started to compile without warnings again.
The heavily upvoted answer here is to rename /usr/local/include to something else, which essentially removes it. This is not a great idea.
The source of this error is old header files in /usr/local/include that are no longer needed and create errors like the one OP describes.
Instead of removing this folder, clean it out.
Move (not copy) all of the files in /usr/local/include into a backup location.
(Optional) Reinstall any libraries you need on the system. In my case, I needed to reinstall GLFM and GLM because I'm doing some graphics programming.
Try building again.
Found the solution here, following #Sudheer's suggestion:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
from https://donatstudios.com/MojaveMissingHeaderFiles
After renaming the /usr/local/include to /usr/local/include_old. Not sure if that was necessary, but renaming alone did not help (though it changed the kind of error I was getting).
I'm having a problem compiling mysql connectors C++ with mingw, as posted in the official website, you should run cmake to configure the source, then run a mingw32-make... the cmake needs to have the boost library installed, so i got it and compiled it (it says many updated, 40 targets skipped and failed to update 24).
After that tried to run cmake on mysql connector source, it output no errors and work just fine, when trying to do the final step mingw32-make, it gives lots of errors, many of then are redefinitions... the log is below. Please help me i really need it.
C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\bin>mingw32-make
[ 0%] Building CXX object driver/CMakeFiles/mysqlcppconn.dir/mysql_art_resultset.cpp.obj
C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:1:0: warning: -fPIC
ignored for target (all code is position independent) [enabled by default]
In file included from C:/MySQL/MySQL_Server_5.6/include/my_global.h:72:0,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\nativeapi/mysql_private_iface.h:57,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_util.h:30,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:31:
C:/MySQL/MySQL_Server_5.6/include/my_config.h:509:0: warning: "isnan" redefined [enabled by default]
In file included from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:28:0:
c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/math.h:480:0: note: this is the location of the previous definition
In file included from C:/MySQL/MySQL_Server_5.6/include/my_global.h:72:0,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\nativeapi/mysql_private_iface.h:57,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_util.h:30,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:31:
C:/MySQL/MySQL_Server_5.6/include/my_config.h:517:0: warning: "strtok_r" redefined [enabled by default]
In file included from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/i686-w64-mingw32/bits/gthr-default.h:41:0,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/i686-w64-mingw32/bits/gthr.h:150,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/ext/atomicity.h:34,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/bits/ios_base.h:41,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/ios:43,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/istream:40,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/sstream:39,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:27:
c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/pthread.h:460:0: note: this is the location of the previous definition
In file included from C:/MySQL/MySQL_Server_5.6/include/my_global.h:72:0,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\nativeapi/mysql_private_iface.h:57,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_util.h:30,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:31:
C:/MySQL/MySQL_Server_5.6/include/my_config.h:527:0: warning: "NOMINMAX" redefined [enabled by default]
In file included from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/i686-w64-mingw32/bits/c++config.h:414:0,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/iosfwd:40,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/ios:39,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/istream:40,
from c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/sstream:39,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:27:
c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/i686-w64-mingw32/bits/os_defines.h:46:0: note: this is the location of the previous definition
In file included from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_util.h:30:0,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:31:
C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\nativeapi/mysql_private_iface.h:81:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
In file included from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.c
pp:36:0:
C:/Users/Hugo/Downloads/mysql-connector-c++-1.1.2/cppconn/exception.h:48:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
C:/Users/Hugo/Downloads/mysql-connector-c++-1.1.2/cppconn/exception.h:52:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
C:/Users/Hugo/Downloads/mysql-connector-c++-1.1.2/cppconn/exception.h:53:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
C:/Users/Hugo/Downloads/mysql-connector-c++-1.1.2/cppconn/exception.h:58:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:162:1: error: invalid suffix "ui64" on integer constant
C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:162:1: error: invalid suffix "ui64" on integer constant
In file included from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\nativeapi/mysql_private_iface.h:57:0,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_util.h:30,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:31:
C:/MySQL/MySQL_Server_5.6/include/my_global.h: In function 'double rint(double)':
C:/MySQL/MySQL_Server_5.6/include/my_global.h:1160:35: error: 'double rint(double)' was declared 'extern' and later 'static' [-fpermissive]
In file included from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:28:0:
c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/math.h:783:23: error: previous declaration of 'double rint(double)' [-fpermissive]
In file included from D:/boost_1_53_0/boost/assert.hpp:81:0,
from D:/boost_1_53_0/boost/smart_ptr/shared_ptr.hpp:29,
from D:/boost_1_53_0/boost/shared_ptr.hpp:17,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_util.h:33,
from C:\Users\Hugo\Downloads\mysql-connector-c++-1.1.2\driver\mysql_art_resultset.cpp:31:
c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/cstdlib: At global scope:
c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/cstdlib:196:11: error: '::strtoll' has not been declared
c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/cstdlib:197:11: error: '::strtoull' has not been declared
c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/cstdlib:219:22: error: '__gnu_cxx::strtoll' has not been declared
c:\qt\qt5.0.1\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/cstdlib:220:22: error: '__gnu_cxx::strtoull' has not been declared
driver\CMakeFiles\mysqlcppconn.dir\build.make:57: recipe for target 'driver/CMakeFiles/mysqlcppconn.dir/mysql_art_resultset.cpp.obj' failed
mingw32-make[2]: *** [driver/CMakeFiles/mysqlcppconn.dir/mysql_art_resultset.cpp.obj] Error 1
CMakeFiles\Makefile2:94: recipe for target 'driver/CMakeFiles/mysqlcppconn.dir/all' failed
mingw32-make[1]: *** [driver/CMakeFiles/mysqlcppconn.dir/all] Error 2
makefile:135: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
The mysql connector c++ source code is garbage, unfortunately.
It redefines functions that are defined in the standard library and then includes the standard library, or depends on non-standard functions that are not included in every implementation.
Since the standard library does not check to see if its functions and structs have already been defined, you end up with multiple definition errors all over the place.
Also, the problem is made worse for you in that mysql connector has not been ported for mingw. To compile on windows you are required to use visual studio.
It get's better. They only support visual studio 8 and 9.
If you follow these instructions exactly,
http://dev.mysql.com/doc/connector-cpp/en/connector-cpp-installation-source-windows.html
then you might be able to get it to work, but you must not deviate from any version numbers. Use an old version of cmake, an old version of visual studio. They have not tested nor do they care about compatibility with any modern versions of build tools.