Solvedpcl Mojave Xcode 10.1; pcl 1.8 make: cmath: no member named isinf

Hi,

I want to build and install PCL 1.8 on MacOS Mojave with Xcode 10.1.

The cmake configuration is done. But make tells me this:

In file included from /usr/local/include/boost/type_traits.hpp:93:
In file included from /usr/local/include/boost/type_traits/is_complex.hpp:12:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/complex:246:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:313:9: error: 
      no member named 'signbit' in the global namespace
using ::signbit;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:314:9: error: 
      no member named 'fpclassify' in the global namespace
using ::fpclassify;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:315:9: error: 
      no member named 'isfinite' in the global namespace; did you mean 'finite'?
using ::isfinite;
      ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/math.h:749:12: note: 
      'finite' declared here
extern int finite(double)
           ^
In file included from /Users/yuminsun/software/pcl-pcl-1.8.1/common/src/point_types.cpp:37:
In file included from /Users/yuminsun/software/pcl-pcl-1.8.1/common/include/pcl/point_types.h:44:
In file included from /Users/yuminsun/software/pcl-pcl-1.8.1/common/include/pcl/register_point_struct.h:65:
In file included from /usr/local/include/boost/type_traits.hpp:93:
In file included from /usr/local/include/boost/type_traits/is_complex.hpp:12:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/complex:246:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:316:9: error: 
      no member named 'isinf' in the global namespace
using ::isinf;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:317:9: error: 
      no member named 'isnan' in the global namespace
using ::isnan;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:318:9: error: 
      no member named 'isnormal' in the global namespace
using ::isnormal;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:319:7: error: 
      no member named 'isgreater' in the global namespace; did you mean
      '::std::greater'?
using ::isgreater;
      ^~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:720:29: note: 
      '::std::greater' declared here
struct _LIBCPP_TEMPLATE_VIS greater : binary_function<_Tp, _Tp, bool>
                            ^
In file included from /Users/yuminsun/software/pcl-pcl-1.8.1/common/src/point_types.cpp:37:
In file included from /Users/yuminsun/software/pcl-pcl-1.8.1/common/include/pcl/point_types.h:44:
In file included from /Users/yuminsun/software/pcl-pcl-1.8.1/common/include/pcl/register_point_struct.h:65:
In file included from /usr/local/include/boost/type_traits.hpp:93:
In file included from /usr/local/include/boost/type_traits/is_complex.hpp:12:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/complex:246:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:320:7: error: 
      no member named 'isgreaterequal' in the global namespace; did you mean
      '::std::greater_equal'?
using ::isgreaterequal;
      ^~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:749:29: note: 
      '::std::greater_equal' declared here
struct _LIBCPP_TEMPLATE_VIS greater_equal : binary_function<_Tp, _Tp, bool>
                            ^
In file included from /Users/yuminsun/software/pcl-pcl-1.8.1/common/src/point_types.cpp:37:
In file included from /Users/yuminsun/software/pcl-pcl-1.8.1/common/include/pcl/point_types.h:44:
In file included from /Users/yuminsun/software/pcl-pcl-1.8.1/common/include/pcl/register_point_struct.h:65:
In file included from /usr/local/include/boost/type_traits.hpp:93:
In file included from /usr/local/include/boost/type_traits/is_complex.hpp:12:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/complex:246:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:321:9: error: 
      no member named 'isless' in the global namespace
using ::isless;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:322:9: error: 
      no member named 'islessequal' in the global namespace
using ::islessequal;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:323:9: error: 
      no member named 'islessgreater' in the global namespace
using ::islessgreater;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:324:9: error: 
      no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:325:9: error: 
      no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
In file included from /Users/yuminsun/software/pcl-pcl-1.8.1/common/src/point_types.cpp:37:
In file included from /Users/yuminsun/software/pcl-pcl-1.8.1/common/include/pcl/point_types.h:344:
In file included from /Users/yuminsun/software/pcl-pcl-1.8.1/common/include/pcl/impl/point_types.hpp:46:
In file included from /opt/local/include/eigen3/Eigen/Core:352:
/opt/local/include/eigen3/Eigen/src/Core/MathFunctions.h:736:16: error: no
      member named 'isfinite' in namespace 'std'; did you mean 'finite'?
    using std::isfinite;
          ~~~~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:315:9: note: 
      'finite' declared here
using ::isfinite;
        ^
In file included from /Users/yuminsun/software/pcl-pcl-1.8.1/common/src/point_types.cpp:37:
In file included from /Users/yuminsun/software/pcl-pcl-1.8.1/common/include/pcl/point_types.h:344:
In file included from /Users/yuminsun/software/pcl-pcl-1.8.1/common/include/pcl/impl/point_types.hpp:46:
In file included from /opt/local/include/eigen3/Eigen/Core:352:
/opt/local/include/eigen3/Eigen/src/Core/MathFunctions.h:751:16: error: no
      member named 'isinf' in namespace 'std'
    using std::isinf;
          ~~~~~^
/opt/local/include/eigen3/Eigen/src/Core/MathFunctions.h:766:16: error: no
      member named 'isnan' in namespace 'std'
    using std::isnan;
          ~~~~~^
16 errors generated.
make[2]: *** [common/CMakeFiles/pcl_common.dir/src/point_types.cpp.o] Error 1
make[1]: *** [common/CMakeFiles/pcl_common.dir/all] Error 2
make: *** [all] Error 2

How could I solve this? Thank you.

41 Answers

✔️Accepted Answer

I encounter this problem too.

Problem

The system uses a wrong toolchain path.

The ysystem should uses "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/..." rather than
"/Library/Developer/CommandLineTools/usr/bin/..."

Solution

Here is the simple solution:

Simply reset the default command line tools path.

sudo xcode-select -r

Using the following command to check the path

clang++ -v

#output will be something like this
# Apple clang version 11.0.0 (clang-1100.0.33.12)
# Target: x86_64-apple-darwin19.0.0
# Thread model: posix
# InstalledDir: 
# /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Other Answers:

Hello, I receive the same error again on macOS Catalina. I think Apple has a different setup between "Xcode.app" and "CommandLineTools". Switching them may solve the problem

OS: macos10.15.4
Toolchains: XCode 11.4.1
PCL version: 1.9.1, 1.10.x

My Solution

Solution 1

Change your macOS Xcode SDK to the CommandlineTools can solve the problem on macOS10.15. Noted that this solution is a global change. It may affect other programs or project building setup.

#Check the current sdk
xcrun --show-sdk-path

#Change sdk
sudo xcode-select -s /Library/Developer/CommandLineTools          #Using CommandLineTools SDK
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer   #Using XCode.app SDK

Here is the SDK location for your reference
Location of your SDK:
Xcode: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
Commandline: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk

Solution 2

Change the SYSROOT to Command line Tools rather than Xcode.app on your PCL compilation working directory. This affects your current cmake directory only.

cmake .. -DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk"

Error Message

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:317:9: error:
      no member named 'signbit' in the global namespace
using ::signbit;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:318:9: error:
      no member named 'fpclassify' in the global namespace
using ::fpclassify;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:319:9: error:
      no member named 'isfinite' in the global namespace; did you mean 'finite'?
using ::isfinite;
      ~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/math.h:749:12: note:
      'finite' declared here
extern int finite(double)
           ^
In file included from <...>
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:320:9: error:
      no member named 'isinf' in the global namespace
using ::isinf;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:321:9: error:
      no member named 'isnan' in the global namespace
using ::isnan;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:322:9: error:
      no member named 'isnormal' in the global namespace
using ::isnormal;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:323:9: error:
      no member named 'isgreater' in the global namespace
using ::isgreater;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:324:9: error:
      no member named 'isgreaterequal' in the global namespace
using ::isgreaterequal;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:325:9: error:
      no member named 'isless' in the global namespace
using ::isless;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:326:9: error:
      no member named 'islessequal' in the global namespace
using ::islessequal;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:327:9: error:
      no member named 'islessgreater' in the global namespace
using ::islessgreater;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:328:9: error:
      no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:329:9: error:
      no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:335:9: error:
      no member named 'abs' in the global namespace; did you mean 'fabs'?
using ::abs;
      ~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/math.h:417:15: note:
      'fabs' declared here
extern double fabs(double);
              ^
In file included from  <...>
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:640:26: error:
      no template named 'numeric_limits'
    bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limit...
                         ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:640:60: error:
      no template named 'numeric_limits'
    bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limit...
                                                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:641:18: error:
      no template named 'numeric_limits'
    int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>...
                 ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:641:50: error:
      no template named 'numeric_limits'
    int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>...
                                                 ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:646:17: error:
      no template named 'numeric_limits'
  static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorre...
                ^

@langeroo 's solution works for me, thanks.

A bit tricky on my side:
There are two version of command line SDK in my MacOS.

~ » /Library/Developer/CommandLineTools/SDKs/MacOSX
/Library/Developer/CommandLineTools/SDKs/MacOSX
MacOSX.sdk/       MacOSX10.14.sdk@

xcrun --show-sdk-path gives out the default one, but actually only MacOSX10.14.sdk works on my side.

Thanks, both the solution and @birdinforest's extra note helped me out.

I used MacOSX10.15.sdk which also works, but what I did is simply remove /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

More Issues: