niessner / Opt

Opt DSL
Other
254 stars 68 forks source link

Something wrong with set-up: compilation, runtime bugs #130

Open Algomorph opened 6 years ago

Algomorph commented 6 years ago

Hello! I'm attempting to try out Opt on Ubuntu 16.04 right now, and I have encountered problems with the building process. Disclaimer: I have Cuda 9, so I modified the Makefiles to reflect this. The difference in CUDA version doesn't seem to be the source of the problem.

I have clang 3.8.0 installed, and the recommended terra release, 2016-03-25, unpacked to folder "terra" in the same directory where the Opt repository resides, as per the instructions. Opt API seems to have been built correctly, but when I'm running make for the volumetric_mesh_deformation, I'm getting the following linker error:

../external/OpenMesh/include/OpenMesh/Core/IO/MeshIO.hh:141: undefined reference to `OpenMesh::IO::IOManager::read(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, OpenMesh::IO::BaseImporter&, OpenMesh::IO::Options&)' clang: error: linker command failed with exit code 1 (use -v to see invocation) ../shared/make_template.inc:42: recipe for target 'volumetric_mesh_deformation' failed make: *** [volumetric_mesh_deformation] Error 1

Looks like it is unable to properly link to the OpenMesh libraries for some reason.

So I actually made a set of CMakeLists.txt for the top-level directory, down to the the mLib Library (to compile to a static library), and down to the volumetric_mesh_deformation example. I've set the compiler to clang++ and was able to successfully build everything. I've tried with the bundled OpenMesh and also with a (slightly) more recent OpenMesh built separately using gcc and installed on the system, both seem to link fine.

However, when I run the volumetric_mesh_deformation example after compiling with the bundled OpenMesh, I get:

[OpenMesh::IO::IOManager] No reading modules available! Error -> File: /home/algomorph/Garage/Opt/examples/volumetric_mesh_deformation/src/main.cpp Line: 16 Function: main ../data/head.ply

The farthest I've been able to get was when I run it with the external OpenMesh 6.3 I've built, but then I'm getting this error:

LLVM ERROR: Program used external function 'cudaDeviceGetAttribute' which could not be resolved!

Looking at various resources online, this may be symptomatic of shared/dynamic libraries linked by Clang being compiled with gcc, which kind of baffles me -- all CUDA libraries, regardless of version, are built using gcc. I'm not sure how to approach this other than trying to install cuda-7.5, but doubtful this would help. I would appreciate any suggestions.

Algomorph commented 6 years ago

Based on #111 I guess I'm wrong: if terra is pre-compiled with cuda 7.5, this is exactly the issue for the last error I'm getting. However, the previous two errors remain unsolved.

Algomorph commented 6 years ago

I've built Terra with Cuda 9.2, but the sane LLVM error ('used external function .. could not be resolved') remains when I try to run the example. I don't know if it relates to some Terra issues, i.e. some of the terra test cases fail on my machine after the build, perhaps this one: https://github.com/zdevito/terra/issues/288

[EDIT}: Seems like I cannot/should not install cuda-7.5 without installing a separate OS, because it seems like only cuda-8 and later are supported on Ubuntu 16.04 (likely, due to gcc version issues), so that option isn't really on the table.

Mx7f commented 6 years ago

I will be trying to get CUDA 9 support out of the box, and will be testing on Ubuntu 16.04 as one of the main targets, so hopefully we will be able to resolve this somewhat soon.