Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiling error on M1 Macbook pro #50

Closed
usccolumbia opened this issue Oct 30, 2022 · 17 comments
Closed

compiling error on M1 Macbook pro #50

usccolumbia opened this issue Oct 30, 2022 · 17 comments

Comments

@usccolumbia
Copy link

when pip install point_cloud_utils

got this error:
CMake Error: The source directory "/private/var/folders/_1/z9htdvys25dbgnl4nfxmvhf80000gn/T/pip-install-ihjh_3ei/point-cloud-utils_55486fa531a24a6886398db7d72c948d" does not appear to contain CMakeLists.txt.

@maurock
Copy link
Contributor

maurock commented Jan 7, 2023

Hi @usccolumbia, I am having the same issue. Could you find a solution? Thank you.

@fwilliams
Copy link
Owner

fwilliams commented Jan 7, 2023

I have a branch where I started working on a fix for M1 macs. I do t have a mac to debug on. I’d really love some help fixing this! Happy to help pair program on this.

@fwilliams
Copy link
Owner

fwilliams commented Jan 7, 2023

See #42 and #41 as well for relevant discussion on M1 compilation

@maurock
Copy link
Contributor

maurock commented Jan 7, 2023

I think that the issue could be the incompatibility of the external libraries embree and geogram with ARM. It looks like the compiler assumes the incorrect architecture. When building geogram, CMake calls /Library/Developer/CommandLineTools/usr/lib/clang/<VERSION>/include/immintrin.h, which seems to be a x86 specific file.

Maybe a solution could be to install geogram and embree using Homebrew, which installs the two libraries in '/opt/homebrew/Cellar/embree/3.13.5' and '/opt/homebrew/Cellar/geogram/1.8.2', and link these two libraries to the project in CMakeLists.txt. I am trying to do that, but I haven't been lucky so far.

@fwilliams
Copy link
Owner

I'd like to explore getting rid of Geogram as a dependency.

The latest version of embree does work on M1/M2 macs as discussed here in #42

I think the only functions using Geogram currently are the ones in src/lloyd.cpp which are a bit janky (the lloyd mesh sampling API is not consistent with other functions, there are a bunch of copies between numpy and geogram to create meshes, and I'm not sure if people are really using the 2D sampling functions).

One option is to disable it only on Mac for now.

@maurock
Copy link
Contributor

maurock commented Jan 8, 2023

Thank you, I have updated embree to v3.13.2 in my local files and added a few if statements to disable Geogram for Mac. It builds up to CMakeFiles/_pcu_internal.dir/signed_distance.out.cpp.o, where it fails because point-cloud-utils/external/igl/FastWindingNumberForSoups.h:374 includes emmintrin.h. This PR libigl/libigl#1686 seems related to the issue.

Updating external/igl/ with this updated version of the library https://github.com/libigl/libigl seems to solve the incompatibility, but it breaks src/fast_winding_numbers.cpp.

@fwilliams
Copy link
Owner

Thanks @maurock for looking into this!

How does it break fast_winding_numbers? Is it a compiler error or does it not work at runtime? Could you post the error and I'll try and fix it.

If you also send a PR I can see if I can repro the fast_winding_number problem locally (assuming it also breaks on Linux).

@fwilliams
Copy link
Owner

@maurock I created a branch which (1) updates embree, and (2) updates libIGL. I also fixed the fast_winding_number.cpp compiler errors and pointed the libigl dep to my fork with those fixes. Can you try to add your geogram checks on this branch and see if things build on Mac?

Link to the PR with the changes is here: #54

@maurock
Copy link
Contributor

maurock commented Jan 9, 2023

Hi @fwilliams, thanks. I have added the checks for geogram and lloyd.cpp, but it still fails when it reaches FastWindingNumberForSoups.h:374:

      [ 86%] Building CXX object CMakeFiles/_pcu_internal.dir/signed_distance.out.cpp.o
      clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument]
      In file included from /Users/ri21540/Documents/PhD/Code/point-cloud-utils/build/temp.macosx-11.0-arm64-cpython-38/signed_distance.out.cpp:4:
      In file included from /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/igl/include/igl/signed_distance.h:14:
      In file included from /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/igl/include/igl/fast_winding_number.h:4:
      In file included from /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/igl/include/igl/FastWindingNumberForSoups.h:374:
      In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/emmintrin.h:13:
      In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/xmmintrin.h:13:
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
          __builtin_ia32_emms();
          ^
      /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/math.h:670:12: note: '__builtin_isless' declared here
          return isless(__lcpp_x, __lcpp_y);
                 ^
      /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/math.h:545:22: note: expanded from macro 'isless'
      #define isless(x, y) __builtin_isless((x),(y))
                           ^
      In file included from /Users/ri21540/Documents/PhD/Code/point-cloud-utils/build/temp.macosx-11.0-arm64-cpython-38/signed_distance.out.cpp:4:
      In file included from /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/igl/include/igl/signed_distance.h:14:
      In file included from /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/igl/include/igl/fast_winding_number.h:4:
      In file included from /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/igl/include/igl/FastWindingNumberForSoups.h:374:
      In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/emmintrin.h:13:
      In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/xmmintrin.h:13:
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:25: error: too few arguments to function call, expected 2, have 0
          __builtin_ia32_emms();
          ~~~~~~~~~~~~~~~~~~~~^
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
          return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                        ^
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:67:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
          return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
                 ^
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:129:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
          return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
                        ^
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:159:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
          return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
                        ^
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:189:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
          return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
                        ^
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:216:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
          return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
                        ^
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:239:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
          return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
                        ^
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:260:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
          return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
                        ^
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:287:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
          return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
                        ^
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:310:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
          return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
                        ^
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:331:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
          return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
                        ^
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: error: use of undeclared identifier '__builtin_ia32_paddb'; did you mean '__builtin_arm_addg'?
          return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                        ^
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: error: first argument of MTE builtin function must be a pointer ('__v8qi' (vector of 8 'char' values) invalid)
          return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                        ^                    ~~~~~~~~~~~~
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:373:19: error: use of undeclared identifier '__builtin_ia32_paddw'; did you mean '__builtin_arm_addg'?
          return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                        ^
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
          return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                        ^
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:373:19: error: first argument of MTE builtin function must be a pointer ('__v4hi' (vector of 4 'short' values) invalid)
          return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                        ^                    ~~~~~~~~~~~~
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:394:19: error: use of undeclared identifier '__builtin_ia32_paddd'; did you mean '__builtin_arm_addg'?
          return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
                        ^
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
          return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                        ^
      /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:394:19: error: first argument of MTE builtin function must be a pointer ('__v2si' (vector of 2 'int' values) invalid)
          return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
                        ^                    ~~~~~~~~~~~~
      fatal error: too many errors emitted, stopping now [-ferror-limit=]
      20 errors generated.
      make[2]: *** [CMakeFiles/_pcu_internal.dir/signed_distance.out.cpp.o] Error 1
      make[2]: *** Waiting for unfinished jobs....
      make[1]: *** [CMakeFiles/_pcu_internal.dir/all] Error 2
      make: *** [all] Error 2
      Traceback (most recent call last):
        File "/Users/ri21540/miniforge3/envs/active_touch/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/Users/ri21540/miniforge3/envs/active_touch/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/ri21540/miniforge3/envs/active_touch/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-_jy0_3at/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 413, in build_wheel
          return self._build_with_temp_dir(['bdist_wheel'], '.whl',
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-_jy0_3at/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 398, in _build_with_temp_dir
          self.run_setup()
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-_jy0_3at/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 116, in <module>
        File "<string>", line 89, in main
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-_jy0_3at/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-_jy0_3at/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-_jy0_3at/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-_jy0_3at/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-_jy0_3at/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 1208, in run_command
          super().run_command(command)
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-_jy0_3at/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-_jy0_3at/overlay/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 325, in run
          self.run_command("build")
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-_jy0_3at/overlay/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-_jy0_3at/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 1208, in run_command
          super().run_command(command)
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-_jy0_3at/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-_jy0_3at/overlay/lib/python3.8/site-packages/setuptools/_distutils/command/build.py", line 132, in run
          self.run_command(cmd_name)
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-_jy0_3at/overlay/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-_jy0_3at/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 1208, in run_command
          super().run_command(command)
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-_jy0_3at/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "<string>", line 39, in run
        File "<string>", line 72, in build_extension
        File "/Users/ri21540/miniforge3/envs/active_touch/lib/python3.8/subprocess.py", line 364, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j2']' returned non-zero exit status 2.

@maurock
Copy link
Contributor

maurock commented Jan 9, 2023

In addition to my previous comment: by replacing igl with the newer version (https://github.com/libigl/libigl/), it compiles up to 95%, but it then fails at src/fast_winding_numbers.out.cpp:

[ 95%] Building CXX object CMakeFiles/_pcu_internal.dir/fast_winding_numbers.out.cpp.o
      clang: warning: argument unused during compilation: '-msse3' [-Wunused-command-line-argument]
      In file included from /Users/ri21540/Documents/PhD/Code/point-cloud-utils/build/temp.macosx-11.0-arm64-cpython-38/fast_winding_numbers.out.cpp:2:
      In file included from /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/numpyeigen/cmake/../src/npe.h:9:
      In file included from /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/numpyeigen/external/pybind11/include/pybind11/eigen.h:30:
      In file included from /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/numpyeigen/cmake/../external/eigen/Eigen/Core:434:
      /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/numpyeigen/cmake/../external/eigen/Eigen/src/Core/DenseCoeffsBase.h:141:7: error: static_assert failed due to requirement 'internal::evaluator<Eigen::Map<Eigen::Matrix<float, -1, -1, 2, -1, -1>, 0, Eigen::Stride<-1, -1>>>::Flags & LinearAccessBit' "THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS"
            EIGEN_STATIC_ASSERT(internal::evaluator<Derived>::Flags & LinearAccessBit,
            ^                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/numpyeigen/cmake/../external/eigen/Eigen/src/Core/util/StaticAssert.h:33:40: note: expanded from macro 'EIGEN_STATIC_ASSERT'
          #define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);
                                             ^             ~
      /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/numpyeigen/cmake/../external/eigen/Eigen/src/Core/DenseCoeffsBase.h:181:14: note: in instantiation of member function 'Eigen::DenseCoeffsBase<Eigen::Map<Eigen::Matrix<float, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, 0>::coeff' requested here
            return coeff(index);
                   ^
      /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/igl/include/igl/fast_winding_number.cpp:66:24: note: in instantiation of member function 'Eigen::DenseCoeffsBase<Eigen::Map<Eigen::Matrix<float, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, 0>::operator()' requested here
                areatotal += A(curr_point_index);
                             ^
      /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/igl/include/igl/fast_winding_number.cpp:348:3: note: in instantiation of function template specialization 'igl::fast_winding_number<Eigen::Map<Eigen::Matrix<float, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, Eigen::Map<Eigen::Matrix<float, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, Eigen::Map<Eigen::Matrix<float, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, int, Eigen::Matrix<int, -1, 8, 0>, Eigen::Matrix<float, -1, 3, 0>, Eigen::Matrix<float, -1, 1, 0>, Eigen::Matrix<float, -1, -1, 0>>' requested here
        fast_winding_number(P,N,A,point_indices,CH,expansion_order,CM,R,EC);
        ^
      /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/igl/include/igl/fast_winding_number.cpp:365:3: note: in instantiation of function template specialization 'igl::fast_winding_number<Eigen::Map<Eigen::Matrix<float, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, Eigen::Map<Eigen::Matrix<float, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, Eigen::Map<Eigen::Matrix<float, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, Eigen::Map<Eigen::Matrix<float, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, double, Eigen::Matrix<float, -1, -1, 1>>' requested here
        fast_winding_number(P,N,A,Q,2,2.0,WN);
        ^
      /Users/ri21540/Documents/PhD/Code/point-cloud-utils/build/temp.macosx-11.0-arm64-cpython-38/fast_winding_numbers.out.cpp:57:10: note: in instantiation of function template specialization 'igl::fast_winding_number<Eigen::Map<Eigen::Matrix<float, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, Eigen::Map<Eigen::Matrix<float, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, Eigen::Map<Eigen::Matrix<float, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, Eigen::Map<Eigen::Matrix<float, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, Eigen::Matrix<float, -1, -1, 1>>' requested here
          igl::fast_winding_number(p, n, a, q, w);
               ^
      In file included from /Users/ri21540/Documents/PhD/Code/point-cloud-utils/build/temp.macosx-11.0-arm64-cpython-38/fast_winding_numbers.out.cpp:2:
      In file included from /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/numpyeigen/cmake/../src/npe.h:9:
      In file included from /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/numpyeigen/external/pybind11/include/pybind11/eigen.h:30:
      In file included from /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/numpyeigen/cmake/../external/eigen/Eigen/Core:434:
      /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/numpyeigen/cmake/../external/eigen/Eigen/src/Core/DenseCoeffsBase.h:141:7: error: static_assert failed due to requirement 'internal::evaluator<Eigen::Map<Eigen::Matrix<double, -1, -1, 2, -1, -1>, 0, Eigen::Stride<-1, -1>>>::Flags & LinearAccessBit' "THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS"
            EIGEN_STATIC_ASSERT(internal::evaluator<Derived>::Flags & LinearAccessBit,
            ^                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/numpyeigen/cmake/../external/eigen/Eigen/src/Core/util/StaticAssert.h:33:40: note: expanded from macro 'EIGEN_STATIC_ASSERT'
          #define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);
                                             ^             ~
      /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/numpyeigen/cmake/../external/eigen/Eigen/src/Core/DenseCoeffsBase.h:181:14: note: in instantiation of member function 'Eigen::DenseCoeffsBase<Eigen::Map<Eigen::Matrix<double, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, 0>::coeff' requested here
            return coeff(index);
                   ^
      /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/igl/include/igl/fast_winding_number.cpp:66:24: note: in instantiation of member function 'Eigen::DenseCoeffsBase<Eigen::Map<Eigen::Matrix<double, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, 0>::operator()' requested here
                areatotal += A(curr_point_index);
                             ^
      /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/igl/include/igl/fast_winding_number.cpp:348:3: note: in instantiation of function template specialization 'igl::fast_winding_number<Eigen::Map<Eigen::Matrix<double, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, Eigen::Map<Eigen::Matrix<double, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, Eigen::Map<Eigen::Matrix<double, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, int, Eigen::Matrix<int, -1, 8, 0>, Eigen::Matrix<double, -1, 3, 0>, Eigen::Matrix<double, -1, 1, 0>, Eigen::Matrix<double, -1, -1, 0>>' requested here
        fast_winding_number(P,N,A,point_indices,CH,expansion_order,CM,R,EC);
        ^
      /Users/ri21540/Documents/PhD/Code/point-cloud-utils/external/igl/include/igl/fast_winding_number.cpp:365:3: note: in instantiation of function template specialization 'igl::fast_winding_number<Eigen::Map<Eigen::Matrix<double, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, Eigen::Map<Eigen::Matrix<double, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, Eigen::Map<Eigen::Matrix<double, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, Eigen::Map<Eigen::Matrix<double, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, double, Eigen::Matrix<double, -1, -1, 1>>' requested here
        fast_winding_number(P,N,A,Q,2,2.0,WN);
        ^
      /Users/ri21540/Documents/PhD/Code/point-cloud-utils/build/temp.macosx-11.0-arm64-cpython-38/fast_winding_numbers.out.cpp:57:10: note: in instantiation of function template specialization 'igl::fast_winding_number<Eigen::Map<Eigen::Matrix<double, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, Eigen::Map<Eigen::Matrix<double, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, Eigen::Map<Eigen::Matrix<double, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, Eigen::Map<Eigen::Matrix<double, -1, -1, 2>, 0, Eigen::Stride<-1, -1>>, Eigen::Matrix<double, -1, -1, 1>>' requested here
          igl::fast_winding_number(p, n, a, q, w);
               ^
      2 errors generated.
      make[2]: *** [CMakeFiles/_pcu_internal.dir/fast_winding_numbers.out.cpp.o] Error 1
      make[2]: *** Waiting for unfinished jobs....
      make[1]: *** [CMakeFiles/_pcu_internal.dir/all] Error 2
      make: *** [all] Error 2
      Traceback (most recent call last):
        File "/Users/ri21540/miniforge3/envs/active_touch/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/Users/ri21540/miniforge3/envs/active_touch/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/ri21540/miniforge3/envs/active_touch/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-5yv_xrzk/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 413, in build_wheel
          return self._build_with_temp_dir(['bdist_wheel'], '.whl',
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-5yv_xrzk/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 398, in _build_with_temp_dir
          self.run_setup()
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-5yv_xrzk/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 116, in <module>
        File "<string>", line 89, in main
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-5yv_xrzk/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-5yv_xrzk/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-5yv_xrzk/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-5yv_xrzk/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-5yv_xrzk/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 1208, in run_command
          super().run_command(command)
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-5yv_xrzk/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-5yv_xrzk/overlay/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 325, in run
          self.run_command("build")
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-5yv_xrzk/overlay/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-5yv_xrzk/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 1208, in run_command
          super().run_command(command)
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-5yv_xrzk/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-5yv_xrzk/overlay/lib/python3.8/site-packages/setuptools/_distutils/command/build.py", line 132, in run
          self.run_command(cmd_name)
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-5yv_xrzk/overlay/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-5yv_xrzk/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 1208, in run_command
          super().run_command(command)
        File "/private/var/folders/yl/kyjv_cpj1j70_ry0q6699fbh0000gq/T/pip-build-env-5yv_xrzk/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "<string>", line 39, in run
        File "<string>", line 72, in build_extension
        File "/Users/ri21540/miniforge3/envs/active_touch/lib/python3.8/subprocess.py", line 364, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j2']' returned non-zero exit status 2.

@fwilliams
Copy link
Owner

fwilliams commented Jan 9, 2023

Thanks @maurock ! Can you try the latest commit on PR #54 now? I patched this file with the fix from here libigl/libigl@1db662b

@maurock
Copy link
Contributor

maurock commented Jan 10, 2023

It compiles with no errors! But I had to place a few checks for geogram and lloyd.cpp, so python returns this error when I import the package:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Input In [1], in <cell line: 3>()
      1 import os
      2 import numpy as np
----> 3 import point_cloud_utils as pcu
      4 import plotly.graph_objects as go
      6 # Path to the bench category as an example

File ~/miniforge3/envs/active_touch/lib/python3.8/site-packages/point_cloud_utils/__init__.py:4, in <module>
      1 from warnings import warn
----> 4 from ._pcu_internal import sample_mesh_poisson_disk, sample_mesh_random, \
      5     downsample_point_cloud_poisson_disk, estimate_mesh_vertex_normals, \
      6     estimate_mesh_face_normals, orient_mesh_faces, \
      7     k_nearest_neighbors, one_sided_hausdorff_distance, \
      8     morton_encode, morton_decode, morton_knn, \
      9     lloyd_2d, lloyd_3d, voronoi_centroids_unit_cube, sample_mesh_lloyd, \
     10     deduplicate_point_cloud, deduplicate_mesh_vertices, signed_distance_to_mesh, \
     11     closest_points_on_mesh, connected_components, ray_mesh_intersection, laplacian_smooth_mesh, \
     12     make_mesh_watertight, mesh_principal_curvatures, \
     13     morton_add, morton_subtract, point_cloud_fast_winding_number, \
     14     sparse_voxel_grid_boundary, marching_cubes_sparse_voxel_grid, decimate_triangle_mesh, \
     15     remove_unreferenced_mesh_vertices, mesh_face_areas, triangle_soup_fast_winding_number
     17 from ._sinkhorn import *
     18 from ._mesh_io import *

ImportError: cannot import name 'lloyd_2d' from 'point_cloud_utils._pcu_internal' (/Users/ri21540/miniforge3/envs/active_touch/lib/python3.8/site-packages/point_cloud_utils/_pcu_internal.cpython-38-darwin.so)

@fwilliams
Copy link
Owner

Ah yeah that’s because lloyd_2d is implemented using geogram 🙂

this import needs to be fenced off on macos

@maurock
Copy link
Contributor

maurock commented Jan 10, 2023

Hi @fwilliams, I have slightly edited the point_cloud_utils/__init__.py to avoid importing lloyd_2d, lloyd_3d, sample_mesh_lloyd, voronoi_centroids_unit_cube on MacOS. The functions to extract SDF values now work! I used an if-statement rather than a try/except block for that. Methods based on those packages will fail on MacOS.

Everything looks fine:
image

I am going to test it and add it to my workflow right away :)

Should I make a merge request so that you can see the changes I made?

@fwilliams
Copy link
Owner

🎉 🎉 🎉 great!

I am going to merge #54 which does most of what you need. Can you create a PR with your changes on top of the updated main branch? We can hopefully get this merged and I'll cut a new release with M1 mac support!

@fwilliams
Copy link
Owner

@maurock Okay everything is merged, you can rebase your changes and create a PR!

@fwilliams
Copy link
Owner

This is fixed! I'll release a new version soon. Meanwhile, source builds should work on M1 macs and ARM processors in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants