yuecideng / Misc3D

A unified library for 3D data processing with both c++ and python API
MIT License
62 stars 10 forks source link

build error: undefined reference to `open3d::core::Tensor::~Tensor()' #21

Closed SubChange closed 2 years ago

SubChange commented 2 years ago

I'm very interesting in your work. I have spent a lot of time to build the codes on ununtu20.04, but it still have problems. The environment I used is as the follow:

I have build the Open3D from source successfully. Then, I have install Misc3D according to your tutorial, the commands are as follows

git clone https://github.com/yuecideng/Misc3D.git

cd Misc3D

mkdir build
mkdir misc3d_install
cd build

cmake -DCMAKE_PREFIX_PATH=/home/subchange/dev_build/Open3D/install -DCMAKE_INSTALL_PREFIX=../misc3d_install ..

Note that the path /home/subchange/dev_build/Open3D/install is the path where I have install Open3D

Please see the errors in the follow

image-20220504204106460

image-20220504205605428

image-20220504205630117

image-20220504205657777

image-20220504205722222

image-20220504205305559

I do not good at c++ language. Cloud you please give me some help to build the project from source? Thank you very much.

yuecideng commented 2 years ago

Hi, could you show me your cmake configuration for open3d? Please check that -DGLIBCXX_USE_CXX11_ABI=ON is set when you build open3d from source.

SubChange commented 2 years ago

I have build Open3D using the follow commands:


git clone --recursive https://github.com/intel-isl/Open3D
git checkout v0.15.1

util/install_deps_ubuntu.sh -y

mkdir build
mkdir install
cd build

conda activate py37
which python

cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=Debug .. 

make -j4
make install -j4
make pip-package

It has generate the *.whl file (build/lib/python_package/pip_package/open3d-0.13.0+c3f9de224-cp37-cp37m-manylinux_2_31_x86_64.whl)

The result are as follows:

image-20220504214200312

image-20220504214217326

yuecideng commented 2 years ago

Maybe try to set -DDBUILD_SHARED_LIBS=ON to build shared library for open3d, since I did not try static library under linux platform...

I will try your configuration mentioned above to see how to solve this probelm. But it may take some time.

Update: I have tried static library which is not probelm for building misc3d. So I think the probelm maybe due to CMAKE_BUILD_TYPE=Debug. You can change this to Release to see whether it can solve this. @SubChange

SubChange commented 2 years ago

Thank you very much, I actually not build the shared library. Thank you for your suggestions. I will try to build Open3D this way.

SubChange commented 2 years ago

hello, thank you for your help. I have rebuild the Open3D with CMAKE_BUILD_TYPE=Release, -DBUILD_SHARED_LIBS=ON and -DGLIBCXX_USE_CXX11_ABI=ON. Open3D was successfully build, but there are some warnings during building as the follow. However, I have not encountered these warnings with CMAKE_BUILD_TYPE=Debug

image-20220504234714589

Then, when I build MIsc3D, no errors occurred, again only some warnings

image-20220505000600999

After I set path in ~/.bashrc, I successfully ran the following code.

import numpy as np
import time
from random import random
import open3d as o3d
import misc3d as m3d

pcd = o3d.io.read_point_cloud('../data/segmentation/test.ply')

t0 = time.time()
results = m3d.segmentation.segment_plane_iterative(pcd, 0.01, 100, 0.1)
print('Segmentation time: %.3f' % (time.time() - t0))

show = []
for cluster in results:
    w, c = cluster
    c.paint_uniform_color(np.array([random(), random(), random()]))
    show.append(c)

o3d.visualization.draw_geometries(show, 'Iterative Plane Segmentation')

I don't know if there is anything wrong with those warnings, have you encountered them during building from source?

In sum, though some warnings occurred, It seems that it works. It works anyway. I have listed my commands as follows:

Open3D

git clone --recursive https://github.com/intel-isl/Open3D
cd Open3D

git tag
git checkout v0.15.1

git submodule update --init --recursive

util/install_deps_ubuntu.sh -y

mkdir build
mkdir open3d_install
cd build

conda activate py37
which python

cmake -DCMAKE_INSTALL_PREFIX=../open3d_install -DCMAKE_BUILD_TYPE=Debug .. #Failed

cmake -DBUILD_SHARED_LIBS=ON -DGLIBCXX_USE_CXX11_ABI=ON -DCMAKE_INSTALL_PREFIX=../open3d_install -DCMAKE_BUILD_TYPE=Release ..

make -j4
make install -j4
make pip-package

Misc3D

git clone https://github.com/yuecideng/Misc3D.git

cd Misc3D

mkdir build

mkdir misc3d_install

cd build

conda activate py37

cmake -DCMAKE_PREFIX_PATH=/home/subchange/dev_build/Open3D/open3d_install -DCMAKE_INSTALL_PREFIX=../misc3d_install ..

make install -j

It should be mentioned that I have make some modifications to the Misc3D/CMakeLists.txt file in line 72 to help it found Open3D library.

#find_package(Open3D REQUIRED NO_DEFAULT_PATH)
find_package(Open3D REQUIRED)
message(STATUS "Open3D_DIR = ${Open3D_DIR}")
message(STATUS "Open3D_INCLUDE_DIRS = ${Open3D_INCLUDE_DIRS}")
message(STATUS "Open3D_LIBS = ${Open3D_LIBS}")
yuecideng commented 2 years ago

Glad to hear that.

The warning messages can be mostly igored. Don't worry about them. You can set -DOpen3D_DIR=/path/to/install/open3d to cmake configure without change the original CMakeLists.txt.

SubChange commented 2 years ago

Glad to hear that.

The warning messages can be mostly igored. Don't worry about them. You can set -DOpen3D_DIR=/path/to/install/open3d to cmake configure without change the original CMakeLists.txt.

I have tried this setting -DOpen3D_DIR=/path/to/install/open3d, however, it didn't work. I delete NO_DEFAULT_PATH in the sentence find_package(Open3D REQUIRED NO_DEFAULT_PATH) and set -DCMAKE_PREFIX_PATH=/home/subchange/dev_build/Open3D/open3d_install, then, it works. Anyway, it works now. thank you very much.