Closed upsilona closed 1 year ago
Can you show me the code you are trying to build?
Here is the code I'm trying to build
#include <iostream>
#include <boost/asio.hpp>
#include <boost/redis.hpp>
int main(int argc, char **argv) {
std::string host = "127.0.0.1";
std::string port = "6379";
boost::redis::request request;
request.push("HELLO", 3);
request.push("PING", "Hello world!");
request.push("QUIT");
boost::redis::response<boost::redis::ignore_t, std::string, boost::redis::ignore_t> response;
return 0;
}
NB : I'm linking this code with a CMake target I previsouly created, in order to compile <boost/redis/src.hpp>
I can build this code with clang++-14 on linux, both c++ 17 and c++20. Currently I have no CI setup for macos so I would have to look around to set one
It is very strange that code is causing the problem, the variables host
, port
, request
and response
are all independent from each other, can you reduce it even further?
The line the error is occurring is pointing to an unrelated function
inline
void boost_redis_from_bulk(double& d, std::string_view sv, system::error_code& ec)
{
auto const res = std::from_chars(sv.data(), sv.data() + std::size(sv), d);
if (res.ec != std::errc())
ec = redis::error::not_a_double;
}
I have to think more.
Indeed, simply having the redis header is enough to fail,
This doesn't compile :
//#include <iostream>
//#include <boost/asio.hpp>
#include <boost/redis.hpp>
int main(int argc, char **argv) {
// std::string host = "127.0.0.1";
// std::string port = "6379";
//
// boost::redis::request request;
// request.push("HELLO", 3);
// request.push("PING", "Hello world!");
// request.push("QUIT");
//
// boost::redis::response<boost::redis::ignore_t, std::string, boost::redis::ignore_t> response;
return 0;
}
Apparently apple-clang doesn't support from_chars
with floating point (it's working with integer), see this link for further info
Thanks for the information. I am considering using my old implementation for clang < 15. You can either try to comment out the code that is not compiling or replace it with
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/home/x3.hpp>
inline
auto parse_double(
char const* data,
std::size_t size,
boost::system::error_code& ec) -> double
{
static constexpr boost::spirit::x3::real_parser<double> p{};
double ret = 0;
if (!parse(data, data + size, p, ret))
ec = error::not_a_double;
return ret;
}
inline
void from_bulk(
double& d,
std::string_view sv,
boost::system::error_code& ec)
void from_bulk(double& d, std::string_view sv, boost::system::error_code& ec)
{
d = parse_double(sv.data(), sv.size(), ec);
}
To reproduce on linux
clang++-14 examples/cpp17_intro.cpp -I ./include/ -I /opt/boost_1_81_0/include/ -stdlib=libc++ -lc++abi -std=c++17
I will add libc++ to the build pipeline. The needed debian packages are libc++-14-dev
and libc++abi-14-dev
Build is now OK on macos for me, thanks a lot !!
Hello everyone,
I'm in the process of trying boot::redis (master, latest commit), unfortunately I'm facing build errors on macos (no errors on Linux),
Looking at the
charconv
header I can see the function is deleted by default, and overrided with several types later,I'm not sure to understand what's wrong here, anyone facing this issue ? Did Boost::redis has already been tested on MacOS ?
I'm using Macos, Darwin-22.3.0 (arm64), AppleClang 14.0.0.14000029, Boost 1.81.0,
Regards,