Anyone know why sudo cmake --build ./build-clang --config Release results in
In file included from /opt/local/include/boost/asio/buffer.hpp:29:
/opt/local/include/boost/asio/detail/type_traits.hpp:89:12: error: no member named 'result_of' in namespace 'std'
using std::result_of;
~~~~~^
Despite the env variables being set?
$CC=clang
$CXX=clang++
$CC --version
Homebrew clang version 15.0.6
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
trying to build for Mac for the first time.
boost was installed using macports sudo port install boost +universal
I've heard result_of was deprecated in C++17 and removed in C++20 – how can I get around this issue? I'm working with C++20
when I add
target_compile_definitions(${TARGET_NAME}
PRIVATE
BOOST_ASIO_HAS_STD_INVOKE_RESULT=1)
I get the same errors
I uninstalled and reinstalled the latest version using brew and now I get /opt/local/include/cpprest/http_client.h:68:10: fatal error: 'boost/asio/ssl.hpp' file not found #include "boost/asio/ssl.hpp"
The problem is that at the moment, MacPorts only supports up to Boost 1.76. By default, it will use std::result_of, which has been removed in C++20.
To solve this, you can manually define BOOST_ASIO_HAS_STD_INVOKE_RESULT, which should route usages of result_of to the C++20 compliant invoke_result within the source.
Note, this does not guarantee all other codes are C++20 compliant.
Alternatively, you can also manually install Boost, or install it through other package managers like Homebrew, which supports up to Boost 1.81
Related
I am trying to install an older version of Boost on my Mac using Homebrew.
I am using:
brew install boost#1.53
And receiving error:
Error: No available formula with the name "boost#1.53"
I have performed:
brew search boost
And I can see that I have all versions back to 1.55 installed.
Is there a way round this, how can I install 1.53?
Git clone the boost code, checkout the version that you want and compile.
I'm trying to build boost::fiber alongside other boost libraries on Ubuntu. I downloaded boost version 1.61 from sourceforge. And I downloaded version 1.0 of boost::fiber from github. I copied directory named fiber in boost/libs sub-directory in boost distribution. The command I used for building is:
sudo ./b2 cxxflags="-std=c++14" --build-type=minimal --build-dir=/home/bobeff/projects/build --layout=system install
The used version of g++ is:
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.2) 5.4.0 20160609
boost::fiber failed to compile and the first of many errors is:
gcc.compile.c++ /home/bobeff/projects/build/boost/bin.v2/libs/fiber/build/gcc-5.4.0/release/link-static/threading-multi/algorithm.o
In file included from libs/fiber/src/algorithm.cpp:9:0:
./boost/fiber/fiber_context.hpp:91:5: error: invalid use of template-name ‘boost::context::execution_context’ without an argument list
context::execution_context ctx_;
Did you build boost.context with C++14 too?
Check if all required C++-features (lambdas, nullptr etc.) are supported.
You see this at stdout when you run b2/bjam - maybe you have to call b2/bjam with option --reconfigure.
As an alternative you could wait till boost-1.62 is released (28.09.2016?).
Is it possible to use Homebrew to install boost libraries compiled with GCC (instead of Clang)?
I have tried pointing HOMEBREW_CXX to my Homebrew version of GCC, but it doesn't seem to do the trick.
If not, I can always modify the configure file following the suggestion in this answer:
How to install Boost with specified compiler (say GCC)
brew install boost --cc=gcc-4.9 will do it. install --cc is described in man brew.
I had OpenMP compiling and executing in C/C++ on my Mac but then I formatted and reinstalled a fresh copy of OS X. I believe the only difference in the setup was that I had Xcode 5 before the format, and now I have Xcode 6.
Now I get fatal error: 'omp.h' file not found
I read this has something to do with clang and gcc, but, my confusion lies with why did it work before and now its not working?
After some research I seem to have found an answer.
GCC included in the latest version of Xcode (Xcode 6) is only a symbolic link to clang. Since clang does not support OpenMP at this time, you need to install a different version of GCC. The easiest way to do this would be to use Homebrew or MacPorts.
Keep in mind that even when you do this you will probably need to alter your $PATH to have /usr/local come before /usr/bin. This is because Homebrew will have placed your newly installed GCC in /usr/local. Also, some implementations may name the command gcc-49 instead of plain gcc.
Mac OSX uses clang.The gcc compiler in OS X does not support OpenMP. To use this feature a new gcc compiler needs to be installed.
Go to Terminal, if you have not installed Hombrew, install it:
/usr/bin/ruby -e "$(curl -fsSL https://`enter code here`raw.githubusercontent.com/Homebrew/install/master/install)"
then install new version of gcc
brew reinstall gcc --without-multilib
This will not make changes to the existing gcc compiler installed by Xcode as we are reinstalling it.
After running the command given below compile the files using the new version of gcc using the syntax : gcc-version -fopenmp filename.c
To find the version type gcc and then press tab. This will list out all the possible variants of gcc. The version number can be found out from this. For example : gcc-6, gcc-4.9,etc
I'd like to build the latest version of gcc on a mac. I have the latest xcode but I'm looking for some of the c++0x features that are in more recent versions (the lambda functions, etc).
Are there any good step-by-step tutorials on doing this?
You should look at the Homebrew project.
Homebrew allows you to do things like this:
brew install gcc
Mac homebrew installation instructions are available here.
Add GCC support to a fresh Xcode 4.2 installation using this homebrew formula:
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb
Upgrading from Xcode 4.1 doesn't drop existing GCC support, so this formula is only useful if you're working with a fresh 4.2+ installation.
One option is to install MacPorts and install the gcc46 package:
sudo port install gcc46
Another option is to download the source code and build it as follows:
tar xzvf gcc-4.6.0.tar.gz
cd gcc-4.6.0
./configure
make
Note that GCC 4.6.0 requires as prerequisites GMP 4.2+, MPFR 2.3.1+, and MPC 0.8.0+. If ./configure fails, it's probably because you're missing one of these (though it should give you a helpful error message in any case).
Building will take a while—likely several hours, depending on your hardware.
I would suggest building it yourself (Adam details how to do so). This will give you fine control on where to install and all the options you want to select. My experience from having multiple versions of gcc is that, if care is not taken apple's version of gcc can be damaged.
To speed up gcc installation you might want to look at --enable-languages option. If there are languages you don't need installed with the new gcc then you may not want to select them.