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).
Related
I'm a bit new to MATLAB but am currently trying to build MEX files using G++ (version 6.3) as the compiler. I got this error
MEX completed successfully.
Building with 'g++'.
Error using mex
/disks/local/sceneflow2/./external/libtrws/trwsMex.cpp:14:13: error: conflicting declaration ‘typedef
int mwSize’
In file included from /usr/local/MATLAB/R2016a/extern/include/matrix.h:25:0,
from /usr/local/MATLAB/R2016a/extern/include/mex.h:51,
from /disks/local/sceneflow2/./external/libtrws/trwsMex.cpp:9:
/usr/local/MATLAB/R2016a/extern/include/tmwtypes.h:795:19: error: ‘mwSize’ has a previous
declaration as ‘typedef size_t mwSize’
/disks/local/sceneflow2/./external/libtrws/trwsMex.cpp:15:13: error: conflicting declaration ‘typedef
int mwIndex’
In file included from /usr/local/MATLAB/R2016a/extern/include/matrix.h:25:0,
from /usr/local/MATLAB/R2016a/extern/include/mex.h:51,
from /disks/local/sceneflow2/./external/libtrws/trwsMex.cpp:9:
/usr/local/MATLAB/R2016a/extern/include/tmwtypes.h:796:19: error: ‘mwIndex’ has a previous
declaration as ‘typedef size_t mwIndex’
Error in make_mex (line 20)
mex ./external/libtrws/trwsMex.cpp -largeArrayDims CXXFLAGS="\$CXXFLAGS -std=c++0x -fpermissive"
-outdir build
I don't get it. Why is /usr/local/MATLAB/R2016a/extern/include/tmwtypes.h definition of mwSize conflicting with /usr/local/MATLAB/R2016a/extern/include/mex.h? Aren't they predefined libraries included with MATLAB (meaning they should work fine?)
By the way, /disks/local/sceneflow2/./external/libtrws/trwsMex.cpp has a line which includes the aforementioned mex.h.
The error message has to blocks (for two different errors), let's look at the first one only. I've split it out into three "lines":
/disks/local/sceneflow2/./external/libtrws/trwsMex.cpp:14:13: error: conflicting declaration
‘typedef int mwSize’
In file included from /usr/local/MATLAB/R2016a/extern/include/matrix.h:25:0,
from /usr/local/MATLAB/R2016a/extern/include/mex.h:51,
from /disks/local/sceneflow2/./external/libtrws/trwsMex.cpp:9:
/usr/local/MATLAB/R2016a/extern/include/tmwtypes.h:795:19: error: ‘mwSize’ has a previous
declaration as ‘typedef size_t mwSize’
The first line says that the compiler found a declaration for mwSize on line 14 of your trwsMex.cpp file, where it says typedef int mwSize.
The last line says that this mwSize was already defined in the tmwtypes.h header that comes with MATLAB.
The second line says that this header file was included by matrix.h, which is included by mex.h, which is included by your trwsMex.cpp on line 9.
So, to fix the error, don't define mwSize and mwIndex in your MEX-file source code, these are defined by MATLAB's headers.
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 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"
i try to write a astparser for a large c++-project with lots of template functions and structs, as well as template functor usage. however i'm stuck now. the first problem was that my astparser could not find stdlib.h. this problem i've solved by providing additional system dependent include paths to stdlib.h and other system and c++ headers. however, now i get these error messages, when my parser is running:
In file included from source/real_test.cpp:2:
In file included from /usr/include/c++/4.7.2/tr1/stdarg.h:32:
In file included from /usr/include/c++/4.7.2/tr1/cstdarg:32:
/usr/include/c++/4.7.2/cstdarg:56:11: error: no member named 'va_list' in the global namespace
using ::va_list;
~~^
/usr/include/bits/byteswap.h:47:10: error: use of undeclared identifier '__builtin_bswap32'<br>
return __builtin_bswap32 (__bsx);
^
/usr/include/bits/byteswap.h:111:10: error: use of undeclared identifier '__builtin_bswap64'
return __builtin_bswap64 (__bsx);
^
In file included from /usr/include/c++/4.7.2/fstream:40:
In file included from /usr/include/c++/4.7.2/istream:40:
In file included from /usr/include/c++/4.7.2/ios:39:
In file included from /usr/include/c++/4.7.2/iosfwd:42:
In file included from /usr/include/c++/4.7.2/bits/postypes.h:42:
In file included from /usr/include/c++/4.7.2/cwchar:46:
/usr/include/wchar.h:614:9: error: unknown type name '__gnuc_va_list'
__gnuc_va_list __arg)
^
/usr/include/wchar.h:621:8: error: unknown type name '__gnuc_va_list'
__gnuc_va_list __arg)
^
/usr/include/wchar.h:627:9: error: unknown type name '__gnuc_va_list'
__gnuc_va_list __arg)
^
/usr/include/wchar.h:691:8: error: unknown type name '__gnuc_va_list'
__gnuc_va_list __arg)
^
/usr/include/wchar.h:698:7: error: unknown type name '__gnuc_va_list'
__gnuc_va_list __arg)
^
/usr/include/wchar.h:703:8: error: unknown type name '__gnuc_va_list'
__gnuc_va_list __arg)
and so on.....
i'm not sure how to solve it. i think the problem is even that the parser knows where it can find the required c++ headers, it does not include other headers which define MACROS, like _STDLIB_H required by the previous ones. Can anyone please help me.
With kind regards
Max