NVlabs / nvdiffrast

Nvdiffrast - Modular Primitives for High-Performance Differentiable Rendering
Other
1.37k stars 146 forks source link

/usr/bin/ld: cannot find -lEGL #85

Closed Eric-JH closed 2 years ago

Eric-JH commented 2 years ago

Reproduction: dr.set_log_level(0)

System: 146~16.04.1-Ubuntu Driver Version: 460.27.04
CUDA Version: 11.2

error info:

Traceback (most recent call last):
  File "triangle.py", line 14, in <module>
    dr.set_log_level(0)
  File "/home/sunhz/anaconda3/envs/3DFFA/lib/python3.7/site-packages/nvdiffrast/torch/ops.py", line 118, in set_log_level
    _get_plugin().set_log_level(level)
  File "/home/sunhz/anaconda3/envs/3DFFA/lib/python3.7/site-packages/nvdiffrast/torch/ops.py", line 84, in _get_plugin
    torch.utils.cpp_extension.load(name=plugin_name, sources=source_paths, extra_cflags=opts, extra_cuda_cflags=opts, extra_ldflags=ldflags, with_cuda=True, verbose=False)
  File "/home/sunhz/anaconda3/envs/3DFFA/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1214, in load
    keep_intermediates=keep_intermediates)
  File "/home/sunhz/anaconda3/envs/3DFFA/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1435, in _jit_compile
    is_standalone=is_standalone)
  File "/home/sunhz/anaconda3/envs/3DFFA/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1540, in _write_ninja_file_and_build_library
    error_prefix=f"Error building extension '{name}'")
  File "/home/sunhz/anaconda3/envs/3DFFA/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1824, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error building extension 'nvdiffrast_plugin': [1/1] c++ common.o glutil.o rasterize.cuda.o rasterize.o interpolate.cuda.o texture.cuda.o texture.o antialias.cuda.o torch_bindings.o torch_rasterize.o torch_interpolate.o torch_texture.o torch_antialias.o -shared -lGL -lEGL -L/home/sunhz/anaconda3/envs/3DFFA/lib/python3.7/site-packages/torch/lib -lc10 -lc10_cuda -ltorch_cpu -ltorch_cuda -ltorch -ltorch_python -L/usr/local/cuda-11.2/lib64 -lcudart -o nvdiffrast_plugin.so
FAILED: nvdiffrast_plugin.so
c++ common.o glutil.o rasterize.cuda.o rasterize.o interpolate.cuda.o texture.cuda.o texture.o antialias.cuda.o torch_bindings.o torch_rasterize.o torch_interpolate.o torch_texture.o torch_antialias.o -shared -lGL -lEGL -L/home/sunhz/anaconda3/envs/3DFFA/lib/python3.7/site-packages/torch/lib -lc10 -lc10_cuda -ltorch_cpu -ltorch_cuda -ltorch -ltorch_python -L/usr/local/cuda-11.2/lib64 -lcudart -o nvdiffrast_plugin.so
/usr/bin/ld: cannot find -lEGL
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

It seems to be caused by lack of libEGL. But I ran apt-get install libegl1-mesa-dev command. Did I install wrong package? Can U give me some advice plz?

Eric-JH commented 2 years ago

I solved this problem by using apt-file to find proper package. procedure: apt-get install apt-file. If you have installed apt-file, this step could be ignored. apt-file update apt-file search libEGL.so. Find the missing package. apt-get install ***. Install the proper package.