autonomousvision / occupancy_networks

This repository contains the code for the paper "Occupancy Networks - Learning 3D Reconstruction in Function Space"
https://avg.is.tuebingen.mpg.de/publications/occupancy-networks
MIT License
1.51k stars 292 forks source link

ninja: build stopped: subcommand failed. #96

Closed jiaqiAA closed 3 years ago

jiaqiAA commented 3 years ago

Hi,

When I run python setup.py build_ext --inplace, I met a problem 3 4

Does anyone know how to solve it? Thanks in advance.

AlexsaseXie commented 3 years ago

I have the same problem with the RTX 3090 server which use CUDA 11.1. So the correspoding pytorch has to be 1.8.1 (or newer). By the way, g++ version is 9.3.0.

tsunghan-wu commented 3 years ago

I meet the same problem QQ.

AlexsaseXie commented 3 years ago

OK... Finally I fixed this issue.

It is because the building error of pykdtree which is written in C (not C++). I don't clearly know the mechanism of pytorch but I found that in pytorch 1.0.0, the BuildExtension module will call gcc to compile the C code which should be Okay. While in pytorch 1.8.1, the BuildExtension module will call c++ to compile which will cause error because of the type checking or some other grammar issue.

So the solution is to write another setup_c.py to compile the pykdtree module which uses standard build_ext module. The code is like follows:

…
from setuptools.command.build_ext import build_ext
…
ext_modules = [
    pykdtree,
]

setup(
    ext_modules = cythonize(ext_modules),
    include_dirs=[numpy.get_include()],
    cmd_class={
        'build_ext': build_ext
    }
)
jiaqiAA commented 3 years ago

Thanks very much, it is useful.

tsunghan-wu commented 3 years ago

Thanks @AlexsaseXie very much, it works!