Closed nh2 closed 3 years ago
To make it clear, do you mean that you get the error with gcc
and pcl-1.7.1
tag? (Or only with the current master?)
I get the error on both pcl-1.7.1
and on master
when I use gcc
/g++
for them.
At least on pcl-1.7.1
, I can get around the error by using clang++
instead of g++
; I am not sure if this workaround also works on master
.
As far as I see you do not have VTK. I would suggest to install it because you won't get any visualization without it in the first place, and also because some discussions on the pcl-users mailing list indicate that your problem might be related to VTK/Qt.
Install these packages, sudo apt-get install libvtk5-dev libvtk5-qt4-dev
, then reconfigure the build (or even better, delete 'build' directory completely and run cmake
again).
I installed vtk as you suggested, but I still get such errors (now even with clang++
):
Scanning dependencies of target pcl_cuda_sample_consensus
Linking CXX shared library ../../lib/libpcl_cuda_sample_consensus.so
/usr/bin/ld: CMakeFiles/pcl_cuda_sample_consensus.dir/src/./pcl_cuda_sample_consensus_generated_multi_ransac.cu.o: relocation R_X86_64_PC32 against symbol `_ZN3pcl4cuda15min_nr_in_shapeE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libpcl_cuda_sample_consensus.so.1.7.1] Error 1
make[1]: *** [cuda/sample_consensus/CMakeFiles/pcl_cuda_sample_consensus.dir/all] Error 2
My new config:
rm -rf * && cmake .. -DCMAKE_INSTALL_PREFIX=/data/nh910/opt/pcl -DOPENNI_LIBRARY=/data/nh910/src/pcl-deps/OpenNI/Platform/Linux/Redist/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10/Lib/libOpenNI.so -DOPENNI_INCLUDE_DIR=/data/nh910/src/pcl-deps/OpenNI/Platform/Linux/Redist/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10/Include -DBUILD_visualization=ON -DBUILD_apps=ON -DBUILD_CUDA=ON -DBUILD_GPU=ON -DBUILD_gpu_kinfu=ON -DBUILD_gpu_kinfu_large_scale=ON -DCMAKE_BUILD_TYPE=Debug
zsh: sure you want to delete all the files in /data/nh910/src/pcl/build [yn]? y
-- The C compiler identification is GNU 4.7.3
-- The CXX compiler identification is Clang 3.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26")
-- Using CPU native flags for SSE optimization: -march=native
-- Performing Test HAVE_MM_MALLOC
-- Performing Test HAVE_MM_MALLOC - Success
-- Performing Test HAVE_POSIX_MEMALIGN
-- Performing Test HAVE_POSIX_MEMALIGN - Success
-- Performing Test HAVE_SSE4_2_EXTENSIONS
-- Performing Test HAVE_SSE4_2_EXTENSIONS - Success
-- Performing Test HAVE_SSE4_1_EXTENSIONS
-- Performing Test HAVE_SSE4_1_EXTENSIONS - Success
-- Performing Test HAVE_SSE3_EXTENSIONS
-- Performing Test HAVE_SSE3_EXTENSIONS - Success
-- Performing Test HAVE_SSE2_EXTENSIONS
-- Performing Test HAVE_SSE2_EXTENSIONS - Success
-- Performing Test HAVE_SSE_EXTENSIONS
-- Performing Test HAVE_SSE_EXTENSIONS - Success
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [/openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-Qopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-openmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [ ]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-xopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [+Oopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-qsmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Try OpenMP CXX flag = [-mp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Failed
-- Could NOT find OpenMP (missing: OpenMP_CXX_FLAGS)
-- Not found OpenMP
-- Boost version: 1.49.0
-- Found the following Boost libraries:
-- system
-- filesystem
-- thread
-- date_time
-- iostreams
-- checking for module 'eigen3'
-- package 'eigen3' not found
-- Found Eigen: /data/nh910/opt/pcl/include/eigen3
-- Eigen found (include: /data/nh910/opt/pcl/include/eigen3, version: 3.1.2)
-- checking for module 'flann>=1.7.0'
-- package 'flann>=1.7.0' not found
-- Found FLANN: /data/nh910/opt/pcl/lib/libflann_cpp.so (Required is at least version "1.7.0")
-- FLANN found (include: /data/nh910/opt/pcl/include, lib: optimized;/data/nh910/opt/pcl/lib/libflann_cpp.so;debug;/data/nh910/opt/pcl/lib/libflann_cpp.so)
-- Found LIBUSB_1: /data/nh910/opt/pcl/lib/libusb-1.0.so
-- checking for module 'libusb-1.0'
-- package 'libusb-1.0' not found
-- Found USB_10: /data/nh910/opt/pcl/lib/libusb-1.0.so
-- Found OpenNI: /data/nh910/src/pcl-deps/OpenNI/Platform/Linux/Redist/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10/Lib/libOpenNI.so
-- OpenNI found (include: /data/nh910/src/pcl-deps/OpenNI/Platform/Linux/Redist/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10/Include, lib: /data/nh910/src/pcl-deps/OpenNI/Platform/Linux/Redist/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10/Lib/libOpenNI.so)
-- Could NOT find FZAPI (missing: FZAPI_LIBS FZAPI_INCLUDE_DIR)
-- Could NOT find PXCAPI (missing: PXCAPI_LIBS PXCAPI_INCLUDE_DIRS PXCAPI_LIB_DIRS)
-- checking for module 'metslib'
-- package 'metslib' not found
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.7")
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.2.49")
-- Could NOT find Qhull (missing: QHULL_LIBRARY QHULL_INCLUDE_DIR)
-- Found CUDA Toolkit v5.5
-- CUDA NVCC target flags: -gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_20,code=sm_21;-gencode;arch=compute_30,code=sm_30
-- Could NOT find QVTK (missing: QVTK_LIBRARY QVTK_INCLUDE_DIR)
-- VTK found (include: /data/nh910/opt/pcl/include/vtk-6.1, lib: )
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.3.1")
-- Could NOT find PCAP (missing: PCAP_LIBRARIES PCAP_INCLUDE_DIRS)
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- VTK found (include: /data/nh910/opt/pcl/include/vtk-6.1, lib: )
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
-- Found Glew: /usr/lib/x86_64-linux-gnu/libGLEW.so
-- DOXYGEN_FOUND YES
-- HTML_HELP_COMPILER
-- checking for module 'sphinx-build'
-- package 'sphinx-build' not found
-- Found PythonInterp: /usr/bin/python (found version "2.7.4")
-- Could NOT find Sphinx (missing: SPHINX_EXECUTABLE)
-- Found CPack generators: DEB
-- The following subsystems will be built:
-- common
-- geometry
-- octree
-- io
-- kdtree
-- search
-- sample_consensus
-- filters
-- 2d
-- features
-- ml
-- segmentation
-- visualization
-- surface
-- registration
-- keypoints
-- tracking
-- recognition
-- stereo
-- apps
not building:
|_ cloud_composer: Cloud composer requires QVTK
|_ in_hand_scanner: No reason
|_ modeler: VTK was not built with Qt support.
|_ optronic_viewer: VTK was not built with Qt support.
|_ point_cloud_editor: No reason
|_ 3d_rec_framework: No reason
-- outofcore
-- people
-- tools
-- cuda_common
-- cuda_features
-- cuda_segmentation
-- cuda_sample_consensus
-- gpu_containers
-- gpu_utils
-- gpu_octree
-- gpu_features
-- gpu_kinfu
-- gpu_kinfu_large_scale
-- gpu_segmentation
-- The following subsystems will not be built:
-- examples: Code examples are disabled by default.
-- global_tests: No reason
-- cuda_io: Disabled by default.
-- cuda_apps: Disabled manually.
-- gpu_people: Disabled by default.
-- gpu_surface: Disabled by default.
-- gpu_tracking: Disabled by default.
-- simulation: Disabled by default.
-- Configuring done
-- Generating done
-- Build files have been written to: /data/nh910/src/pcl/build
Did you check these two threads on the mailing list:
There are a couple of suggestions there, but no definitive answer. Perhaps you may contact the people who had the problem and ask how did they end up solving it.
I just read them, but I don't get it quite yet.
I ran with make VERBOSE=1
and got:
/usr/bin/c++ -fPIC -Wall -Wextra -Wno-unknown-pragmas -fno-strict-aliasing -Wno-format-extra-args -Wno-sign-compare -Wno-invalid-offsetof -Wno-conversion -march=native -msse4.2 -mfpmath=sse -Wabi -pthread -fopenmp -fPIE -fPIE -fPIE -fPIE -fPIE -g -Wl,--as-needed -shared -Wl,-soname,libpcl_common.so.1.7 -o ../lib/libpcl_common.so.1.7.1 CMakeFiles/pcl_common.dir/src/point_types.cpp.o CMakeFiles/pcl_common.dir/src/pcl_base.cpp.o CMakeFiles/pcl_common.dir/src/io.cpp.o CMakeFiles/pcl_common.dir/src/common.cpp.o CMakeFiles/pcl_common.dir/src/correspondence.cpp.o CMakeFiles/pcl_common.dir/src/distances.cpp.o CMakeFiles/pcl_common.dir/src/intersections.cpp.o CMakeFiles/pcl_common.dir/src/parse.cpp.o CMakeFiles/pcl_common.dir/src/poses_from_matches.cpp.o CMakeFiles/pcl_common.dir/src/print.cpp.o CMakeFiles/pcl_common.dir/src/projection_matrix.cpp.o CMakeFiles/pcl_common.dir/src/time_trigger.cpp.o CMakeFiles/pcl_common.dir/src/gaussian.cpp.o CMakeFiles/pcl_common.dir/src/bearing_angle_image.cpp.o CMakeFiles/pcl_common.dir/src/range_image.cpp.o CMakeFiles/pcl_common.dir/src/range_image_planar.cpp.o CMakeFiles/pcl_common.dir/src/fft/kiss_fft.c.o CMakeFiles/pcl_common.dir/src/fft/kiss_fftr.c.o -L/data/nh910/opt/pcl/lib/vtk-5.10 -lboost_system-mt -lboost_filesystem-mt -lboost_thread-mt -lpthread -lboost_date_time-mt -lboost_iostreams-mt -lm -Wl,-rpath,/data/nh910/opt/pcl/lib/vtk-5.10::::::::::::::::::::::::
/usr/bin/ld: CMakeFiles/pcl_common.dir/src/io.cpp.o: relocation R_X86_64_PC32 against symbol `_Z9fieldCompPKN3pcl13PCLPointFieldES2_' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Do you know where the -fPIE -fPIE -fPIE -fPIE -fPIE
might come from?
This Stack Overflow comment seems to mean that you can't make shared libraries with -fPIE
- maybe that's the problem?
(I tried to just remove the -fPIE -fPIE -fPIE -fPIE -fPIE
from this invocation, but that doesn't change anything - if the problem is related to -fPIE
, it probably means that one of the used .o
files was compiled with -fPIE
.)
For comparison, here is how my verbose output looks like (newlines added by me):
/opt/llvm/bin/clang++
-fPIC -ftemplate-depth=1024 -Qunused-arguments
-Wno-invalid-offsetof -O2 -g -DNDEBUG -Wl,--as-needed -shared
-Wl,-soname,libpcl_common.so.1.7
-o ../lib/libpcl_common.so.1.7.1
CMakeFiles/pcl_common.dir/src/point_types.cpp.o
CMakeFiles/pcl_common.dir/src/pcl_base.cpp.o CMakeFiles/pcl_common.dir/src/io.cpp.o
CMakeFiles/pcl_common.dir/src/common.cpp.o
CMakeFiles/pcl_common.dir/src/correspondence.cpp.o
CMakeFiles/pcl_common.dir/src/distances.cpp.o
CMakeFiles/pcl_common.dir/src/intersections.cpp.o CMakeFiles/pcl_common.dir/src/parse.cpp.o
CMakeFiles/pcl_common.dir/src/poses_from_matches.cpp.o
CMakeFiles/pcl_common.dir/src/print.cpp.o
CMakeFiles/pcl_common.dir/src/projection_matrix.cpp.o
CMakeFiles/pcl_common.dir/src/time_trigger.cpp.o
CMakeFiles/pcl_common.dir/src/gaussian.cpp.o
CMakeFiles/pcl_common.dir/src/bearing_angle_image.cpp.o
CMakeFiles/pcl_common.dir/src/range_image.cpp.o
CMakeFiles/pcl_common.dir/src/range_image_planar.cpp.o
CMakeFiles/pcl_common.dir/src/fft/kiss_fft.c.o CMakeFiles/pcl_common.dir/src/fft/kiss_fftr.c.o
-lboost_system -lboost_filesystem -lboost_thread -lboost_date_time -lboost_iostreams
-lpthread -lm -Wl,-rpath,::::::::::::::
Just remove the Qt5 checking ubuntu didn't fix that issue, use solely Qt4
Just remove the Qt5 checking ubuntu didn't fix that issue, use solely Qt4
For people who wonder how to do this:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 01fdec9..24584e0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -300,7 +300,8 @@ find_package(Qhull)
include("${PCL_SOURCE_DIR}/cmake/pcl_find_cuda.cmake")
# Find Qt5
-include(cmake/pcl_find_qt5.cmake)
+# Use Qt4 instead due to https://github.com/PointCloudLibrary/pcl/issues/466
+#include(cmake/pcl_find_qt5.cmake)
# Find QT4
if(NOT QT5_FOUND)
@nizar-sallem wouldn't it make sense to fix this in master as well?
Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.
Does the debian release include -fPIC
option? The replicated setup is available in .dev/docker/release/Dockerfile
If so, then the current master has no issues with this flag (based on the release CI which just ran yesterday) and the issue can be closed.
Closing as lack of response. I have encountered something similar in #4619. I suggest opening a new issue, if it still present for master or any more recent version.
I get this when
g++
is used for compiling branchpcl-1.7.1
and master 669a963:On
pcl-1.7.1
, I can successfully build withexport CXX=clang++
.This is my
cmake
output:Any idea what's going on here? I'm on Ubuntu 13.04 64 bit.