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

Compile issue on Jetson TX2 #55

Closed
dybedal opened this issue Sep 1, 2017 · 9 comments
Closed

Compile issue on Jetson TX2 #55

dybedal opened this issue Sep 1, 2017 · 9 comments

Comments

@dybedal
Copy link

dybedal commented Sep 1, 2017

I'm trying to compile gpu-voxels on an NVIDIA Jetson TX2, but I run into the following error:

[ 83%] Building NVCC (Device) object packages/gpu_voxels/src/gpu_visualization/CMakeFiles/gpu_voxels_visualization_core_CUDA_TARGET.dir/gpu_voxels_visualization_core_CUDA_TARGET_generated_Visualizer.cu.o
In file included from /usr/include/c++/5/type_traits:35:0,
                 from /usr/local/include/glm/detail/type_int.hpp:8,
                 from /usr/local/include/glm/fwd.hpp:8,
                 from /usr/local/include/glm/glm.hpp:90,
                 from /home/nvidia/gpu-voxels/packages/gpu_voxels/src/gpu_visualization/Visualizer.h:64,
                 from /home/nvidia/gpu-voxels/packages/gpu_voxels/src/gpu_visualization/Visualizer.cu:16:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \
...

I tried adding -std=c++11 to the nvcc flags in packages/gpu-voxels/CMakeLists.txt (ln 139), but that did not work and introduced other errors:

[ 52%] Building NVCC (Device) object packages/gpu_voxels/src/gpu_voxels/helpers/CMakeFiles/gpu_voxels_helpers_CUDA_TARGET.dir/gpu_voxels_helpers_CUDA_TARGET_generated_MetaPointCloud.cu.o
/home/nvidia/gpu-voxels/packages/gpu_voxels/src/gpu_voxels/helpers/cuda_handling.hpp(126): error: no operator "<<" matches these operands
            operand types are: icl_core::logging::ThreadStream << std::stringstream

1 error detected in the compilation of "/tmp/tmpxft_00002911_00000000-5_PointCloud.cpp4.ii".
CMake Error at gpu_voxels_helpers_CUDA_TARGET_generated_PointCloud.cu.o.cmake:266 (message):
  Error generating file
  /home/nvidia/gpu-voxels/build/packages/gpu_voxels/src/gpu_voxels/helpers/CMakeFiles/gpu_voxels_helpers_CUDA_TARGET.dir//./gpu_voxels_helpers_CUDA_TARGET_generated_PointCloud.cu.o
...

Do you have any suggestions?

@Squelsh
Copy link
Contributor

Squelsh commented Sep 1, 2017

Hi Dybedal,

we managed to compile GPU-Voxels on the TX1 once but did not follow that path any longer.
Our code definitely does not require any C++11 features. My guess would be, that you are using a environment wich is too new (like a new Boost version or something) and that some of the dependencies introduce the C++11 requirements.

But as your error log says something about GLM: Did you patch your GLM version? Perhaps you ran into this problem?

Compiling GPU Voxels on a recent linux is on our agenda currently. So if you fix this problem, please share your findings with us.

Good luck,
Andreas

@dybedal
Copy link
Author

dybedal commented Sep 5, 2017

Hi and thanks for your quick reply.

I had already patched the GLM file, so that was not an issue. I managed to compile gpu-voxels without the visualization package, which is a bummer, but at least I can use your library in my project now.

But in my project I am also using other libraries which require C++11 support (i.e. Stereolabs ZED SDK). When I include <gpu_voxels/GpuVoxels.h> I cannot compile due to the missing implementation of the << operator for icl_core::logging::ThreadStream << std::stringstream, as mentioned in the previous post.

However if I just add this declaration to icl_core_logging/ThreadStream.h:
ICL_CORE_LOGGING_IMPORT_EXPORT ThreadStream& operator << (ThreadStream& stream, const std::stringstream& text);.
everything compiles OK, so that seems to be the only issue. Of course the function also needs to be implemented...

I hope adding this will also make it possible to compile everything (including visualization) with C++11 support from the start, but I haven't tested that yet.

BR,
Joacim

@cjue
Copy link
Contributor

cjue commented Sep 5, 2017

Hi Joacim,

sorry for this: we already fixed this bug internally.
I'll release a bugfix release until the end of the week.

Patch

diff --git a/src/gpu_voxels/helpers/cuda_handling.hpp b/src/gpu_voxels/helpers/cuda_handling.hpp
index ae7f3b7..5f171d5 100644
--- a/src/gpu_voxels/helpers/cuda_handling.hpp
+++ b/src/gpu_voxels/helpers/cuda_handling.hpp
@@ -123,7 +123,7 @@ cudaError_t cuPrintDeviceArray(T* dev_array, unsigned int* device_array_size)
{
std::stringstream s;
s << i << ": " << host_array[i];

  • LOGGING_INFO(Gpu_voxels_helpers, s << endl);
  • LOGGING_INFO(Gpu_voxels_helpers, s.str() << endl);
    }
    LOGGING_INFO(Gpu_voxels_helpers, endl);
    delete[] host_array;

@dybedal
Copy link
Author

dybedal commented Sep 5, 2017

Thanks, that worked like a charm!

Not sure how useful this is to you, but this is what I had to do to be able to compile the visualization package with C++11 support:

Patch:

File: gpu_voxels/packages/gpu_voxels/src/gpu_voxels/helpers/cuda_handling.hpp ln 126:
LOGGING_INFO(Gpu_voxels_helpers, s.str() << endl);

Enable C++11 support:

File: gpu-voxels/CMakeLists.txt (top):

CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
SET(CMAKE_CXX_STANDARD 11)

Enable C++11 support for nvcc:

Workaround for GLM error "...this file requires C+11..." (using latest GLM from github):
File: gpu-voxels/packages/gpu_voxels/CMakeLists.txt (ln 139):
SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler=-Wall -std=c++11")

isnan must be ::isnan:

Reference
File: gpu_voxels/src/gpu_voxels/octree/PointCloud.cu (ln 411):
return !::isnan(v.x) & !::isnan(v.y) & !::isnan(v.z);

static const float --> static constexpr float:

Reference
File: gpu_voxels/src/gpu_voxels/octree/load_balancer/AbstractLoadBalancer.h (ln 59):
static constexpr float DEFAULT_IDLE_THESHOLD = 2.0f/3.0f;

error "GLM: GLM_GTX_transform is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it."

File: gpu-voxels/packages/gpu_voxels/src/gpu_visualization/Primitive.h (ln 32):
#define GLM_ENABLE_EXPERIMENTAL

FYI: I do not have ROS installed at the moment, so I have not tried to compile with ROS support. The following configuration was built:

-- ------------------------ GPU Voxels configuration ------------------------
--   
-- [OK]      Building GPU-Voxels. Found CUDA.
-- [OK]      Building GPU-Voxels with visualization. GLEW, GLM, OpenGL and GLUT were found.
-- [WARNING] Building GPU-Voxels without ROS connections. ROS not found.
-- [WARNING] Building GPU-Voxels without URDF support. Could not find the following packages:
--     urdfdom
--     orocos_kdl
--     kdl_parser
--     ROS
-- [OK]      Building GPU-Voxels with Kinect support. OpenNI was found.
-- [OK]      Building GPU-Voxels with PCL interfaces. PCL found.
--   
-- -------------------- END of GPU Voxels configuration ---------------------

@dybedal
Copy link
Author

dybedal commented Sep 11, 2017

Update: Installed ROS Kinetic and was able to build with ROS and URDF support, but had to apply your fix in another file as well:

diff --git a/packages/gpu_voxels/src/gpu_voxels/robot/urdf_robot/robot_link.cpp b/packages/gpu_voxels/src/gpu_voxels/robot/urdf_robot/robot_link.cpp
index f4f7221..1f75a8a 100644
--- a/packages/gpu_voxels/src/gpu_voxels/robot/urdf_robot/robot_link.cpp
+++ b/packages/gpu_voxels/src/gpu_voxels/robot/urdf_robot/robot_link.cpp
@@ -155,7 +155,7 @@ RobotLink::RobotLink(Robot* robot,
     desc << "  This link has NO geometry.";
   }
 
-  LOGGING_DEBUG_C(RobotLog, RobotLink, desc << endl);
+  LOGGING_DEBUG_C(RobotLog, RobotLink, desc.str() << endl);
 
 }

@Squelsh
Copy link
Contributor

Squelsh commented Sep 13, 2017

Hi dybedal,
thanks a lot for sharing those findings! C++11 is really relevant.
Why don't you create a clone of GPU-Voxels and push your fixes?
So we can either create a C++11 branch or just merge them into the master.

@cjue
Copy link
Contributor

cjue commented Feb 5, 2018

All the mentioned fixes should be included in the new 1.1 Release: d9914ac

The one exception is "GLM_ENABLE_EXPERIMENTAL". I did not yet encounter the corresponding GLM is myself. Which GLM version is this related to?

@Changliu52
Copy link

I am able to compile it in tx2 with the latest commit in https://github.com/g-truc/glm.git, be53cebcd3ec3366e30f520bfaa35991274fc390 with GLM_ENABLE_EXPERIMENTAL set, with ros and urdf

@cjue
Copy link
Contributor

cjue commented Feb 7, 2018

Thanks for the feedback! The GLM_ENABLE_EXPERIMENTAL define will be added to Primitive.h for release 1.1.2.

Strange though, that it is not treated as a compile error on Ubuntu 14.04 and 16.04 GLM.

@cjue cjue closed this as completed Feb 7, 2018
cjue added a commit that referenced this issue Feb 8, 2018
Fix Cuda 9.1 linking problem that broke voxellist code using Thrust CUB: always use shared cudart library

Known issues:
- Octrees are broken on Pascal GPUs
  - confirmed on Titan Xp and GTX 1080 Ti
- the GLM in Ubuntu 16.04 has to be patched to allow usage of the visualizer.
  - see g-truc/glm#530
  - patch for /usr/include/glm/detail/func_common.inl in packages/gpu_voxels/doc/glm_fix_issu530.patch

Minor changes:
- added synchronization points after some voxellist Thrust calls
- removed obsolete explicit Kinect.cpp references in src/examples
- define GLM_ENABLE_EXPERIMENTAL in Primitive.h to fix issue #55
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

4 participants