Ubuntu20.04安装0pen3d及ISPC失败解决方案

25 篇文章 0 订阅
11 篇文章 0 订阅

描述

Ubuntu20.04安装Open3d

安装命令

# To install Open3D Python packages
$ pip install open3d

# To install Open3D C++ packages
$ git clone https://github.com/isl-org/Open3D
$ cd Open3D
$ util/install_deps_ubuntu.sh # Only needed for Ubuntu
$ mkdir build && cd build
$ cmake ..
$ make
$ sudo make install

python安装

pip3 install open3d

解决方案

把解决方案贴在前面。
cmake ..这步可能出现下面描述的问题,请把它调整为:

cmake .. -DBUILD_ISPC_MODULE=ON

剩下继续上面的安装命令即可

出现错误

1. cmake 版本不符

这个很好解决。
我需要编译的工程,也就是 https://github.com/isl-org/Open3D
它的Cmake最低版本要求是3.20,我的版本是3.16,做一下升级即可。

可以查看我的另外一篇博客:Ubuntu20.04升级cmake(不用去额外删除现有版本)

2. ISPC_ISAS相关

我在执行cmake..时出现错误,报错内容如下:

/home/chen/CodeBase/Open3D/cmake/ispc_isas/../../cpp/open3d/utility/Preprocessor.h:1:1750: warning: null character ignored
/home/chen/CodeBase/Open3D/cmake/ispc_isas/../../cpp/open3d/utility/Preprocessor.h:3:280: 
        Error: Illegal character: � (0xffffff9d) 


make[2]: *** [CMakeFiles/ispc_isas.dir/build.make:92:CMakeFiles/ispc_isas.dir/ISADispatcher.ispc.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:83:CMakeFiles/ispc_isas.dir/all] 错误 2
make: *** [Makefile:91:all] 错误 2
CMake Error at cmake/Open3DMakeISPCInstructionSets.cmake:57 (find_program):
  Could not find ISPC_ISAS_EXECUTABLE using the following names: ispc_isas
Call Stack (most recent call first):
  CMakeLists.txt:420 (open3d_make_ispc_instruction_sets)


-- Configuring incomplete, errors occurred!
See also "/home/chen/CodeBase/Open3D/build/CMakeFiles/CMakeOutput.log".

报错内容的前两个部分,报错了很多行,而且内容非常一致。

错误原因

观察报错内容,我们找到了CMakeLists.txt对应的行,在52-56行

if(NOT LINUX_AARCH64 AND NOT APPLE_AARCH64)
    option(BUILD_ISPC_MODULE      "Build the ISPC module"                    ON )
else()
    option(BUILD_ISPC_MODULE      "Build the ISPC module"                    OFF)
endif()

最开始我认识是第57行BUILD_COMMON_ISPC_ISAS的问题

option(BUILD_COMMON_ISPC_ISAS     "Build for common ISPC ISAs (for release)" OFF)

所以我利用了两种办法进行解决
第一种是:

cmake .. -DBUILD_COMMON_ISPC_ISAS=ON

第二种是将CMakeLists.txt中的该变量,OFF改成ON

option(BUILD_COMMON_ISPC_ISAS     "Build for common ISPC ISAs (for release)" ON)

这两种办法都暂时让cmake不会报错了。

其中我们发现函数在对系统进行判断后,会对BUILD_ISPC_MODULE进行ON或者OFF的设定

我们发现,这个变量被置成了OFF,这样参数没有起作用,导致了编译失败

但是在执行make的时候,会弹出无数个如下的错误。

/home/chen/CodeBase/Open3D/cpp/open3d/utility/Preprocessor.h:16:78: warning: null character ignored
/home/chen/CodeBase/Open3D/cpp/open3d/utility/Preprocessor.h:19:117: warning: null character(s) preserved in string literal
/home/chen/CodeBase/Open3D/cpp/open3d/utility/Preprocessor.h:19:191: warning: missing terminating ' character
/home/chen/CodeBase/Open3D/cpp/open3d/utility/Preprocessor.h:20:78: warning: missing terminating '"' character
<DB><U+0018>R/<F5><9D><FE>*<C9><FE>k*<F8><CB>#<U+0013>\<U+001D>`<A8>g<BE><F2><U+0008><94><C2>qr<E1><U+0017>BO]Q<FA><U+0005><F0>Q۲C<U+0013>*<U+0003>,<FD><82><U+0005><9E><B2>ydn<D0><D0><F4><98><96><81>ĕm<85>s<B1><FB><BE>W6\|Ƹ<U+000E><A5><B8> o<D8><C3>%<E0>J<91><80>Xe8<A0>I`<86>b<80>ض@<CA><U+0018>H<84>!<C6><D4>WS9z"<BE>J<D9><F9><U+001E>3\<D9><U+0019>V<U+001E><U+0006><C2>P<BC><EB><D2><U+0000><D7>Ό<U+0014> MJ<AE><BC><B5>'<C5>f<8F><B7><U+0006><87>Fc<9A><F6>ݘ<99>
In file included from /home/chen/CodeBase/Open3D/cpp/open3d/core/Indexer.ispc:27:
In file included from /home/chen/CodeBase/Open3D/cpp/open3d/core/Indexer.isph:29:
In file included from /home/chen/CodeBase/Open3D/cpp/open3d/core/ParallelFor.isph:29:
In file included from /home/chen/CodeBase/Open3D/cpp/open3d/utility/Helper.isph:31:

这些错误是一致的而且很多,多到忽略了真实的提示。因此我在执行make时,不等错误全部输出时,就ctrl+c进行了中断,终于看到了shell正确提示的错误。

/home/chen/CodeBase/Open3D/cpp/open3d/core/Indexer.ispc
/home/chen/CodeBase/Open3D/cpp/open3d/core/Indexer.isph

github上的issue上,我发现应该是作者之一进行了这样的描述:.ispc是ispc编译器自动生成的文件。报的错误实际上是字符错误,同时我打开了工程中的Indexer.ispcIndexer.isph文件,我发现vscode并没有将这些看似是C++代码的进行变色,在我的工程里他们的字体是白色的。我觉得这本身是一件很奇怪的问题。

因此我打算关掉BUILD_ISPC_MODULE,因为这个变量的名字是说是否使用ISPC模块,我想尝试关掉这个模块会怎么样。不出我所料,Open3d这次被成功编译并且安装了。解决方案在上面写了,这里在写一遍。

cmake .. -DBUILD_ISPC_MODULE=ON

后记

util/install_deps_ubuntu.sh中,我们还发现这样的一句话:

if [ "$DISTRIB_ID" == "Ubuntu" -a "$DISTRIB_RELEASE" == "18.04" ]; then
# Ubuntu 18.04's clang/libc++-dev/libc++abi-dev are version 6.
    # To build Filament from source, we need version 7+.
    deps=("${deps[@]/clang/clang-7}")
    deps=("${deps[@]/libc++-dev/libc++-7-dev}")
    deps=("${deps[@]/libc++abi-dev/libc++abi-7-dev}")
fi

显然如官网所说,Open3d在Ubuntu18.04中进行安装。我的系统是Ubuntu20.04,显然不会进入下面的安装步骤。
我安装时,为以防万一,将18.04改成了20.04。但我认为这是无关紧要的一条更改,因为20.04可能本身版本就是7+(当然了,我并没有去确认这件事…)。

  • 4
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值