hosseinmoein / DataFrame

C++ DataFrame for statistical, Financial, and ML analysis -- in modern C++ using native types and contiguous memory storage
https://hosseinmoein.github.io/DataFrame/
BSD 3-Clause "New" or "Revised" License
2.38k stars 298 forks source link

Compile Failed with `VERSION 2.0.0` #280

Closed shaojunjie0912 closed 6 months ago

shaojunjie0912 commented 6 months ago

Hi, I'm new to DataFrame.

I use the VERSION 2.0.0 to build, I know my compiler should support C++ 17 at least.

But it failed, and I don't know what happened. Here is the error of make.

In file included from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/DataFrameStatsVisitors.h:37,
                 from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/DataFrame.h:32,
                 from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/benchmarks/dataframe_performance_2.cc:28:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h: In function ‘auto hmdf::abs__(const T&) [with T = float]’:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h:239:48: error: ‘fabsf’ is not a member of ‘std’; did you mean ‘fabs’?
  239 | abs__<float>(const float &val)  { return (std::fabsf(val)); }
      |                                                ^~~~~
      |                                                fabs
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h: In function ‘auto hmdf::abs__(const T&) [with T = long double]’:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h:247:60: error: ‘fabsl’ is not a member of ‘std’; did you mean ‘fabs’?
  247 | abs__<long double>(const long double &val)  { return (std::fabsl(val)); }
      |                                                            ^~~~~
      |                                                            fabs
In file included from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/DataFrameStatsVisitors.h:37,
                 from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/DataFrame.h:32,
                 from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/test/dataframe_thread_safety.cc:1:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h: In function ‘auto hmdf::abs__(const T&) [with T = float]’:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h:239:48: error: ‘fabsf’ is not a member of ‘std’; did you mean ‘fabs’?
  239 | abs__<float>(const float &val)  { return (std::fabsf(val)); }
      |                                                ^~~~~
      |                                                fabs
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h: In function ‘auto hmdf::abs__(const T&) [with T = long double]’:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h:247:60: error: ‘fabsl’ is not a member of ‘std’; did you mean ‘fabs’?
  247 | abs__<long double>(const long double &val)  { return (std::fabsl(val)); }
      |                                                            ^~~~~
      |                                                            fabs
In file included from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/DataFrameStatsVisitors.h:37,
                 from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/DataFrame.h:32,
                 from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/benchmarks/dataframe_performance.cc:28:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h: In function ‘auto hmdf::abs__(const T&) [with T = float]’:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h:239:48: error: ‘fabsf’ is not a member of ‘std’; did you mean ‘fabs’?
  239 | abs__<float>(const float &val)  { return (std::fabsf(val)); }
      |                                                ^~~~~
      |                                                fabs
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h: In function ‘auto hmdf::abs__(const T&) [with T = long double]’:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h:247:60: error: ‘fabsl’ is not a member of ‘std’; did you mean ‘fabs’?
  247 | abs__<long double>(const long double &val)  { return (std::fabsl(val)); }
      |                                                            ^~~~~
      |                                                            fabs
In file included from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/DataFrameStatsVisitors.h:37,
                 from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/DataFrame.h:32,
                 from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/examples/hello_world.cc:28:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h: In function ‘auto hmdf::abs__(const T&) [with T = float]’:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h:239:48: error: ‘fabsf’ is not a member of ‘std’; did you mean ‘fabs’?
  239 | abs__<float>(const float &val)  { return (std::fabsf(val)); }
      |                                                ^~~~~
      |                                                fabs
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h: In function ‘auto hmdf::abs__(const T&) [with T = long double]’:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h:247:60: error: ‘fabsl’ is not a member of ‘std’; did you mean ‘fabs’?
  247 | abs__<long double>(const long double &val)  { return (std::fabsl(val)); }
      |                                                            ^~~~~
      |                                                            fabs
In file included from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/DataFrameStatsVisitors.h:37,
                 from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/DataFrame.h:32,
                 from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/test/dataframe_tester_schema.cc:1:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h: In function ‘auto hmdf::abs__(const T&) [with T = float]’:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h:239:48: error: ‘fabsf’ is not a member of ‘std’; did you mean ‘fabs’?
  239 | abs__<float>(const float &val)  { return (std::fabsf(val)); }
      |                                                ^~~~~
      |                                                fabs
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h: In function ‘auto hmdf::abs__(const T&) [with T = long double]’:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h:247:60: error: ‘fabsl’ is not a member of ‘std’; did you mean ‘fabs’?
  247 | abs__<long double>(const long double &val)  { return (std::fabsl(val)); }
      |                                                            ^~~~~
      |                                                            fabs
In file included from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/DataFrameStatsVisitors.h:37,
                 from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/DataFrame.h:32,
                 from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/test/dataframe_tester_3.cc:27:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h: In function ‘auto hmdf::abs__(const T&) [with T = float]’:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h:239:48: error: ‘fabsf’ is not a member of ‘std’; did you mean ‘fabs’?
  239 | abs__<float>(const float &val)  { return (std::fabsf(val)); }
      |                                                ^~~~~
      |                                                fabs
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h: In function ‘auto hmdf::abs__(const T&) [with T = long double]’:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h:247:60: error: ‘fabsl’ is not a member of ‘std’; did you mean ‘fabs’?
  247 | abs__<long double>(const long double &val)  { return (std::fabsl(val)); }
      |                                                            ^~~~~
      |                                                            fabs
In file included from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/DataFrameStatsVisitors.h:37,
                 from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/DataFrame.h:32,
                 from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/test/dataframe_tester.cc:28:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h: In function ‘auto hmdf::abs__(const T&) [with T = float]’:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h:239:48: error: ‘fabsf’ is not a member of ‘std’; did you mean ‘fabs’?
  239 | abs__<float>(const float &val)  { return (std::fabsf(val)); }
      |                                                ^~~~~
      |                                                fabs
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h: In function ‘auto hmdf::abs__(const T&) [with T = long double]’:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h:247:60: error: ‘fabsl’ is not a member of ‘std’; did you mean ‘fabs’?
  247 | abs__<long double>(const long double &val)  { return (std::fabsl(val)); }
      |                                                            ^~~~~
      |                                                            fabs
In file included from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/DataFrameStatsVisitors.h:37,
                 from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/DataFrame.h:32,
                 from /home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/test/dataframe_tester_2.cc:28:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h: In function ‘auto hmdf::abs__(const T&) [with T = float]’:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h:239:48: error: ‘fabsf’ is not a member of ‘std’; did you mean ‘fabs’?
  239 | abs__<float>(const float &val)  { return (std::fabsf(val)); }
      |                                                ^~~~~
      |                                                fabs
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h: In function ‘auto hmdf::abs__(const T&) [with T = long double]’:
/home/olioolii/Third-Party-Pacakges/DataFrame-2.0.0/include/DataFrame/Utils/Utils.h:247:60: error: ‘fabsl’ is not a member of ‘std’; did you mean ‘fabs’?
  247 | abs__<long double>(const long double &val)  { return (std::fabsl(val)); }
      |                                                            ^~~~~
      |                                                            fabs

Here is the output of CMake. I add the message to show the version of compilers.

cmake输出

Here are the actual versions of compilers in my machine below. Is my compiler version insufficient?

gcc和clang版本

How can I fix this problem? Should I specify the compiler manually? If so, what can I do?

Thanks a lot!!!

shaojunjie0912 commented 6 months ago

Here is my test for C++ 17 in neovim using clangd.

cpp17测试
hosseinmoein commented 6 months ago

I cannot reproduce this on my side. so I cannot really debug it. My guess is that there is something wrong with your compiler installation of header files, because fabsf is defined in std name space https://en.cppreference.com/w/cpp/numeric/math/fabs

As an experiment include the following headers first

#include <cmath>
#include <cstdlib>

If that doesn't fix it than there is definitely something wrong with your compiler installation.

shaojunjie0912 commented 6 months ago

Thanks a lot, I will check the problem of my compiler later.