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

Any known issues on WSL? / Trouble building ceres solver #142

Open
tworkool opened this issue Jun 20, 2024 · 5 comments
Open

Any known issues on WSL? / Trouble building ceres solver #142

tworkool opened this issue Jun 20, 2024 · 5 comments

Comments

@tworkool
Copy link

tworkool commented Jun 20, 2024

Hello,
I am trying to build and install the dependencies with cmake and gcc on WSL, but it fails to compile these dependencies. Ive tried everything that comes to my mind (updating, reinstalling packages etc.). Has anybody tried building it on WSL and also had trouble? I cannot build the ceres solver.

@Phil26AT
Copy link
Collaborator

Hey! It used to work on WSL some time ago, but haven't tried it recently. Do you know what breaks or have some logs?

@tworkool
Copy link
Author

Thanks for the quick response. I actually just managed to buiuld and install ceres on WSL by allocation more host memory.
However when trying to install the python dependencies pyceres and pycolmap from source they both fail. Here is some log content after running pip install for the requirements:

     In file included from /root/miniconda3/envs/pixsfm/include/python3.12/Python.h:42,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/detail/common.h:186,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/pytypes.h:12,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/cast.h:13,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/attr.h:13,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/pybind11.h:13,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/iostream.h:22,
                       from /tmp/pip-req-build-r6heusdq/_pyceres/bindings.cc:1:
      /root/miniconda3/envs/pixsfm/include/python3.12/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
         22 | typedef struct _frame PyFrameObject;
            |                ^~~~~~
      In file included from /root/miniconda3/envs/pixsfm/include/python3.12/Python.h:38,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/detail/common.h:186,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/pytypes.h:12,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/cast.h:13,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/attr.h:13,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/pybind11.h:13,
                       from /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/iostream.h:22,
                       from /tmp/pip-req-build-r6heusdq/_pyceres/bindings.cc:1:
      /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/pybind11.h: In function ‘pybind11::function pybind11::detail::get_type_override(const void*, const pybind11::detail::type_info*, const char*)’:
      /tmp/pip-req-build-r6heusdq/pybind11/include/pybind11/pybind11.h:2348:29: error: ‘PyCodeObject’ {aka ‘struct PyCodeObject’} has no member named ‘co_varnames’; did you mean ‘co_names’?
       2348 |                     locals, PyTuple_GET_ITEM(f_code->co_varnames, 0)
            |                             ^~~~~~~~~~~~~~~~
      make[2]: *** [CMakeFiles/pyceres.dir/build.make:76: CMakeFiles/pyceres.dir/_pyceres/bindings.cc.o] Error 1
      make[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/pyceres.dir/all] Error 2
      make: *** [Makefile:91: all] Error 2
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-req-build-r6heusdq/setup.py", line 80, in <module>
          setup(
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/__init__.py", line 104, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 184, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
          dist.run_commands()
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/wheel/bdist_wheel.py", line 368, in run
          self.run_command("build")
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/_distutils/command/build.py", line 132, in run
          self.run_command(cmd_name)
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/dist.py", line 967, in run_command
          super().run_command(command)
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-req-build-r6heusdq/setup.py", line 34, in run
          self.build_extension(ext)
        File "/tmp/pip-req-build-r6heusdq/setup.py", line 77, in build_extension
          subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
        File "/root/miniconda3/envs/pixsfm/lib/python3.12/subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j2']' returned non-zero exit status 2.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyceres
  Running setup.py clean for pyceres
Failed to build pycolmap pyceres
ERROR: Could not build wheels for pycolmap, pyceres, which is required to install pyproject.toml-based projects

@tworkool
Copy link
Author

I am not too familiar with building py packages from source and also have not a lot of experience with cmake tbh... So any tip is helpful atp

@Phil26AT
Copy link
Collaborator

Phil26AT commented Jun 25, 2024

Hi @tworkool, sorry for the late reply. I think this is related to the pybind version being outdated, and not compatible with your python version (are you running on 3.11?). I'd suggest to just update pybind in pixsfm to the first release version that supports python 3.11. You might have to apply these changes upstream too, e.g. in pyceres. If this solves your issue please open a PR! :)

@tworkool
Copy link
Author

I managed to get everything installed in a new conda environment with python 3.8.2
As you mentioned, I updated the requirements for pybind, pycolmap and pyceres. I bumped the versions to the following:

  • pybind v2.11.1
  • pyceres v2.2
  • pycolmap >= 0.6.0

Before I was using python 3.12, havent tried to setup in that environment but am gonna stick with 3.8.2
When I am done with testing I will open a PR. Thanks for the tip!

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

2 participants